Overview
ETH Balance
0 ETH
ETH Value
$0.00More Info
Private Name Tags
ContractCreator
Multichain Info
No addresses found
Latest 25 from a total of 97,912 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Mint | 18300022 | 4 mins ago | IN | 0 ETH | 0.00000015 | ||||
New Mint Config | 18300014 | 4 mins ago | IN | 0 ETH | 0.00000024 | ||||
Mint | 18299963 | 6 mins ago | IN | 0 ETH | 0.00000015 | ||||
New Mint Config | 18299954 | 6 mins ago | IN | 0 ETH | 0.00000024 | ||||
Mint | 18299753 | 13 mins ago | IN | 0 ETH | 0.00000015 | ||||
New Mint Config | 18299745 | 13 mins ago | IN | 0 ETH | 0.00000024 | ||||
Mint | 18298973 | 39 mins ago | IN | 0 ETH | 0.00000018 | ||||
New Mint Config | 18298964 | 39 mins ago | IN | 0 ETH | 0.00000024 | ||||
Level Up | 18298109 | 1 hr ago | IN | 0 ETH | 0.00000013 | ||||
Batch Burn | 18297833 | 1 hr ago | IN | 0 ETH | 0.00000005 | ||||
Mint | 18297813 | 1 hr ago | IN | 0 ETH | 0.00000015 | ||||
New Mint Config | 18297805 | 1 hr ago | IN | 0 ETH | 0.00000036 | ||||
New Mint Config | 18297802 | 1 hr ago | IN | 0 ETH | 0.00000002 | ||||
Mint | 18297774 | 1 hr ago | IN | 0 ETH | 0.00000015 | ||||
New Mint Config | 18297764 | 1 hr ago | IN | 0 ETH | 0.00000024 | ||||
Batch Burn | 18297700 | 1 hr ago | IN | 0 ETH | 0.00000005 | ||||
Level Up | 18297689 | 1 hr ago | IN | 0 ETH | 0.00000013 | ||||
Mint | 18297686 | 1 hr ago | IN | 0 ETH | 0.00000015 | ||||
New Mint Config | 18297674 | 1 hr ago | IN | 0 ETH | 0.00000024 | ||||
Batch Burn | 18297666 | 1 hr ago | IN | 0 ETH | 0.00000005 | ||||
Mint | 18297652 | 1 hr ago | IN | 0 ETH | 0.00000015 | ||||
New Mint Config | 18297644 | 1 hr ago | IN | 0 ETH | 0.00000024 | ||||
New Mint Config | 18297584 | 1 hr ago | IN | 0 ETH | 0.00000024 | ||||
Mint | 18297550 | 1 hr ago | IN | 0 ETH | 0.00000015 | ||||
New Mint Config | 18297524 | 1 hr ago | IN | 0 ETH | 0.00000024 |
Loading...
Loading
Contract Name:
Minter
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 200 runs
Other Settings:
shanghai EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
/** ______ __ / ____/___ _____ / /_____ ________ __ / /_ / __ `/ __ \/ __/ __ `/ ___/ / / / / __/ / /_/ / / / / /_/ /_/ (__ ) /_/ / /_/ \__,_/_/ /_/\__/\__,_/____/\__, / /____/ **/ // SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import "@openzeppelin/contracts/access/extensions/AccessControlDefaultAdminRules.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "./VRGDA/LinearVRGDA.sol"; import "./interfaces/IBlast.sol"; import "./interfaces/IBlastPoints.sol"; import "./interfaces/IExecutionDelegate.sol"; import "./interfaces/IFantasyCards.sol"; import "./interfaces/IMinter.sol"; import {wadLn} from "solmate/utils/SignedWadMath.sol"; import {toTimeUnitWadUnsafe} from "./VRGDA/wadMath.sol"; /// @title A contract for minting Fantasy Cards NFTs using VRGDA pricing contract Minter is IMinter, AccessControlDefaultAdminRules, ReentrancyGuard, LinearVRGDA { /// @notice Configuration for a mint operation struct MintConfig { address collection; // The collection address of the NFT uint256 cardsPerPack; // Number of cards per pack uint256 maxPacks; // Total number of packs available for minting address paymentToken; // Token used for payments (address(0) for ETH) VRGDAConfig vrgdaConfig; // VRGDA configuration uint256 fixedPrice; // Setting this parameter to a positive non zero value will disable the VRGDA mechanism uint256 maxPacksPerAddress; // Maximum number of packs that can be minted by a single address bool requiresWhitelist; // If true, requires user to be whitelisted bytes32 merkleRoot; // Root of Merkle tree for whitelist verification uint256 startTimestamp; // Start time for the mint config uint256 expirationTimestamp; // Expiration timestamp for the mint config mapping(address => uint256) amountMintedPerAddress; // Tracks how many packs have been minted by each address uint256 totalMintedPacks; // Total number of packs minted bool cancelled; // If true, mint config has been cancelled } /// @notice Role hash for the address allowed to cancel mintConfigs bytes32 public constant MINT_CONFIG_MASTER = keccak256("MINT_CONFIG_MASTER"); /* Variables */ mapping(uint256 mintConfigId => MintConfig) public mintConfigs; mapping(address collection => bool) public whitelistedCollections; address public treasury; IExecutionDelegate public executionDelegate; uint256 public mintConfigIdCounter; uint256 public cardsRequiredForLevelUp; uint256 public cardsRequiredForBurnToDraw; uint256 public cardsDrawnPerBurn; modifier onlyEOA() { require(msg.sender == tx.origin, "Function can only be called by an EOA"); _; } /** * @dev Initializes the contract with treasury and execution delegate addresses. * @param _treasury Treasury address. * @param _executionDelegate Execution delegate address. */ constructor( address _treasury, address _executionDelegate, uint256 _cardsRequiredForLevelUp, uint256 _cardsRequiredForBurnToDraw, uint256 _cardsDrawnPerBurn ) AccessControlDefaultAdminRules(0, msg.sender) { IBlast(0x4300000000000000000000000000000000000002).configureClaimableGas(); IBlast(0x4300000000000000000000000000000000000002).configureGovernor(msg.sender); IBlastPoints(0x2536FE9ab3F511540F2f9e2eC2A805005C3Dd800).configurePointsOperator(msg.sender); _setTreasury(_treasury); _setExecutionDelegate(_executionDelegate); _setcardsRequiredForLevelUp(_cardsRequiredForLevelUp); _setcardsRequiredForBurnToDraw(_cardsRequiredForBurnToDraw); _setcardsDrawnPerBurn(_cardsDrawnPerBurn); } /** * @notice Mints packs based on the specified mint configuration * @dev Requires the mint configuration not to be cancelled, the user to be whitelisted (if applicable), and not to have minted before (if applicable). Transfers the payment and mints the NFTs. * @param configId ID of the mint configuration to use * @param merkleProof Proof for whitelist verification, if required * @param maxPrice Maximum price the user is willing to pay */ function mint( uint256 configId, bytes32[] calldata merkleProof, uint256 maxPrice ) public payable nonReentrant onlyEOA { _mint(configId, merkleProof, maxPrice, msg.sender); } /** * @notice Admin function to mint packs based on the specified mint configuration to multiple recipients * @dev Requires the mint configuration not to be cancelled, the user to be whitelisted (if applicable), and not to have minted before (if applicable). Transfers the payment and mints the NFTs. * @param configId ID of the mint configuration to use * @param merkleProofs Proofs for whitelist verifications, if required * @param maxPrice Maximum price the user is willing to pay * @param recipients Addresses to mint packs to */ function batchMintCardsTo(uint256 configId, bytes32[][] calldata merkleProofs, uint256 maxPrice, address[] calldata recipients) public payable nonReentrant onlyEOA onlyRole(MINT_CONFIG_MASTER) { require(merkleProofs.length == recipients.length, "merkleProofs length mismatch"); for (uint i = 0; i < recipients.length; i++) { _mint(configId, merkleProofs[i], maxPrice, recipients[i]); } } /** * @dev Internal function to mint packs based on the specified mint configuration to a single recipient. * @param configId ID of the mint configuration to use * @param merkleProof Proof for whitelist verification, if required * @param maxPrice Maximum price the user is willing to pay * @param recipient Address to mint packs to */ function _mint(uint256 configId, bytes32[] calldata merkleProof, uint256 maxPrice, address recipient) internal { MintConfig storage mintConfig = mintConfigs[configId]; require(mintConfig.startTimestamp <= block.timestamp, "Mint config not started"); require( mintConfig.expirationTimestamp == 0 || mintConfig.expirationTimestamp > block.timestamp, "Mint config expired" ); require(!mintConfig.cancelled, "Mint config cancelled"); require( !mintConfig.requiresWhitelist || _verifyWhitelist(mintConfig.merkleRoot, merkleProof, recipient), "User not whitelisted" ); require( mintConfig.maxPacksPerAddress == 0 || mintConfig.amountMintedPerAddress[recipient] < mintConfig.maxPacksPerAddress, "User reached max mint limit" ); require(mintConfig.maxPacks > mintConfig.totalMintedPacks, "No packs left"); // compute the price before incrementing the total packs minted since it will push the price up otherwise uint256 price = getPackPrice(configId); require(price <= maxPrice, "Price too high"); mintConfig.totalMintedPacks += 1; mintConfig.amountMintedPerAddress[recipient] += 1; _executeFundsTransfer(mintConfig.paymentToken, recipient, treasury, price); uint256 firstTokenId = IFantasyCards(mintConfig.collection).tokenCounter(); _executeBatchMint(mintConfig.collection, mintConfig.cardsPerPack, recipient); emit Mint( configId, recipient, mintConfig.totalMintedPacks, firstTokenId, firstTokenId + mintConfig.cardsPerPack - 1, price ); } /** * @notice Creates a new mint configuration * @dev Only callable by the contract owner. Emits a NewMintConfig event upon success. * @param collection Address of the NFT collection for the packs * @param cardsPerPack Number of cards in each pack * @param maxPacks Maximum number of packs available for this configuration * @param paymentToken Token used for payments (address(0) for ETH) * @param fixedPrice The amount of paymentToken payed by the user to mint * @param maxPacksPerAddress Maximum number of packs that can be minted by a single address * @param requiresWhitelist Require users to be whitelisted if true * @param merkleRoot Root of Merkle tree for whitelist verification * @param startTimestamp Timestamp before which the mintConfig is not usable, also used to determine pricing for VRGDA mintConfigs * @param expirationTimestamp Expiration timestamp for the mint config */ function newMintConfig( address collection, uint256 cardsPerPack, uint256 maxPacks, address paymentToken, uint256 fixedPrice, uint256 maxPacksPerAddress, bool requiresWhitelist, bytes32 merkleRoot, uint256 startTimestamp, uint256 expirationTimestamp ) public onlyRole(MINT_CONFIG_MASTER) { require(whitelistedCollections[collection], "Collection is not whitelisted"); require(collection != address(0), "Collection address cannot be 0x0"); require(cardsPerPack > 0, "Cards per pack must be greater than 0"); require(maxPacks > 0, "Max packs must be greater than 0"); require(startTimestamp >= block.timestamp, "Mint must start immediately or in the future"); require(expirationTimestamp == 0 || expirationTimestamp > startTimestamp, "invalid expirationTimestamp"); if (requiresWhitelist) { require(merkleRoot != 0, "missing merkleRoot"); } MintConfig storage config = mintConfigs[mintConfigIdCounter]; config.collection = collection; config.cardsPerPack = cardsPerPack; config.maxPacks = maxPacks; config.paymentToken = paymentToken; config.fixedPrice = fixedPrice; config.maxPacksPerAddress = maxPacksPerAddress; config.requiresWhitelist = requiresWhitelist; config.merkleRoot = merkleRoot; config.startTimestamp = startTimestamp; config.expirationTimestamp = expirationTimestamp; emit NewMintConfig( mintConfigIdCounter, collection, cardsPerPack, maxPacks, paymentToken, fixedPrice, maxPacksPerAddress, requiresWhitelist, merkleRoot, expirationTimestamp ); mintConfigIdCounter++; } /** * @notice Gets the current pack price based on the VRGDA contract * @dev The price will depend on the start time, target price and decay constant * @param configId ID of the mint configuration to use */ function getPackPrice(uint256 configId) public view returns (uint256) { MintConfig storage mintConfig = mintConfigs[configId]; require(!mintConfig.cancelled, "Mint config cancelled"); // If no VRGDA configuration is set, return the fixed price if (mintConfig.vrgdaConfig.targetPrice == 0) { return mintConfig.fixedPrice; } VRGDAConfig memory vrgdaConfig = mintConfig.vrgdaConfig; require((block.timestamp - mintConfig.startTimestamp) >= 0, "INVALID_TIMESTAMP"); unchecked { return getVRGDAPrice( toTimeUnitWadUnsafe(block.timestamp - mintConfig.startTimestamp, vrgdaConfig.secondsPerTimeUnit), mintConfig.totalMintedPacks, vrgdaConfig.targetPrice, vrgdaConfig.priceDecayPercent, vrgdaConfig.perTimeUnit ); } } /** * @notice Allows a user to upgrade their hero card to the next level of rarity by burning a specified number of cards of the same hero and rarity. * @dev Burns the specified amount of cards (tokens) of the same hero and rarity to mint a new card of that hero with increased rarity. The levelUp happens at the metadata level. if tokenIds are not of the same hero and rarity, or if the 5 cards are at the maximum rarity level (legendary), the newly minted card will not receive any metadata. * @param tokenIds An array of token IDs representing the cards to be burned. All cards must be of the same hero and the same rarity. * @param collection The address of the NFT collection from which the cards will be burned and the new card will be minted. */ function levelUp(uint256[] calldata tokenIds, address collection) public { require(whitelistedCollections[collection], "Collection is not whitelisted"); require(tokenIds.length == cardsRequiredForLevelUp, "wrong amount of cards to level up"); for (uint i = 0; i < cardsRequiredForLevelUp; i++) { require( IFantasyCards(collection).ownerOf(tokenIds[i]) == msg.sender, "caller does not own one of the tokens" ); executionDelegate.burnFantasyCard(address(collection), tokenIds[i], msg.sender); } uint256 mintedTokenId = IFantasyCards(collection).tokenCounter(); executionDelegate.mintFantasyCard(address(collection), msg.sender); emit LevelUp(tokenIds, mintedTokenId, collection, msg.sender); } /** * @notice Allows a user to burn their hero cards to draw new random cards. This function is provided for backward compatibility and convenience, although similar functionality can be achieved using * `batchBurnToDraw` with an array containing a single burn. * @dev Burns the specified amount of cards to draw new cards. The burnToDraw happens at the metadata level. Using this method directly might result in loss of cards if the cards do not meet the game rules. * @param tokenIds An array of token IDs representing the cards to be burned. * @param collection The address of the NFT collection from which the cards will be burned and the new card(s) will be minted. */ function burnToDraw(uint256[] calldata tokenIds, address collection) public { _burnToDraw(tokenIds, collection); } /** * @notice Allows a user to burn multiple sets of cards to draw new cards * @param tokenIds An array of token IDs arrays representing the cards to be burned. Each internal array represents a different burn. * @param collection The address of the NFT collection from which the cards will be burned and the new card(s) will be minted. */ function batchBurnToDraw(uint256[][] calldata tokenIds, address collection) public { for (uint i = 0; i < tokenIds.length; i++) { _burnToDraw(tokenIds[i], collection); } } /** * @dev Internal function to burn cards to draw new cards * @param tokenIds An array of token IDs representing the cards to be burned * @param collection The address of the NFT collection from which the cards will be burned and the new card(s) will be minted. */ function _burnToDraw(uint256[] calldata tokenIds, address collection) internal { require(whitelistedCollections[collection], "Collection is not whitelisted"); require(tokenIds.length == cardsRequiredForBurnToDraw, "wrong amount of cards to draw new cards"); for (uint i = 0; i < cardsRequiredForBurnToDraw; i++) { require( IFantasyCards(collection).ownerOf(tokenIds[i]) == msg.sender, "caller does not own one of the tokens" ); executionDelegate.burnFantasyCard(address(collection), tokenIds[i], msg.sender); } uint256[] memory drawnCardIds = new uint256[](cardsDrawnPerBurn); for (uint i = 0; i < cardsDrawnPerBurn; i++) { uint256 mintedTokenId = IFantasyCards(collection).tokenCounter(); executionDelegate.mintFantasyCard(address(collection), msg.sender); drawnCardIds[i] = mintedTokenId; } emit BurnToDraw(tokenIds, drawnCardIds, collection, msg.sender); } /** * @notice Burns multiple cards in a single transaction * @dev Iterates through the list of tokenIds and burns each one * @param collection The address of the collection from which the cards will be burned * @param tokenIds The array of tokenIds to be burned */ function batchBurn(address collection, uint256[] calldata tokenIds) public { require(tokenIds.length > 0, "no tokens to burn"); require(whitelistedCollections[collection], "Collection is not whitelisted"); // check that the caller owns all the tokens for (uint i = 0; i < tokenIds.length; i++) { require(IFantasyCards(collection).ownerOf(tokenIds[i]) == msg.sender, "caller does not own one of the tokens"); executionDelegate.burnFantasyCard(address(collection), tokenIds[i], msg.sender); } emit BatchBurn(tokenIds, collection, msg.sender); } /** * @notice Updates the NFT collection address for a specific mint configuration * @dev Only callable by the contract owner. * @param mintConfigId The ID of the mint configuration to update * @param collection The new collection address */ function setCollectionForMintConfig(uint256 mintConfigId, address collection) public onlyRole(MINT_CONFIG_MASTER) { require(whitelistedCollections[collection], "Collection is not whitelisted"); require(mintConfigId < mintConfigIdCounter, "Invalid mintConfigId"); require(collection != address(0), "Collection address cannot the zero address"); MintConfig storage config = mintConfigs[mintConfigId]; require(!config.cancelled, "Mint config cancelled"); config.collection = collection; emit CollectionUpdatedForMintConfig(mintConfigId, collection); } /** * @notice Updates the number of cards per pack for a specific mint configuration * @dev Only callable by the contract owner. * @param mintConfigId The ID of the mint configuration to update * @param cardsPerPack The new number of cards per pack */ function setCardsPerPackForMintConfig( uint256 mintConfigId, uint256 cardsPerPack ) public onlyRole(MINT_CONFIG_MASTER) { require(mintConfigId < mintConfigIdCounter, "Invalid mintConfigId"); require(cardsPerPack > 0, "Cards per pack must be greater than 0"); MintConfig storage config = mintConfigs[mintConfigId]; require(!config.cancelled, "Mint config cancelled"); config.cardsPerPack = cardsPerPack; emit CardsPerPackUpdatedForMintConfig(mintConfigId, cardsPerPack); } /** * @notice Updates the total number of packs for a specific mint configuration * @dev Only callable by the contract owner. * @param mintConfigId The ID of the mint configuration to update * @param maxPacks The maximum number of packs available */ function setMaxPacksForMintConfig(uint256 mintConfigId, uint256 maxPacks) public onlyRole(MINT_CONFIG_MASTER) { require(mintConfigId < mintConfigIdCounter, "Invalid mintConfigId"); require(maxPacks > 0, "Maximum packs must be greater than 0"); MintConfig storage config = mintConfigs[mintConfigId]; require(!config.cancelled, "Mint config cancelled"); config.maxPacks = maxPacks; emit MaxPacksUpdatedForMintConfig(mintConfigId, maxPacks); } /** * @notice Will set a fixed price for a specific mint configuration. If no fixed price was set before, it will also disable the VRGDA mechanism * @dev Only callable by the contract owner. * @param mintConfigId The ID of the mint configuration to update * @param fixedPrice A non zero positive value will disable the VRGDA mechanism and set a fixed price for the pack. This price input should be inputed with the correct token decimals coresponding to the payment token used in the mintconfig */ function setFixedPriceForMintConfig(uint256 mintConfigId, uint256 fixedPrice) public onlyRole(MINT_CONFIG_MASTER) { require(mintConfigId < mintConfigIdCounter, "Invalid mintConfigId"); MintConfig storage config = mintConfigs[mintConfigId]; require(!config.cancelled, "Mint config cancelled"); config.fixedPrice = fixedPrice; // Disable VRGDA mechanism if any config.vrgdaConfig.targetPrice = 0; emit FixedPriceUpdatedForMintConfig(mintConfigId, fixedPrice); } /** * @notice Updates the VRGDA config for a specific mint configuration, will require the mint config to not have an eth payment token (0 address) * @dev Only callable by the admin * @param mintConfigId The ID of the mint configuration to update * @param targetPrice The target price for a pack if sold on pace, scaled by the token decimals, e.g 1e18 for 1 ether, 1e6 for 1 usdc * @param priceDecayPercent The percent price decays per unit of time with no sales, scaled by 1e18, e.g 3e17 for 30% * @param perTimeUnit The targeted number of packs to sell in 1 full unit of time, scaled by 1e18, e.g 1e18 for 1 pack * @param secondsPerTimeUnit The total number of seconds in a time unit. 60 for a minute, 3600 for an hour, 86400 for a day. */ function setVRGDAForMintConfig( uint256 mintConfigId, int256 targetPrice, int256 priceDecayPercent, int256 perTimeUnit, int256 secondsPerTimeUnit ) public onlyRole(MINT_CONFIG_MASTER) { require(mintConfigId < mintConfigIdCounter, "Invalid mintConfigId"); require(targetPrice > 0, "Non zero target price"); require(secondsPerTimeUnit > 0, "Non zero seconds per time unit"); int256 decayConstant = wadLn(1e18 - priceDecayPercent); // The decay constant must be negative for VRGDAs to work. require(decayConstant < 0, "NON_NEGATIVE_DECAY_CONSTANT"); MintConfig storage config = mintConfigs[mintConfigId]; require(!config.cancelled, "Mint config cancelled"); require(config.paymentToken != address(0), "Payment token cannot be ETH"); VRGDAConfig memory newVrgdaConfig = VRGDAConfig({ targetPrice: targetPrice, priceDecayPercent: priceDecayPercent, perTimeUnit: perTimeUnit, secondsPerTimeUnit: secondsPerTimeUnit }); // update the VRGDA config config.vrgdaConfig = newVrgdaConfig; // set the fixed price to 0 config.fixedPrice = 0; emit VRGDAUpdatedForMintConfig(mintConfigId, targetPrice, priceDecayPercent, perTimeUnit); } /** * @notice Updates the one per address restriction for a specific mint configuration * @dev Only callable by the contract owner. * @param mintConfigId The ID of the mint configuration to update * @param maxPacksPerAddress The new maximum number of packs that can be minted by a single address */ function setMaxPacksPerAddressForMintConfig( uint256 mintConfigId, uint256 maxPacksPerAddress ) public onlyRole(MINT_CONFIG_MASTER) { require(mintConfigId < mintConfigIdCounter, "Invalid mintConfigId"); MintConfig storage config = mintConfigs[mintConfigId]; require(!config.cancelled, "Mint config cancelled"); config.maxPacksPerAddress = maxPacksPerAddress; emit MaxPacksPerAddressUpdatedForMintConfig(mintConfigId, maxPacksPerAddress); } /** * @notice Updates the whitelist requirement for a specific mint configuration * @dev Only callable by the contract owner. * @param mintConfigId The ID of the mint configuration to update * @param requiresWhitelist The new whitelist requirement state */ function setRequiresWhitelistForMintConfig( uint256 mintConfigId, bool requiresWhitelist ) public onlyRole(MINT_CONFIG_MASTER) { require(mintConfigId < mintConfigIdCounter, "Invalid mintConfigId"); MintConfig storage config = mintConfigs[mintConfigId]; require(!config.cancelled, "Mint config cancelled"); config.requiresWhitelist = requiresWhitelist; emit WhitelistRequirementUpdatedForMintConfig(mintConfigId, requiresWhitelist); } /** * @notice Updates the merkle root for whitelist verification for a specific mint configuration * @dev Only callable by the contract owner. * @param mintConfigId The ID of the mint configuration to update * @param merkleRoot The new merkle root for whitelist verification */ function setMerkleRootForMintConfig(uint256 mintConfigId, bytes32 merkleRoot) public onlyRole(MINT_CONFIG_MASTER) { require(mintConfigId < mintConfigIdCounter, "Invalid mintConfigId"); require(merkleRoot != bytes32(0), "Invalid merkleRoot"); MintConfig storage config = mintConfigs[mintConfigId]; require(!config.cancelled, "Mint config cancelled"); config.merkleRoot = merkleRoot; emit MerkleRootUpdatedForMintConfig(mintConfigId, merkleRoot); } /** * @notice Sets the expiration timestamp for a specific mint configuration, after which minting is no longer allowed. * @dev Only callable by the contract owner. Useful for time-limited minting opportunities. * @param mintConfigId The ID of the mint configuration to update. * @param expirationTimestamp The UNIX timestamp at which the minting configuration expires. */ function setExpirationTimestampForMintConfig( uint256 mintConfigId, uint256 expirationTimestamp ) public onlyRole(MINT_CONFIG_MASTER) { require(mintConfigId < mintConfigIdCounter, "Invalid mintConfigId"); MintConfig storage config = mintConfigs[mintConfigId]; require(!config.cancelled, "Mint config cancelled"); config.expirationTimestamp = expirationTimestamp; emit ExpirationTimestampUpdatedForMintConfig(mintConfigId, expirationTimestamp); } /** * @notice Cancels a specific mint configuration, preventing further minting * @param mintConfigId The ID of the mint configuration to cancel */ function cancelMintConfig(uint256 mintConfigId) public onlyRole(MINT_CONFIG_MASTER) { require(mintConfigId < mintConfigIdCounter, "Invalid mintConfigId"); MintConfig storage config = mintConfigs[mintConfigId]; config.cancelled = true; emit MintConfigCancelled(mintConfigId); } /** * @notice Updates the number of cards required for the level-up operation. * @dev Only callable by the contract owner. Adjusts how many cards must be burned to mint a new one in the level-up process. * @param _cardsRequiredForLevelUp The new number of cards required to perform a level-up. */ function setcardsRequiredForLevelUp(uint256 _cardsRequiredForLevelUp) public onlyRole(MINT_CONFIG_MASTER) { _setcardsRequiredForLevelUp(_cardsRequiredForLevelUp); } /** * @notice Updates the number of cards required for the burn to draw operation. * @dev Only callable by the contract owner. Adjusts how many cards must be burned to mint during the burn to draw process * @param _cardsRequiredForBurnToDraw The new number of cards required to perform a burn to draw. */ function setcardsRequiredForBurnToDraw(uint256 _cardsRequiredForBurnToDraw) public onlyRole(MINT_CONFIG_MASTER) { _setcardsRequiredForBurnToDraw(_cardsRequiredForBurnToDraw); } /** * @notice Updates the number of cards that will be minted during the burn to draw operation. * @dev Only callable by the contract owner. Adjusts how many cards will be minted during the burn to draw process * @param _cardsDrawnPerBurn The new number of cards minted during the burn to draw process */ function setcardsDrawnPerBurn(uint256 _cardsDrawnPerBurn) public onlyRole(MINT_CONFIG_MASTER) { _setcardsDrawnPerBurn(_cardsDrawnPerBurn); } /** * @notice Sets a new treasury address for collecting payments from minting operations. * @param _treasury The address of the new treasury. Must be a non-zero address. */ function setTreasury(address _treasury) public onlyRole(DEFAULT_ADMIN_ROLE) { _setTreasury(_treasury); } /** * @notice Updates the execution delegate address. * @param _executionDelegate New delegate address. */ function setExecutionDelegate(address _executionDelegate) public onlyRole(DEFAULT_ADMIN_ROLE) { _setExecutionDelegate(_executionDelegate); } /** * @dev Function to retrieve funds mistakenly sent to the mint contract. * @param paymentToken ERC20 token address, or zero for Ether. * @param to Recipient's address. * @param amount Transfer amount. */ function saveFunds(address paymentToken, address to, uint256 amount) public onlyRole(DEFAULT_ADMIN_ROLE) { if (paymentToken == address(0)) { payable(to).transfer(amount); } else { ERC20(paymentToken).transfer(to, amount); } } /** * @notice Whitelists a collection for levelUp or burnToDraw * @dev Only callable by the contract Admin. * @param _collection The address of the ERC-721 token collection to whitelist */ function whiteListCollection(address _collection) public onlyRole(DEFAULT_ADMIN_ROLE) { whitelistedCollections[_collection] = true; emit NewWhitelistedCollection(_collection); } /** * @notice Removes a collection from the whitelists for levelUp or burnToDraw * @dev Only callable by the contract Admin. * @param _collection The address of the ERC-721 token collection to remove from the whitelist */ function unWhiteListCollection(address _collection) public onlyRole(DEFAULT_ADMIN_ROLE) { whitelistedCollections[_collection] = false; emit UnWhitelistedCollection(_collection); } /** * @notice Retrieves details of a specific mint configuration * @param mintConfigId The ID of the mint configuration to retrieve * @return collection The NFT collection address * @return cardsPerPack The number of cards per pack * @return maxPacks The maximum number of packs available * @return paymentToken The token used for payments * @return fixedPrice The current fixed price for the packs. 0 if VRGDA is enabled * @return maxPacksPerAddress The maximum number of packs that can be minted by a single address * @return requiresWhitelist The whitelist requirement state * @return merkleRoot The merkle root for whitelist verification * @return startTimestamp The start timestamp for the mint configuration * @return expirationTimestamp The expiration timestamp for the mint configuration * @return totalMintedPacks The total number of packs minted * @return cancelled The cancellation state of the mint configuration */ function getMintConfig( uint256 mintConfigId ) public view returns (address, uint256, uint256, address, uint256, uint256, bool, bytes32, uint256, uint256, uint256, bool) { MintConfig storage config = mintConfigs[mintConfigId]; return ( config.collection, config.cardsPerPack, config.maxPacks, config.paymentToken, config.fixedPrice, config.maxPacksPerAddress, config.requiresWhitelist, config.merkleRoot, config.startTimestamp, config.expirationTimestamp, config.totalMintedPacks, config.cancelled ); } /** * @notice Checks if a user has already minted from a specific mint configuration * @param mintConfigId The ID of the mint configuration to check * @param user The address of the user to check * @return hasMinted Whether the user has already minted */ function getAmountMintedPerAddressForMintConfig(uint256 mintConfigId, address user) public view returns (uint256) { MintConfig storage config = mintConfigs[mintConfigId]; return config.amountMintedPerAddress[user]; } /** * @notice Returns the VRGDA configuration for a mint configuration. Reverts if fixed price is set * @param mintConfigId The ID of the mint configuration to check * @return vrgdaConfig The VRGDA configuration */ function getVRGDAConfig(uint256 mintConfigId) public view returns (VRGDAConfig memory) { MintConfig storage config = mintConfigs[mintConfigId]; require(config.fixedPrice == 0, "VRGDA not enabled"); return config.vrgdaConfig; } /** * @notice Internal function that sets a new treasury address for collecting payments from minting operations. * @param _treasury The address of the new treasury. Must be a non-zero address. */ function _setTreasury(address _treasury) internal { require(_treasury != address(0), "Treasury address cannot be 0x0"); treasury = _treasury; emit NewTreasury(_treasury); } /** * @notice Internal function that updates the execution delegate address. * @param _executionDelegate New delegate address. */ function _setExecutionDelegate(address _executionDelegate) internal { require(_executionDelegate != address(0), "Execution delegate address cannot be 0x0"); executionDelegate = IExecutionDelegate(_executionDelegate); emit NewExecutionDelegate(_executionDelegate); } /** * @notice Internal function that sets the number of cards required for a level up. * @param _cardsRequiredForLevelUp The number of cards required for a level up. */ function _setcardsRequiredForLevelUp(uint256 _cardsRequiredForLevelUp) internal { require(_cardsRequiredForLevelUp > 0, "cardsRequiredForLevelUp must be greater than 0"); cardsRequiredForLevelUp = _cardsRequiredForLevelUp; emit NewNumberOfCardsRequiredForLevelUp(_cardsRequiredForLevelUp); } /** * @notice Internal function that sets the number of cards required for a burn to draw * @param _cardsRequiredForBurnToDraw The number of cards required for a burn to draw */ function _setcardsRequiredForBurnToDraw(uint256 _cardsRequiredForBurnToDraw) internal { require(_cardsRequiredForBurnToDraw > 0, "cardsRequiredToBurnToDraw must be greater than 0"); cardsRequiredForBurnToDraw = _cardsRequiredForBurnToDraw; emit NewNumberOfCardsRequiredForBurnToDraw(_cardsRequiredForBurnToDraw); } /** * @notice Internal function that sets the number of cards that will be minted per burn * @param _cardsDrawnPerBurn The number of cards minted during a burn to draw operation */ function _setcardsDrawnPerBurn(uint256 _cardsDrawnPerBurn) internal { require(_cardsDrawnPerBurn > 0, "cardsDrawnPerBurn must be greater than 0"); cardsDrawnPerBurn = _cardsDrawnPerBurn; emit NewNumberOfCardsDrawnPerBurn(_cardsDrawnPerBurn); } /** * @dev Checks if user is whitelisted via Merkle proof. * @param merkleRoot Root of Merkle tree. * @param merkleProof Merkle proof for user. * @param user User's address to check. * @return isWhitelisted True if whitelisted, else false. */ function _verifyWhitelist( bytes32 merkleRoot, bytes32[] calldata merkleProof, address user ) internal pure returns (bool isWhitelisted) { bytes32 leaf = keccak256(abi.encodePacked(user)); return MerkleProof.verify(merkleProof, merkleRoot, leaf); } /** * @dev Transfers funds or Ether based on the payment type. * @param paymentToken Token contract address, or zero for Ether. * @param from Sender's address. * @param to Recipient's address. * @param amount Amount to transfer. */ function _executeFundsTransfer(address paymentToken, address from, address to, uint256 amount) internal { if (paymentToken == address(0)) { require(msg.value == amount, "Incorrect ETH amount"); } /* Transfer remainder to seller. */ _transferTo(paymentToken, from, to, amount); } /** * @dev Transfers Ether or ERC20 tokens from one address to another. * @param paymentToken ERC20 token address, or zero for Ether. * @param from Sender's address. * @param to Recipient's address. * @param amount Transfer amount. */ function _transferTo(address paymentToken, address from, address to, uint256 amount) internal { if (amount == 0) { return; } if (paymentToken == address(0)) { payable(to).transfer(amount); } else { executionDelegate.transferERC20(paymentToken, from, to, amount); } } /** * @dev Mints multiple cards to a buyer's address. * @param collection NFT collection address. * @param cardsPerPack Quantity of cards to mint. * @param buyer Recipient address. */ function _executeBatchMint(address collection, uint256 cardsPerPack, address buyer) internal { for (uint256 i = 0; i < cardsPerPack; i++) { executionDelegate.mintFantasyCard(collection, buyer); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.20; /** * @dev These functions deal with verification of Merkle Tree proofs. * * The tree and the proofs can be generated using our * https://github.com/OpenZeppelin/merkle-tree[JavaScript library]. * You will find a quickstart guide in the readme. * * WARNING: You should avoid using leaf values that are 64 bytes long prior to * hashing, or use a hash function other than keccak256 for hashing leaves. * This is because the concatenation of a sorted pair of internal nodes in * the Merkle tree could be reinterpreted as a leaf value. * OpenZeppelin's JavaScript library generates Merkle trees that are safe * against this attack out of the box. */ library MerkleProof { /** *@dev The multiproof provided is not valid. */ error MerkleProofInvalidMultiproof(); /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) { return processProof(proof, leaf) == root; } /** * @dev Calldata version of {verify} */ function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool) { return processProofCalldata(proof, leaf) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leafs & pre-images are assumed to be sorted. */ function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Calldata version of {processProof} */ function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}. * * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details. */ function multiProofVerify( bytes32[] memory proof, bool[] memory proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProof(proof, proofFlags, leaves) == root; } /** * @dev Calldata version of {multiProofVerify} * * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details. */ function multiProofVerifyCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProofCalldata(proof, proofFlags, leaves) == root; } /** * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false * respectively. * * CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer). */ function processMultiProof( bytes32[] memory proof, bool[] memory proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the Merkle tree. uint256 leavesLen = leaves.length; uint256 proofLen = proof.length; uint256 totalHashes = proofFlags.length; // Check proof validity. if (leavesLen + proofLen != totalHashes + 1) { revert MerkleProofInvalidMultiproof(); } // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]) : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { if (proofPos != proofLen) { revert MerkleProofInvalidMultiproof(); } unchecked { return hashes[totalHashes - 1]; } } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Calldata version of {processMultiProof}. * * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details. */ function processMultiProofCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the Merkle tree. uint256 leavesLen = leaves.length; uint256 proofLen = proof.length; uint256 totalHashes = proofFlags.length; // Check proof validity. if (leavesLen + proofLen != totalHashes + 1) { revert MerkleProofInvalidMultiproof(); } // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]) : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { if (proofPos != proofLen) { revert MerkleProofInvalidMultiproof(); } unchecked { return hashes[totalHashes - 1]; } } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Sorts the pair (a, b) and hashes the result. */ function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) { return a < b ? _efficientHash(a, b) : _efficientHash(b, a); } /** * @dev Implementation of keccak256(abi.encode(a, b)) that doesn't allocate or expand memory. */ function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) { /// @solidity memory-safe-assembly assembly { mstore(0x00, a) mstore(0x20, b) value := keccak256(0x00, 0x40) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlDefaultAdminRules.sol) pragma solidity ^0.8.20; import {IAccessControlDefaultAdminRules} from "./IAccessControlDefaultAdminRules.sol"; import {AccessControl, IAccessControl} from "../AccessControl.sol"; import {SafeCast} from "../../utils/math/SafeCast.sol"; import {Math} from "../../utils/math/Math.sol"; import {IERC5313} from "../../interfaces/IERC5313.sol"; /** * @dev Extension of {AccessControl} that allows specifying special rules to manage * the `DEFAULT_ADMIN_ROLE` holder, which is a sensitive role with special permissions * over other roles that may potentially have privileged rights in the system. * * If a specific role doesn't have an admin role assigned, the holder of the * `DEFAULT_ADMIN_ROLE` will have the ability to grant it and revoke it. * * This contract implements the following risk mitigations on top of {AccessControl}: * * * Only one account holds the `DEFAULT_ADMIN_ROLE` since deployment until it's potentially renounced. * * Enforces a 2-step process to transfer the `DEFAULT_ADMIN_ROLE` to another account. * * Enforces a configurable delay between the two steps, with the ability to cancel before the transfer is accepted. * * The delay can be changed by scheduling, see {changeDefaultAdminDelay}. * * It is not possible to use another role to manage the `DEFAULT_ADMIN_ROLE`. * * Example usage: * * ```solidity * contract MyToken is AccessControlDefaultAdminRules { * constructor() AccessControlDefaultAdminRules( * 3 days, * msg.sender // Explicit initial `DEFAULT_ADMIN_ROLE` holder * ) {} * } * ``` */ abstract contract AccessControlDefaultAdminRules is IAccessControlDefaultAdminRules, IERC5313, AccessControl { // pending admin pair read/written together frequently address private _pendingDefaultAdmin; uint48 private _pendingDefaultAdminSchedule; // 0 == unset uint48 private _currentDelay; address private _currentDefaultAdmin; // pending delay pair read/written together frequently uint48 private _pendingDelay; uint48 private _pendingDelaySchedule; // 0 == unset /** * @dev Sets the initial values for {defaultAdminDelay} and {defaultAdmin} address. */ constructor(uint48 initialDelay, address initialDefaultAdmin) { if (initialDefaultAdmin == address(0)) { revert AccessControlInvalidDefaultAdmin(address(0)); } _currentDelay = initialDelay; _grantRole(DEFAULT_ADMIN_ROLE, initialDefaultAdmin); } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlDefaultAdminRules).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC5313-owner}. */ function owner() public view virtual returns (address) { return defaultAdmin(); } /// /// Override AccessControl role management /// /** * @dev See {AccessControl-grantRole}. Reverts for `DEFAULT_ADMIN_ROLE`. */ function grantRole(bytes32 role, address account) public virtual override(AccessControl, IAccessControl) { if (role == DEFAULT_ADMIN_ROLE) { revert AccessControlEnforcedDefaultAdminRules(); } super.grantRole(role, account); } /** * @dev See {AccessControl-revokeRole}. Reverts for `DEFAULT_ADMIN_ROLE`. */ function revokeRole(bytes32 role, address account) public virtual override(AccessControl, IAccessControl) { if (role == DEFAULT_ADMIN_ROLE) { revert AccessControlEnforcedDefaultAdminRules(); } super.revokeRole(role, account); } /** * @dev See {AccessControl-renounceRole}. * * For the `DEFAULT_ADMIN_ROLE`, it only allows renouncing in two steps by first calling * {beginDefaultAdminTransfer} to the `address(0)`, so it's required that the {pendingDefaultAdmin} schedule * has also passed when calling this function. * * After its execution, it will not be possible to call `onlyRole(DEFAULT_ADMIN_ROLE)` functions. * * NOTE: Renouncing `DEFAULT_ADMIN_ROLE` will leave the contract without a {defaultAdmin}, * thereby disabling any functionality that is only available for it, and the possibility of reassigning a * non-administrated role. */ function renounceRole(bytes32 role, address account) public virtual override(AccessControl, IAccessControl) { if (role == DEFAULT_ADMIN_ROLE && account == defaultAdmin()) { (address newDefaultAdmin, uint48 schedule) = pendingDefaultAdmin(); if (newDefaultAdmin != address(0) || !_isScheduleSet(schedule) || !_hasSchedulePassed(schedule)) { revert AccessControlEnforcedDefaultAdminDelay(schedule); } delete _pendingDefaultAdminSchedule; } super.renounceRole(role, account); } /** * @dev See {AccessControl-_grantRole}. * * For `DEFAULT_ADMIN_ROLE`, it only allows granting if there isn't already a {defaultAdmin} or if the * role has been previously renounced. * * NOTE: Exposing this function through another mechanism may make the `DEFAULT_ADMIN_ROLE` * assignable again. Make sure to guarantee this is the expected behavior in your implementation. */ function _grantRole(bytes32 role, address account) internal virtual override returns (bool) { if (role == DEFAULT_ADMIN_ROLE) { if (defaultAdmin() != address(0)) { revert AccessControlEnforcedDefaultAdminRules(); } _currentDefaultAdmin = account; } return super._grantRole(role, account); } /** * @dev See {AccessControl-_revokeRole}. */ function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) { if (role == DEFAULT_ADMIN_ROLE && account == defaultAdmin()) { delete _currentDefaultAdmin; } return super._revokeRole(role, account); } /** * @dev See {AccessControl-_setRoleAdmin}. Reverts for `DEFAULT_ADMIN_ROLE`. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual override { if (role == DEFAULT_ADMIN_ROLE) { revert AccessControlEnforcedDefaultAdminRules(); } super._setRoleAdmin(role, adminRole); } /// /// AccessControlDefaultAdminRules accessors /// /** * @inheritdoc IAccessControlDefaultAdminRules */ function defaultAdmin() public view virtual returns (address) { return _currentDefaultAdmin; } /** * @inheritdoc IAccessControlDefaultAdminRules */ function pendingDefaultAdmin() public view virtual returns (address newAdmin, uint48 schedule) { return (_pendingDefaultAdmin, _pendingDefaultAdminSchedule); } /** * @inheritdoc IAccessControlDefaultAdminRules */ function defaultAdminDelay() public view virtual returns (uint48) { uint48 schedule = _pendingDelaySchedule; return (_isScheduleSet(schedule) && _hasSchedulePassed(schedule)) ? _pendingDelay : _currentDelay; } /** * @inheritdoc IAccessControlDefaultAdminRules */ function pendingDefaultAdminDelay() public view virtual returns (uint48 newDelay, uint48 schedule) { schedule = _pendingDelaySchedule; return (_isScheduleSet(schedule) && !_hasSchedulePassed(schedule)) ? (_pendingDelay, schedule) : (0, 0); } /** * @inheritdoc IAccessControlDefaultAdminRules */ function defaultAdminDelayIncreaseWait() public view virtual returns (uint48) { return 5 days; } /// /// AccessControlDefaultAdminRules public and internal setters for defaultAdmin/pendingDefaultAdmin /// /** * @inheritdoc IAccessControlDefaultAdminRules */ function beginDefaultAdminTransfer(address newAdmin) public virtual onlyRole(DEFAULT_ADMIN_ROLE) { _beginDefaultAdminTransfer(newAdmin); } /** * @dev See {beginDefaultAdminTransfer}. * * Internal function without access restriction. */ function _beginDefaultAdminTransfer(address newAdmin) internal virtual { uint48 newSchedule = SafeCast.toUint48(block.timestamp) + defaultAdminDelay(); _setPendingDefaultAdmin(newAdmin, newSchedule); emit DefaultAdminTransferScheduled(newAdmin, newSchedule); } /** * @inheritdoc IAccessControlDefaultAdminRules */ function cancelDefaultAdminTransfer() public virtual onlyRole(DEFAULT_ADMIN_ROLE) { _cancelDefaultAdminTransfer(); } /** * @dev See {cancelDefaultAdminTransfer}. * * Internal function without access restriction. */ function _cancelDefaultAdminTransfer() internal virtual { _setPendingDefaultAdmin(address(0), 0); } /** * @inheritdoc IAccessControlDefaultAdminRules */ function acceptDefaultAdminTransfer() public virtual { (address newDefaultAdmin, ) = pendingDefaultAdmin(); if (_msgSender() != newDefaultAdmin) { // Enforce newDefaultAdmin explicit acceptance. revert AccessControlInvalidDefaultAdmin(_msgSender()); } _acceptDefaultAdminTransfer(); } /** * @dev See {acceptDefaultAdminTransfer}. * * Internal function without access restriction. */ function _acceptDefaultAdminTransfer() internal virtual { (address newAdmin, uint48 schedule) = pendingDefaultAdmin(); if (!_isScheduleSet(schedule) || !_hasSchedulePassed(schedule)) { revert AccessControlEnforcedDefaultAdminDelay(schedule); } _revokeRole(DEFAULT_ADMIN_ROLE, defaultAdmin()); _grantRole(DEFAULT_ADMIN_ROLE, newAdmin); delete _pendingDefaultAdmin; delete _pendingDefaultAdminSchedule; } /// /// AccessControlDefaultAdminRules public and internal setters for defaultAdminDelay/pendingDefaultAdminDelay /// /** * @inheritdoc IAccessControlDefaultAdminRules */ function changeDefaultAdminDelay(uint48 newDelay) public virtual onlyRole(DEFAULT_ADMIN_ROLE) { _changeDefaultAdminDelay(newDelay); } /** * @dev See {changeDefaultAdminDelay}. * * Internal function without access restriction. */ function _changeDefaultAdminDelay(uint48 newDelay) internal virtual { uint48 newSchedule = SafeCast.toUint48(block.timestamp) + _delayChangeWait(newDelay); _setPendingDelay(newDelay, newSchedule); emit DefaultAdminDelayChangeScheduled(newDelay, newSchedule); } /** * @inheritdoc IAccessControlDefaultAdminRules */ function rollbackDefaultAdminDelay() public virtual onlyRole(DEFAULT_ADMIN_ROLE) { _rollbackDefaultAdminDelay(); } /** * @dev See {rollbackDefaultAdminDelay}. * * Internal function without access restriction. */ function _rollbackDefaultAdminDelay() internal virtual { _setPendingDelay(0, 0); } /** * @dev Returns the amount of seconds to wait after the `newDelay` will * become the new {defaultAdminDelay}. * * The value returned guarantees that if the delay is reduced, it will go into effect * after a wait that honors the previously set delay. * * See {defaultAdminDelayIncreaseWait}. */ function _delayChangeWait(uint48 newDelay) internal view virtual returns (uint48) { uint48 currentDelay = defaultAdminDelay(); // When increasing the delay, we schedule the delay change to occur after a period of "new delay" has passed, up // to a maximum given by defaultAdminDelayIncreaseWait, by default 5 days. For example, if increasing from 1 day // to 3 days, the new delay will come into effect after 3 days. If increasing from 1 day to 10 days, the new // delay will come into effect after 5 days. The 5 day wait period is intended to be able to fix an error like // using milliseconds instead of seconds. // // When decreasing the delay, we wait the difference between "current delay" and "new delay". This guarantees // that an admin transfer cannot be made faster than "current delay" at the time the delay change is scheduled. // For example, if decreasing from 10 days to 3 days, the new delay will come into effect after 7 days. return newDelay > currentDelay ? uint48(Math.min(newDelay, defaultAdminDelayIncreaseWait())) // no need to safecast, both inputs are uint48 : currentDelay - newDelay; } /// /// Private setters /// /** * @dev Setter of the tuple for pending admin and its schedule. * * May emit a DefaultAdminTransferCanceled event. */ function _setPendingDefaultAdmin(address newAdmin, uint48 newSchedule) private { (, uint48 oldSchedule) = pendingDefaultAdmin(); _pendingDefaultAdmin = newAdmin; _pendingDefaultAdminSchedule = newSchedule; // An `oldSchedule` from `pendingDefaultAdmin()` is only set if it hasn't been accepted. if (_isScheduleSet(oldSchedule)) { // Emit for implicit cancellations when another default admin was scheduled. emit DefaultAdminTransferCanceled(); } } /** * @dev Setter of the tuple for pending delay and its schedule. * * May emit a DefaultAdminDelayChangeCanceled event. */ function _setPendingDelay(uint48 newDelay, uint48 newSchedule) private { uint48 oldSchedule = _pendingDelaySchedule; if (_isScheduleSet(oldSchedule)) { if (_hasSchedulePassed(oldSchedule)) { // Materialize a virtual delay _currentDelay = _pendingDelay; } else { // Emit for implicit cancellations when another delay was scheduled. emit DefaultAdminDelayChangeCanceled(); } } _pendingDelay = newDelay; _pendingDelaySchedule = newSchedule; } /// /// Private helpers /// /** * @dev Defines if an `schedule` is considered set. For consistency purposes. */ function _isScheduleSet(uint48 schedule) private pure returns (bool) { return schedule != 0; } /** * @dev Defines if an `schedule` is considered passed. For consistency purposes. */ function _hasSchedulePassed(uint48 schedule) private view returns (bool) { return schedule < block.timestamp; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol) pragma solidity ^0.8.20; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant NOT_ENTERED = 1; uint256 private constant ENTERED = 2; uint256 private _status; /** * @dev Unauthorized reentrant call. */ error ReentrancyGuardReentrantCall(); constructor() { _status = NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be NOT_ENTERED if (_status == ENTERED) { revert ReentrancyGuardReentrantCall(); } // Any calls to nonReentrant after this point will fail _status = ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "./IERC20.sol"; import {IERC20Metadata} from "./extensions/IERC20Metadata.sol"; import {Context} from "../../utils/Context.sol"; import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * The default value of {decimals} is 18. To change this, you should override * this function so it returns a different value. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. */ abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors { mapping(address account => uint256) private _balances; mapping(address account => mapping(address spender => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the default value returned by this function, unless * it's overridden. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `value`. */ function transfer(address to, uint256 value) public virtual returns (bool) { address owner = _msgSender(); _transfer(owner, to, value); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 value) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, value); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `value`. * - the caller must have allowance for ``from``'s tokens of at least * `value`. */ function transferFrom(address from, address to, uint256 value) public virtual returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, value); _transfer(from, to, value); return true; } /** * @dev Moves a `value` amount of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _transfer(address from, address to, uint256 value) internal { if (from == address(0)) { revert ERC20InvalidSender(address(0)); } if (to == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(from, to, value); } /** * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from` * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding * this function. * * Emits a {Transfer} event. */ function _update(address from, address to, uint256 value) internal virtual { if (from == address(0)) { // Overflow check required: The rest of the code assumes that totalSupply never overflows _totalSupply += value; } else { uint256 fromBalance = _balances[from]; if (fromBalance < value) { revert ERC20InsufficientBalance(from, fromBalance, value); } unchecked { // Overflow not possible: value <= fromBalance <= totalSupply. _balances[from] = fromBalance - value; } } if (to == address(0)) { unchecked { // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply. _totalSupply -= value; } } else { unchecked { // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256. _balances[to] += value; } } emit Transfer(from, to, value); } /** * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0). * Relies on the `_update` mechanism * * Emits a {Transfer} event with `from` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _mint(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(address(0), account, value); } /** * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply. * Relies on the `_update` mechanism. * * Emits a {Transfer} event with `to` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead */ function _burn(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidSender(address(0)); } _update(account, address(0), value); } /** * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. * * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument. */ function _approve(address owner, address spender, uint256 value) internal { _approve(owner, spender, value, true); } /** * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event. * * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any * `Approval` event during `transferFrom` operations. * * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to * true using the following override: * ``` * function _approve(address owner, address spender, uint256 value, bool) internal virtual override { * super._approve(owner, spender, value, true); * } * ``` * * Requirements are the same as {_approve}. */ function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual { if (owner == address(0)) { revert ERC20InvalidApprover(address(0)); } if (spender == address(0)) { revert ERC20InvalidSpender(address(0)); } _allowances[owner][spender] = value; if (emitEvent) { emit Approval(owner, spender, value); } } /** * @dev Updates `owner` s allowance for `spender` based on spent `value`. * * Does not update the allowance value in case of infinite allowance. * Revert if not enough allowance is available. * * Does not emit an {Approval} event. */ function _spendAllowance(address owner, address spender, uint256 value) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { if (currentAllowance < value) { revert ERC20InsufficientAllowance(spender, currentAllowance, value); } unchecked { _approve(owner, spender, currentAllowance - value, false); } } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import {unsafeWadDiv} from "solmate/utils/SignedWadMath.sol"; import {VRGDA} from "./VRGDA.sol"; /// @title Modifed Linear Variable Rate Gradual Dutch Auction /// @author transmissions11 <[email protected]> /// @author FrankieIsLost <[email protected]> /// @author Fantasy Labs <[email protected]> /// @notice Modified code for the Fantasy Minter. VRGDA with a linear issuance curve. abstract contract LinearVRGDA is VRGDA { /*////////////////////////////////////////////////////////////// PRICING LOGIC //////////////////////////////////////////////////////////////*/ /// @dev Given a number of tokens sold, return the target time that number of tokens should be sold by. /// @param sold A number of tokens sold, scaled by 1e18, to get the corresponding target sale time for. /// @param perTimeUnit The targeted number of sells in 1 full unit of time, scaled by 1e18, e.g 1e18 for 1 sell. If the unit of time is a day, this means the target is to sell 1 token every day. /// @return The target time the tokens should be sold by, scaled by 1e18, where the time is /// relative, such that 0 means the tokens should be sold immediately when the VRGDA begins. function getTargetSaleTime(int256 sold, int256 perTimeUnit) public view virtual override returns (int256) { return unsafeWadDiv(sold, perTimeUnit); } }
pragma solidity ^0.8.20; enum YieldMode { AUTOMATIC, VOID, CLAIMABLE } enum GasMode { VOID, CLAIMABLE } interface IBlast { // configure function configureContract(address contractAddress, YieldMode _yield, GasMode gasMode, address governor) external; function configure(YieldMode _yield, GasMode gasMode, address governor) external; // base configuration options function configureClaimableYield() external; function configureClaimableYieldOnBehalf(address contractAddress) external; function configureAutomaticYield() external; function configureAutomaticYieldOnBehalf(address contractAddress) external; function configureVoidYield() external; function configureVoidYieldOnBehalf(address contractAddress) external; function configureClaimableGas() external; function configureClaimableGasOnBehalf(address contractAddress) external; function configureVoidGas() external; function configureVoidGasOnBehalf(address contractAddress) external; function configureGovernor(address _governor) external; function configureGovernorOnBehalf(address _newGovernor, address contractAddress) external; // claim yield function claimYield(address contractAddress, address recipientOfYield, uint256 amount) external returns (uint256); function claimAllYield(address contractAddress, address recipientOfYield) external returns (uint256); // claim gas function claimAllGas(address contractAddress, address recipientOfGas) external returns (uint256); function claimGasAtMinClaimRate( address contractAddress, address recipientOfGas, uint256 minClaimRateBips ) external returns (uint256); function claimMaxGas(address contractAddress, address recipientOfGas) external returns (uint256); function claimGas( address contractAddress, address recipientOfGas, uint256 gasToClaim, uint256 gasSecondsToConsume ) external returns (uint256); // read functions function readClaimableYield(address contractAddress) external view returns (uint256); function readYieldConfiguration(address contractAddress) external view returns (uint8); function readGasParams( address contractAddress ) external view returns (uint256 etherSeconds, uint256 etherBalance, uint256 lastUpdated, GasMode); function governorMap(address input) external view returns (address); }
pragma solidity ^0.8.20; interface IBlastPoints { function configurePointsOperator(address operator) external; function configurePointsOperatorOnBehalf(address contractAddress, address operator) external; function operators(address input) external view returns (address); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.20; interface IExecutionDelegate { event ApproveContract(address _contract); event DenyContract(address _contract); event RevokeApproval(address user); event GrantApproval(address user); function approveContract(address _contract) external; function denyContract(address _contract) external; function revokeApproval() external; function grantApproval() external; function mintFantasyCard(address collection, address to) external; function burnFantasyCard(address collection, uint256 tokenId, address from) external; function transferERC721Unsafe(address collection, address from, address to, uint256 tokenId) external; function transferERC721(address collection, address from, address to, uint256 tokenId) external; function transferERC1155(address collection, address from, address to, uint256 tokenId, uint256 amount) external; function transferERC20(address token, address from, address to, uint256 amount) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol"; import "@openzeppelin/contracts/interfaces/draft-IERC6093.sol"; interface IFantasyCards is IERC721, IERC721Metadata, IERC721Errors { function safeMint(address to) external; function setBaseURI(string calldata _baseURI) external; function burn(uint256 tokenId) external; function tokenCounter() external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; interface IMinter { /// @notice Configuration for the vrgda calculation struct VRGDAConfig { int256 targetPrice; // Target price for a pack scaled by the decimals of the payment token. int256 priceDecayPercent; // Percent price decays per unit of time with no sales, scaled by 1e18. int256 perTimeUnit; // The total number of packs to target selling every full unit of time scaled by 1e18. int256 secondsPerTimeUnit; // The total number of seconds in a time unit. 60 for a minute, 3600 for an hour, 86400 for a day. } // Events event NewMintConfig( uint256 mintConfigId, address collection, uint256 cardsPerPack, uint256 maxPacks, address paymentToken, uint256 fixedPrice, uint256 maxPacksPerAddress, bool requiresWhitelist, bytes32 merkleRoot, uint256 expirationTimestamp ); event Mint( uint256 mintConfigId, address buyer, uint256 totalMintedPacks, uint256 firstTokenId, uint256 lastTokenId, uint256 price ); event LevelUp(uint256[] burntTokenIds, uint256 mintedTokenId, address collection, address caller); event BurnToDraw(uint256[] burntTokenIds, uint256[] mintedTokenIds, address collection, address caller); event BatchBurn(uint256[] burntTokenIds, address collection, address caller); event NewTreasury(address treasury); event NewExecutionDelegate(address _executionDelegate); event CollectionUpdatedForMintConfig(uint256 mintConfigId, address newCollection); event CardsPerPackUpdatedForMintConfig(uint256 mintConfigId, uint256 newCardsPerPack); event MaxPacksUpdatedForMintConfig(uint256 mintConfigId, uint256 newMaxPacks); event PaymentTokenUpdatedForMintConfig(uint256 mintConfigId, address newPaymentToken); event FixedPriceUpdatedForMintConfig(uint256 mintConfigId, uint256 newFixedPrice); event VRGDAUpdatedForMintConfig( uint256 mintConfigId, int256 targetPrice, int256 priceDecayPercent, int256 perTimeUnit ); event MaxPacksPerAddressUpdatedForMintConfig(uint256 mintConfigId, uint256 maxPacksPerAddress); event WhitelistRequirementUpdatedForMintConfig(uint256 mintConfigId, bool newRequiresWhitelist); event MerkleRootUpdatedForMintConfig(uint256 mintConfigId, bytes32 newMerkleRoot); event MintConfigCancelled(uint256 mintConfigId); event NewNumberOfCardsRequiredForLevelUp(uint256 _cardsRequiredForLevelUp); event NewNumberOfCardsRequiredForBurnToDraw(uint256 _cardsRequiredForBurnToDraw); event NewNumberOfCardsDrawnPerBurn(uint256 _cardsDrawnPerBurn); event ExpirationTimestampUpdatedForMintConfig(uint256 mintConfigId, uint256 newExpirationTimestamp); event NewWhitelistedCollection(address collection); event UnWhitelistedCollection(address collection); // Functions function mint(uint256 configId, bytes32[] calldata merkleProof, uint256 maxPrice) external payable; function newMintConfig( address collection, uint256 cardsPerPack, uint256 maxPacks, address paymentToken, uint256 fixedPrice, uint256 maxPacksPerAddress, bool requiresWhitelist, bytes32 merkleRoot, uint256 startTimestamp, uint256 expirationTimestamp ) external; function levelUp(uint256[] calldata tokenIds, address collection) external; function setCollectionForMintConfig(uint256 mintConfigId, address collection) external; function setCardsPerPackForMintConfig(uint256 mintConfigId, uint256 cardsPerPack) external; function setMaxPacksForMintConfig(uint256 mintConfigId, uint256 maxPacks) external; function setFixedPriceForMintConfig(uint256 mintConfigId, uint256 fixedPrice) external; function setVRGDAForMintConfig( uint256 mintConfigId, int256 targetPrice, int256 priceDecayPercent, int256 perTimeUnit, int256 secondsPerTimeUnit ) external; function setMaxPacksPerAddressForMintConfig(uint256 mintConfigId, uint256 maxPacksPerAddress) external; function setRequiresWhitelistForMintConfig(uint256 mintConfigId, bool requiresWhitelist) external; function setMerkleRootForMintConfig(uint256 mintConfigId, bytes32 merkleRoot) external; function cancelMintConfig(uint256 mintConfigId) external; function setTreasury(address _treasury) external; function setExecutionDelegate(address _executionDelegate) external; // View functions to get config details might be included based on the requirement function getMintConfig( uint256 mintConfigId ) external view returns ( address collection, uint256 cardsPerPack, uint256 maxPacks, address paymentToken, uint256 fixedPrice, uint256 maxPacksPerAddress, bool requiresWhitelist, bytes32 merkleRoot, uint256 startTimestamp, uint256 expirationTimestamp, uint256 totalMintedPacks, bool cancelled ); function getAmountMintedPerAddressForMintConfig(uint256 mintConfigId, address user) external view returns (uint256); function saveFunds(address paymentToken, address to, uint256 amount) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; /// @notice Signed 18 decimal fixed point (wad) arithmetic library. /// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SignedWadMath.sol) /// @author Modified from Remco Bloemen (https://xn--2-umb.com/22/exp-ln/index.html) /// @dev Will not revert on overflow, only use where overflow is not possible. function toWadUnsafe(uint256 x) pure returns (int256 r) { /// @solidity memory-safe-assembly assembly { // Multiply x by 1e18. r := mul(x, 1000000000000000000) } } /// @dev Takes an integer amount of seconds and converts it to a wad amount of days. /// @dev Will not revert on overflow, only use where overflow is not possible. /// @dev Not meant for negative second amounts, it assumes x is positive. function toDaysWadUnsafe(uint256 x) pure returns (int256 r) { /// @solidity memory-safe-assembly assembly { // Multiply x by 1e18 and then divide it by 86400. r := div(mul(x, 1000000000000000000), 86400) } } /// @dev Takes a wad amount of days and converts it to an integer amount of seconds. /// @dev Will not revert on overflow, only use where overflow is not possible. /// @dev Not meant for negative day amounts, it assumes x is positive. function fromDaysWadUnsafe(int256 x) pure returns (uint256 r) { /// @solidity memory-safe-assembly assembly { // Multiply x by 86400 and then divide it by 1e18. r := div(mul(x, 86400), 1000000000000000000) } } /// @dev Will not revert on overflow, only use where overflow is not possible. function unsafeWadMul(int256 x, int256 y) pure returns (int256 r) { /// @solidity memory-safe-assembly assembly { // Multiply x by y and divide by 1e18. r := sdiv(mul(x, y), 1000000000000000000) } } /// @dev Will return 0 instead of reverting if y is zero and will /// not revert on overflow, only use where overflow is not possible. function unsafeWadDiv(int256 x, int256 y) pure returns (int256 r) { /// @solidity memory-safe-assembly assembly { // Multiply x by 1e18 and divide it by y. r := sdiv(mul(x, 1000000000000000000), y) } } function wadMul(int256 x, int256 y) pure returns (int256 r) { /// @solidity memory-safe-assembly assembly { // Store x * y in r for now. r := mul(x, y) // Equivalent to require(x == 0 || (x * y) / x == y) if iszero(or(iszero(x), eq(sdiv(r, x), y))) { revert(0, 0) } // Scale the result down by 1e18. r := sdiv(r, 1000000000000000000) } } function wadDiv(int256 x, int256 y) pure returns (int256 r) { /// @solidity memory-safe-assembly assembly { // Store x * 1e18 in r for now. r := mul(x, 1000000000000000000) // Equivalent to require(y != 0 && ((x * 1e18) / 1e18 == x)) if iszero(and(iszero(iszero(y)), eq(sdiv(r, 1000000000000000000), x))) { revert(0, 0) } // Divide r by y. r := sdiv(r, y) } } function wadExp(int256 x) pure returns (int256 r) { unchecked { // When the result is < 0.5 we return zero. This happens when // x <= floor(log(0.5e18) * 1e18) ~ -42e18 if (x <= -42139678854452767551) return 0; // When the result is > (2**255 - 1) / 1e18 we can not represent it as an // int. This happens when x >= floor(log((2**255 - 1) / 1e18) * 1e18) ~ 135. if (x >= 135305999368893231589) revert("EXP_OVERFLOW"); // x is now in the range (-42, 136) * 1e18. Convert to (-42, 136) * 2**96 // for more intermediate precision and a binary basis. This base conversion // is a multiplication by 1e18 / 2**96 = 5**18 / 2**78. x = (x << 78) / 5**18; // Reduce range of x to (-½ ln 2, ½ ln 2) * 2**96 by factoring out powers // of two such that exp(x) = exp(x') * 2**k, where k is an integer. // Solving this gives k = round(x / log(2)) and x' = x - k * log(2). int256 k = ((x << 96) / 54916777467707473351141471128 + 2**95) >> 96; x = x - k * 54916777467707473351141471128; // k is in the range [-61, 195]. // Evaluate using a (6, 7)-term rational approximation. // p is made monic, we'll multiply by a scale factor later. int256 y = x + 1346386616545796478920950773328; y = ((y * x) >> 96) + 57155421227552351082224309758442; int256 p = y + x - 94201549194550492254356042504812; p = ((p * y) >> 96) + 28719021644029726153956944680412240; p = p * x + (4385272521454847904659076985693276 << 96); // We leave p in 2**192 basis so we don't need to scale it back up for the division. int256 q = x - 2855989394907223263936484059900; q = ((q * x) >> 96) + 50020603652535783019961831881945; q = ((q * x) >> 96) - 533845033583426703283633433725380; q = ((q * x) >> 96) + 3604857256930695427073651918091429; q = ((q * x) >> 96) - 14423608567350463180887372962807573; q = ((q * x) >> 96) + 26449188498355588339934803723976023; /// @solidity memory-safe-assembly assembly { // Div in assembly because solidity adds a zero check despite the unchecked. // The q polynomial won't have zeros in the domain as all its roots are complex. // No scaling is necessary because p is already 2**96 too large. r := sdiv(p, q) } // r should be in the range (0.09, 0.25) * 2**96. // We now need to multiply r by: // * the scale factor s = ~6.031367120. // * the 2**k factor from the range reduction. // * the 1e18 / 2**96 factor for base conversion. // We do this all at once, with an intermediate result in 2**213 // basis, so the final right shift is always by a positive amount. r = int256((uint256(r) * 3822833074963236453042738258902158003155416615667) >> uint256(195 - k)); } } function wadLn(int256 x) pure returns (int256 r) { unchecked { require(x > 0, "UNDEFINED"); // We want to convert x from 10**18 fixed point to 2**96 fixed point. // We do this by multiplying by 2**96 / 10**18. But since // ln(x * C) = ln(x) + ln(C), we can simply do nothing here // and add ln(2**96 / 10**18) at the end. /// @solidity memory-safe-assembly assembly { r := shl(7, lt(0xffffffffffffffffffffffffffffffff, x)) r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x)))) r := or(r, shl(5, lt(0xffffffff, shr(r, x)))) r := or(r, shl(4, lt(0xffff, shr(r, x)))) r := or(r, shl(3, lt(0xff, shr(r, x)))) r := or(r, shl(2, lt(0xf, shr(r, x)))) r := or(r, shl(1, lt(0x3, shr(r, x)))) r := or(r, lt(0x1, shr(r, x))) } // Reduce range of x to (1, 2) * 2**96 // ln(2^k * x) = k * ln(2) + ln(x) int256 k = r - 96; x <<= uint256(159 - k); x = int256(uint256(x) >> 159); // Evaluate using a (8, 8)-term rational approximation. // p is made monic, we will multiply by a scale factor later. int256 p = x + 3273285459638523848632254066296; p = ((p * x) >> 96) + 24828157081833163892658089445524; p = ((p * x) >> 96) + 43456485725739037958740375743393; p = ((p * x) >> 96) - 11111509109440967052023855526967; p = ((p * x) >> 96) - 45023709667254063763336534515857; p = ((p * x) >> 96) - 14706773417378608786704636184526; p = p * x - (795164235651350426258249787498 << 96); // We leave p in 2**192 basis so we don't need to scale it back up for the division. // q is monic by convention. int256 q = x + 5573035233440673466300451813936; q = ((q * x) >> 96) + 71694874799317883764090561454958; q = ((q * x) >> 96) + 283447036172924575727196451306956; q = ((q * x) >> 96) + 401686690394027663651624208769553; q = ((q * x) >> 96) + 204048457590392012362485061816622; q = ((q * x) >> 96) + 31853899698501571402653359427138; q = ((q * x) >> 96) + 909429971244387300277376558375; /// @solidity memory-safe-assembly assembly { // Div in assembly because solidity adds a zero check despite the unchecked. // The q polynomial is known not to have zeros in the domain. // No scaling required because p is already 2**96 too large. r := sdiv(p, q) } // r is in the range (0, 0.125) * 2**96 // Finalization, we need to: // * multiply by the scale factor s = 5.549… // * add ln(2**96 / 10**18) // * add k * ln(2) // * multiply by 10**18 / 2**96 = 5**18 >> 78 // mul s * 5e18 * 2**96, base is now 5**18 * 2**192 r *= 1677202110996718588342820967067443963516166; // add ln(2) * k * 5e18 * 2**192 r += 16597577552685614221487285958193947469193820559219878177908093499208371 * k; // add ln(2**96 / 10**18) * 5e18 * 2**192 r += 600920179829731861736702779321621459595472258049074101567377883020018308; // base conversion: mul 2**18 / 2**192 r >>= 174; } } /// @dev Will return 0 instead of reverting if y is zero. function unsafeDiv(int256 x, int256 y) pure returns (int256 r) { /// @solidity memory-safe-assembly assembly { // Divide x by y. r := sdiv(x, y) } }
pragma solidity ^0.8.20; /// @dev Takes an integer amount of seconds and converts it to a wad amount of time unit. /// @dev Will not revert on overflow, only use where overflow is not possible. /// @dev Not meant for negative second amounts, it assumes x is positive. function toTimeUnitWadUnsafe(uint256 x, int256 secondsPerTimeUnit) pure returns (int256 r) { /// @solidity memory-safe-assembly assembly { // Multiply x by 1e18 and then divide it by the number of seconds in the time unit. r := div(mul(x, 1000000000000000000), secondsPerTimeUnit) } } /// @dev Takes a wad amount of time unit and converts it to an integer amount of seconds. /// @dev Will not revert on overflow, only use where overflow is not possible. /// @dev Not meant for negative day amounts, it assumes x is positive. function fromTimeUnitWadUnsafe(int256 x, int256 secondsPerTimeUnit) pure returns (uint256 r) { /// @solidity memory-safe-assembly assembly { // Multiply x by the number of seconds in a time unit and then divide it by 1e18. r := div(mul(x, secondsPerTimeUnit), 1000000000000000000) } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlDefaultAdminRules.sol) pragma solidity ^0.8.20; import {IAccessControl} from "../IAccessControl.sol"; /** * @dev External interface of AccessControlDefaultAdminRules declared to support ERC165 detection. */ interface IAccessControlDefaultAdminRules is IAccessControl { /** * @dev The new default admin is not a valid default admin. */ error AccessControlInvalidDefaultAdmin(address defaultAdmin); /** * @dev At least one of the following rules was violated: * * - The `DEFAULT_ADMIN_ROLE` must only be managed by itself. * - The `DEFAULT_ADMIN_ROLE` must only be held by one account at the time. * - Any `DEFAULT_ADMIN_ROLE` transfer must be in two delayed steps. */ error AccessControlEnforcedDefaultAdminRules(); /** * @dev The delay for transferring the default admin delay is enforced and * the operation must wait until `schedule`. * * NOTE: `schedule` can be 0 indicating there's no transfer scheduled. */ error AccessControlEnforcedDefaultAdminDelay(uint48 schedule); /** * @dev Emitted when a {defaultAdmin} transfer is started, setting `newAdmin` as the next * address to become the {defaultAdmin} by calling {acceptDefaultAdminTransfer} only after `acceptSchedule` * passes. */ event DefaultAdminTransferScheduled(address indexed newAdmin, uint48 acceptSchedule); /** * @dev Emitted when a {pendingDefaultAdmin} is reset if it was never accepted, regardless of its schedule. */ event DefaultAdminTransferCanceled(); /** * @dev Emitted when a {defaultAdminDelay} change is started, setting `newDelay` as the next * delay to be applied between default admin transfer after `effectSchedule` has passed. */ event DefaultAdminDelayChangeScheduled(uint48 newDelay, uint48 effectSchedule); /** * @dev Emitted when a {pendingDefaultAdminDelay} is reset if its schedule didn't pass. */ event DefaultAdminDelayChangeCanceled(); /** * @dev Returns the address of the current `DEFAULT_ADMIN_ROLE` holder. */ function defaultAdmin() external view returns (address); /** * @dev Returns a tuple of a `newAdmin` and an accept schedule. * * After the `schedule` passes, the `newAdmin` will be able to accept the {defaultAdmin} role * by calling {acceptDefaultAdminTransfer}, completing the role transfer. * * A zero value only in `acceptSchedule` indicates no pending admin transfer. * * NOTE: A zero address `newAdmin` means that {defaultAdmin} is being renounced. */ function pendingDefaultAdmin() external view returns (address newAdmin, uint48 acceptSchedule); /** * @dev Returns the delay required to schedule the acceptance of a {defaultAdmin} transfer started. * * This delay will be added to the current timestamp when calling {beginDefaultAdminTransfer} to set * the acceptance schedule. * * NOTE: If a delay change has been scheduled, it will take effect as soon as the schedule passes, making this * function returns the new delay. See {changeDefaultAdminDelay}. */ function defaultAdminDelay() external view returns (uint48); /** * @dev Returns a tuple of `newDelay` and an effect schedule. * * After the `schedule` passes, the `newDelay` will get into effect immediately for every * new {defaultAdmin} transfer started with {beginDefaultAdminTransfer}. * * A zero value only in `effectSchedule` indicates no pending delay change. * * NOTE: A zero value only for `newDelay` means that the next {defaultAdminDelay} * will be zero after the effect schedule. */ function pendingDefaultAdminDelay() external view returns (uint48 newDelay, uint48 effectSchedule); /** * @dev Starts a {defaultAdmin} transfer by setting a {pendingDefaultAdmin} scheduled for acceptance * after the current timestamp plus a {defaultAdminDelay}. * * Requirements: * * - Only can be called by the current {defaultAdmin}. * * Emits a DefaultAdminRoleChangeStarted event. */ function beginDefaultAdminTransfer(address newAdmin) external; /** * @dev Cancels a {defaultAdmin} transfer previously started with {beginDefaultAdminTransfer}. * * A {pendingDefaultAdmin} not yet accepted can also be cancelled with this function. * * Requirements: * * - Only can be called by the current {defaultAdmin}. * * May emit a DefaultAdminTransferCanceled event. */ function cancelDefaultAdminTransfer() external; /** * @dev Completes a {defaultAdmin} transfer previously started with {beginDefaultAdminTransfer}. * * After calling the function: * * - `DEFAULT_ADMIN_ROLE` should be granted to the caller. * - `DEFAULT_ADMIN_ROLE` should be revoked from the previous holder. * - {pendingDefaultAdmin} should be reset to zero values. * * Requirements: * * - Only can be called by the {pendingDefaultAdmin}'s `newAdmin`. * - The {pendingDefaultAdmin}'s `acceptSchedule` should've passed. */ function acceptDefaultAdminTransfer() external; /** * @dev Initiates a {defaultAdminDelay} update by setting a {pendingDefaultAdminDelay} scheduled for getting * into effect after the current timestamp plus a {defaultAdminDelay}. * * This function guarantees that any call to {beginDefaultAdminTransfer} done between the timestamp this * method is called and the {pendingDefaultAdminDelay} effect schedule will use the current {defaultAdminDelay} * set before calling. * * The {pendingDefaultAdminDelay}'s effect schedule is defined in a way that waiting until the schedule and then * calling {beginDefaultAdminTransfer} with the new delay will take at least the same as another {defaultAdmin} * complete transfer (including acceptance). * * The schedule is designed for two scenarios: * * - When the delay is changed for a larger one the schedule is `block.timestamp + newDelay` capped by * {defaultAdminDelayIncreaseWait}. * - When the delay is changed for a shorter one, the schedule is `block.timestamp + (current delay - new delay)`. * * A {pendingDefaultAdminDelay} that never got into effect will be canceled in favor of a new scheduled change. * * Requirements: * * - Only can be called by the current {defaultAdmin}. * * Emits a DefaultAdminDelayChangeScheduled event and may emit a DefaultAdminDelayChangeCanceled event. */ function changeDefaultAdminDelay(uint48 newDelay) external; /** * @dev Cancels a scheduled {defaultAdminDelay} change. * * Requirements: * * - Only can be called by the current {defaultAdmin}. * * May emit a DefaultAdminDelayChangeCanceled event. */ function rollbackDefaultAdminDelay() external; /** * @dev Maximum time in seconds for an increase to {defaultAdminDelay} (that is scheduled using {changeDefaultAdminDelay}) * to take effect. Default to 5 days. * * When the {defaultAdminDelay} is scheduled to be increased, it goes into effect after the new delay has passed with * the purpose of giving enough time for reverting any accidental change (i.e. using milliseconds instead of seconds) * that may lock the contract. However, to avoid excessive schedules, the wait is capped by this function and it can * be overrode for a custom {defaultAdminDelay} increase scheduling. * * IMPORTANT: Make sure to add a reasonable amount of time while overriding this value, otherwise, * there's a risk of setting a high new delay that goes into effect almost immediately without the * possibility of human intervention in the case of an input error (eg. set milliseconds instead of seconds). */ function defaultAdminDelayIncreaseWait() external view returns (uint48); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol) pragma solidity ^0.8.20; import {IAccessControl} from "./IAccessControl.sol"; import {Context} from "../utils/Context.sol"; import {ERC165} from "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ```solidity * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ```solidity * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules} * to enforce additional security measures for this role. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address account => bool) hasRole; bytes32 adminRole; } mapping(bytes32 role => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with an {AccessControlUnauthorizedAccount} error including the required role. */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual returns (bool) { return _roles[role].hasRole[account]; } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()` * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier. */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account` * is missing `role`. */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert AccessControlUnauthorizedAccount(account, role); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `callerConfirmation`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address callerConfirmation) public virtual { if (callerConfirmation != _msgSender()) { revert AccessControlBadConfirmation(); } _revokeRole(role, callerConfirmation); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual returns (bool) { if (!hasRole(role, account)) { _roles[role].hasRole[account] = true; emit RoleGranted(role, account, _msgSender()); return true; } else { return false; } } /** * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual returns (bool) { if (hasRole(role, account)) { _roles[role].hasRole[account] = false; emit RoleRevoked(role, account, _msgSender()); return true; } else { return false; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SafeCast.sol) // This file was procedurally generated from scripts/generate/templates/SafeCast.js. pragma solidity ^0.8.20; /** * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow * checks. * * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can * easily result in undesired exploitation or bugs, since developers usually * assume that overflows raise errors. `SafeCast` restores this intuition by * reverting the transaction when such an operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeCast { /** * @dev Value doesn't fit in an uint of `bits` size. */ error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value); /** * @dev An int value doesn't fit in an uint of `bits` size. */ error SafeCastOverflowedIntToUint(int256 value); /** * @dev Value doesn't fit in an int of `bits` size. */ error SafeCastOverflowedIntDowncast(uint8 bits, int256 value); /** * @dev An uint value doesn't fit in an int of `bits` size. */ error SafeCastOverflowedUintToInt(uint256 value); /** * @dev Returns the downcasted uint248 from uint256, reverting on * overflow (when the input is greater than largest uint248). * * Counterpart to Solidity's `uint248` operator. * * Requirements: * * - input must fit into 248 bits */ function toUint248(uint256 value) internal pure returns (uint248) { if (value > type(uint248).max) { revert SafeCastOverflowedUintDowncast(248, value); } return uint248(value); } /** * @dev Returns the downcasted uint240 from uint256, reverting on * overflow (when the input is greater than largest uint240). * * Counterpart to Solidity's `uint240` operator. * * Requirements: * * - input must fit into 240 bits */ function toUint240(uint256 value) internal pure returns (uint240) { if (value > type(uint240).max) { revert SafeCastOverflowedUintDowncast(240, value); } return uint240(value); } /** * @dev Returns the downcasted uint232 from uint256, reverting on * overflow (when the input is greater than largest uint232). * * Counterpart to Solidity's `uint232` operator. * * Requirements: * * - input must fit into 232 bits */ function toUint232(uint256 value) internal pure returns (uint232) { if (value > type(uint232).max) { revert SafeCastOverflowedUintDowncast(232, value); } return uint232(value); } /** * @dev Returns the downcasted uint224 from uint256, reverting on * overflow (when the input is greater than largest uint224). * * Counterpart to Solidity's `uint224` operator. * * Requirements: * * - input must fit into 224 bits */ function toUint224(uint256 value) internal pure returns (uint224) { if (value > type(uint224).max) { revert SafeCastOverflowedUintDowncast(224, value); } return uint224(value); } /** * @dev Returns the downcasted uint216 from uint256, reverting on * overflow (when the input is greater than largest uint216). * * Counterpart to Solidity's `uint216` operator. * * Requirements: * * - input must fit into 216 bits */ function toUint216(uint256 value) internal pure returns (uint216) { if (value > type(uint216).max) { revert SafeCastOverflowedUintDowncast(216, value); } return uint216(value); } /** * @dev Returns the downcasted uint208 from uint256, reverting on * overflow (when the input is greater than largest uint208). * * Counterpart to Solidity's `uint208` operator. * * Requirements: * * - input must fit into 208 bits */ function toUint208(uint256 value) internal pure returns (uint208) { if (value > type(uint208).max) { revert SafeCastOverflowedUintDowncast(208, value); } return uint208(value); } /** * @dev Returns the downcasted uint200 from uint256, reverting on * overflow (when the input is greater than largest uint200). * * Counterpart to Solidity's `uint200` operator. * * Requirements: * * - input must fit into 200 bits */ function toUint200(uint256 value) internal pure returns (uint200) { if (value > type(uint200).max) { revert SafeCastOverflowedUintDowncast(200, value); } return uint200(value); } /** * @dev Returns the downcasted uint192 from uint256, reverting on * overflow (when the input is greater than largest uint192). * * Counterpart to Solidity's `uint192` operator. * * Requirements: * * - input must fit into 192 bits */ function toUint192(uint256 value) internal pure returns (uint192) { if (value > type(uint192).max) { revert SafeCastOverflowedUintDowncast(192, value); } return uint192(value); } /** * @dev Returns the downcasted uint184 from uint256, reverting on * overflow (when the input is greater than largest uint184). * * Counterpart to Solidity's `uint184` operator. * * Requirements: * * - input must fit into 184 bits */ function toUint184(uint256 value) internal pure returns (uint184) { if (value > type(uint184).max) { revert SafeCastOverflowedUintDowncast(184, value); } return uint184(value); } /** * @dev Returns the downcasted uint176 from uint256, reverting on * overflow (when the input is greater than largest uint176). * * Counterpart to Solidity's `uint176` operator. * * Requirements: * * - input must fit into 176 bits */ function toUint176(uint256 value) internal pure returns (uint176) { if (value > type(uint176).max) { revert SafeCastOverflowedUintDowncast(176, value); } return uint176(value); } /** * @dev Returns the downcasted uint168 from uint256, reverting on * overflow (when the input is greater than largest uint168). * * Counterpart to Solidity's `uint168` operator. * * Requirements: * * - input must fit into 168 bits */ function toUint168(uint256 value) internal pure returns (uint168) { if (value > type(uint168).max) { revert SafeCastOverflowedUintDowncast(168, value); } return uint168(value); } /** * @dev Returns the downcasted uint160 from uint256, reverting on * overflow (when the input is greater than largest uint160). * * Counterpart to Solidity's `uint160` operator. * * Requirements: * * - input must fit into 160 bits */ function toUint160(uint256 value) internal pure returns (uint160) { if (value > type(uint160).max) { revert SafeCastOverflowedUintDowncast(160, value); } return uint160(value); } /** * @dev Returns the downcasted uint152 from uint256, reverting on * overflow (when the input is greater than largest uint152). * * Counterpart to Solidity's `uint152` operator. * * Requirements: * * - input must fit into 152 bits */ function toUint152(uint256 value) internal pure returns (uint152) { if (value > type(uint152).max) { revert SafeCastOverflowedUintDowncast(152, value); } return uint152(value); } /** * @dev Returns the downcasted uint144 from uint256, reverting on * overflow (when the input is greater than largest uint144). * * Counterpart to Solidity's `uint144` operator. * * Requirements: * * - input must fit into 144 bits */ function toUint144(uint256 value) internal pure returns (uint144) { if (value > type(uint144).max) { revert SafeCastOverflowedUintDowncast(144, value); } return uint144(value); } /** * @dev Returns the downcasted uint136 from uint256, reverting on * overflow (when the input is greater than largest uint136). * * Counterpart to Solidity's `uint136` operator. * * Requirements: * * - input must fit into 136 bits */ function toUint136(uint256 value) internal pure returns (uint136) { if (value > type(uint136).max) { revert SafeCastOverflowedUintDowncast(136, value); } return uint136(value); } /** * @dev Returns the downcasted uint128 from uint256, reverting on * overflow (when the input is greater than largest uint128). * * Counterpart to Solidity's `uint128` operator. * * Requirements: * * - input must fit into 128 bits */ function toUint128(uint256 value) internal pure returns (uint128) { if (value > type(uint128).max) { revert SafeCastOverflowedUintDowncast(128, value); } return uint128(value); } /** * @dev Returns the downcasted uint120 from uint256, reverting on * overflow (when the input is greater than largest uint120). * * Counterpart to Solidity's `uint120` operator. * * Requirements: * * - input must fit into 120 bits */ function toUint120(uint256 value) internal pure returns (uint120) { if (value > type(uint120).max) { revert SafeCastOverflowedUintDowncast(120, value); } return uint120(value); } /** * @dev Returns the downcasted uint112 from uint256, reverting on * overflow (when the input is greater than largest uint112). * * Counterpart to Solidity's `uint112` operator. * * Requirements: * * - input must fit into 112 bits */ function toUint112(uint256 value) internal pure returns (uint112) { if (value > type(uint112).max) { revert SafeCastOverflowedUintDowncast(112, value); } return uint112(value); } /** * @dev Returns the downcasted uint104 from uint256, reverting on * overflow (when the input is greater than largest uint104). * * Counterpart to Solidity's `uint104` operator. * * Requirements: * * - input must fit into 104 bits */ function toUint104(uint256 value) internal pure returns (uint104) { if (value > type(uint104).max) { revert SafeCastOverflowedUintDowncast(104, value); } return uint104(value); } /** * @dev Returns the downcasted uint96 from uint256, reverting on * overflow (when the input is greater than largest uint96). * * Counterpart to Solidity's `uint96` operator. * * Requirements: * * - input must fit into 96 bits */ function toUint96(uint256 value) internal pure returns (uint96) { if (value > type(uint96).max) { revert SafeCastOverflowedUintDowncast(96, value); } return uint96(value); } /** * @dev Returns the downcasted uint88 from uint256, reverting on * overflow (when the input is greater than largest uint88). * * Counterpart to Solidity's `uint88` operator. * * Requirements: * * - input must fit into 88 bits */ function toUint88(uint256 value) internal pure returns (uint88) { if (value > type(uint88).max) { revert SafeCastOverflowedUintDowncast(88, value); } return uint88(value); } /** * @dev Returns the downcasted uint80 from uint256, reverting on * overflow (when the input is greater than largest uint80). * * Counterpart to Solidity's `uint80` operator. * * Requirements: * * - input must fit into 80 bits */ function toUint80(uint256 value) internal pure returns (uint80) { if (value > type(uint80).max) { revert SafeCastOverflowedUintDowncast(80, value); } return uint80(value); } /** * @dev Returns the downcasted uint72 from uint256, reverting on * overflow (when the input is greater than largest uint72). * * Counterpart to Solidity's `uint72` operator. * * Requirements: * * - input must fit into 72 bits */ function toUint72(uint256 value) internal pure returns (uint72) { if (value > type(uint72).max) { revert SafeCastOverflowedUintDowncast(72, value); } return uint72(value); } /** * @dev Returns the downcasted uint64 from uint256, reverting on * overflow (when the input is greater than largest uint64). * * Counterpart to Solidity's `uint64` operator. * * Requirements: * * - input must fit into 64 bits */ function toUint64(uint256 value) internal pure returns (uint64) { if (value > type(uint64).max) { revert SafeCastOverflowedUintDowncast(64, value); } return uint64(value); } /** * @dev Returns the downcasted uint56 from uint256, reverting on * overflow (when the input is greater than largest uint56). * * Counterpart to Solidity's `uint56` operator. * * Requirements: * * - input must fit into 56 bits */ function toUint56(uint256 value) internal pure returns (uint56) { if (value > type(uint56).max) { revert SafeCastOverflowedUintDowncast(56, value); } return uint56(value); } /** * @dev Returns the downcasted uint48 from uint256, reverting on * overflow (when the input is greater than largest uint48). * * Counterpart to Solidity's `uint48` operator. * * Requirements: * * - input must fit into 48 bits */ function toUint48(uint256 value) internal pure returns (uint48) { if (value > type(uint48).max) { revert SafeCastOverflowedUintDowncast(48, value); } return uint48(value); } /** * @dev Returns the downcasted uint40 from uint256, reverting on * overflow (when the input is greater than largest uint40). * * Counterpart to Solidity's `uint40` operator. * * Requirements: * * - input must fit into 40 bits */ function toUint40(uint256 value) internal pure returns (uint40) { if (value > type(uint40).max) { revert SafeCastOverflowedUintDowncast(40, value); } return uint40(value); } /** * @dev Returns the downcasted uint32 from uint256, reverting on * overflow (when the input is greater than largest uint32). * * Counterpart to Solidity's `uint32` operator. * * Requirements: * * - input must fit into 32 bits */ function toUint32(uint256 value) internal pure returns (uint32) { if (value > type(uint32).max) { revert SafeCastOverflowedUintDowncast(32, value); } return uint32(value); } /** * @dev Returns the downcasted uint24 from uint256, reverting on * overflow (when the input is greater than largest uint24). * * Counterpart to Solidity's `uint24` operator. * * Requirements: * * - input must fit into 24 bits */ function toUint24(uint256 value) internal pure returns (uint24) { if (value > type(uint24).max) { revert SafeCastOverflowedUintDowncast(24, value); } return uint24(value); } /** * @dev Returns the downcasted uint16 from uint256, reverting on * overflow (when the input is greater than largest uint16). * * Counterpart to Solidity's `uint16` operator. * * Requirements: * * - input must fit into 16 bits */ function toUint16(uint256 value) internal pure returns (uint16) { if (value > type(uint16).max) { revert SafeCastOverflowedUintDowncast(16, value); } return uint16(value); } /** * @dev Returns the downcasted uint8 from uint256, reverting on * overflow (when the input is greater than largest uint8). * * Counterpart to Solidity's `uint8` operator. * * Requirements: * * - input must fit into 8 bits */ function toUint8(uint256 value) internal pure returns (uint8) { if (value > type(uint8).max) { revert SafeCastOverflowedUintDowncast(8, value); } return uint8(value); } /** * @dev Converts a signed int256 into an unsigned uint256. * * Requirements: * * - input must be greater than or equal to 0. */ function toUint256(int256 value) internal pure returns (uint256) { if (value < 0) { revert SafeCastOverflowedIntToUint(value); } return uint256(value); } /** * @dev Returns the downcasted int248 from int256, reverting on * overflow (when the input is less than smallest int248 or * greater than largest int248). * * Counterpart to Solidity's `int248` operator. * * Requirements: * * - input must fit into 248 bits */ function toInt248(int256 value) internal pure returns (int248 downcasted) { downcasted = int248(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(248, value); } } /** * @dev Returns the downcasted int240 from int256, reverting on * overflow (when the input is less than smallest int240 or * greater than largest int240). * * Counterpart to Solidity's `int240` operator. * * Requirements: * * - input must fit into 240 bits */ function toInt240(int256 value) internal pure returns (int240 downcasted) { downcasted = int240(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(240, value); } } /** * @dev Returns the downcasted int232 from int256, reverting on * overflow (when the input is less than smallest int232 or * greater than largest int232). * * Counterpart to Solidity's `int232` operator. * * Requirements: * * - input must fit into 232 bits */ function toInt232(int256 value) internal pure returns (int232 downcasted) { downcasted = int232(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(232, value); } } /** * @dev Returns the downcasted int224 from int256, reverting on * overflow (when the input is less than smallest int224 or * greater than largest int224). * * Counterpart to Solidity's `int224` operator. * * Requirements: * * - input must fit into 224 bits */ function toInt224(int256 value) internal pure returns (int224 downcasted) { downcasted = int224(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(224, value); } } /** * @dev Returns the downcasted int216 from int256, reverting on * overflow (when the input is less than smallest int216 or * greater than largest int216). * * Counterpart to Solidity's `int216` operator. * * Requirements: * * - input must fit into 216 bits */ function toInt216(int256 value) internal pure returns (int216 downcasted) { downcasted = int216(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(216, value); } } /** * @dev Returns the downcasted int208 from int256, reverting on * overflow (when the input is less than smallest int208 or * greater than largest int208). * * Counterpart to Solidity's `int208` operator. * * Requirements: * * - input must fit into 208 bits */ function toInt208(int256 value) internal pure returns (int208 downcasted) { downcasted = int208(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(208, value); } } /** * @dev Returns the downcasted int200 from int256, reverting on * overflow (when the input is less than smallest int200 or * greater than largest int200). * * Counterpart to Solidity's `int200` operator. * * Requirements: * * - input must fit into 200 bits */ function toInt200(int256 value) internal pure returns (int200 downcasted) { downcasted = int200(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(200, value); } } /** * @dev Returns the downcasted int192 from int256, reverting on * overflow (when the input is less than smallest int192 or * greater than largest int192). * * Counterpart to Solidity's `int192` operator. * * Requirements: * * - input must fit into 192 bits */ function toInt192(int256 value) internal pure returns (int192 downcasted) { downcasted = int192(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(192, value); } } /** * @dev Returns the downcasted int184 from int256, reverting on * overflow (when the input is less than smallest int184 or * greater than largest int184). * * Counterpart to Solidity's `int184` operator. * * Requirements: * * - input must fit into 184 bits */ function toInt184(int256 value) internal pure returns (int184 downcasted) { downcasted = int184(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(184, value); } } /** * @dev Returns the downcasted int176 from int256, reverting on * overflow (when the input is less than smallest int176 or * greater than largest int176). * * Counterpart to Solidity's `int176` operator. * * Requirements: * * - input must fit into 176 bits */ function toInt176(int256 value) internal pure returns (int176 downcasted) { downcasted = int176(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(176, value); } } /** * @dev Returns the downcasted int168 from int256, reverting on * overflow (when the input is less than smallest int168 or * greater than largest int168). * * Counterpart to Solidity's `int168` operator. * * Requirements: * * - input must fit into 168 bits */ function toInt168(int256 value) internal pure returns (int168 downcasted) { downcasted = int168(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(168, value); } } /** * @dev Returns the downcasted int160 from int256, reverting on * overflow (when the input is less than smallest int160 or * greater than largest int160). * * Counterpart to Solidity's `int160` operator. * * Requirements: * * - input must fit into 160 bits */ function toInt160(int256 value) internal pure returns (int160 downcasted) { downcasted = int160(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(160, value); } } /** * @dev Returns the downcasted int152 from int256, reverting on * overflow (when the input is less than smallest int152 or * greater than largest int152). * * Counterpart to Solidity's `int152` operator. * * Requirements: * * - input must fit into 152 bits */ function toInt152(int256 value) internal pure returns (int152 downcasted) { downcasted = int152(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(152, value); } } /** * @dev Returns the downcasted int144 from int256, reverting on * overflow (when the input is less than smallest int144 or * greater than largest int144). * * Counterpart to Solidity's `int144` operator. * * Requirements: * * - input must fit into 144 bits */ function toInt144(int256 value) internal pure returns (int144 downcasted) { downcasted = int144(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(144, value); } } /** * @dev Returns the downcasted int136 from int256, reverting on * overflow (when the input is less than smallest int136 or * greater than largest int136). * * Counterpart to Solidity's `int136` operator. * * Requirements: * * - input must fit into 136 bits */ function toInt136(int256 value) internal pure returns (int136 downcasted) { downcasted = int136(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(136, value); } } /** * @dev Returns the downcasted int128 from int256, reverting on * overflow (when the input is less than smallest int128 or * greater than largest int128). * * Counterpart to Solidity's `int128` operator. * * Requirements: * * - input must fit into 128 bits */ function toInt128(int256 value) internal pure returns (int128 downcasted) { downcasted = int128(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(128, value); } } /** * @dev Returns the downcasted int120 from int256, reverting on * overflow (when the input is less than smallest int120 or * greater than largest int120). * * Counterpart to Solidity's `int120` operator. * * Requirements: * * - input must fit into 120 bits */ function toInt120(int256 value) internal pure returns (int120 downcasted) { downcasted = int120(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(120, value); } } /** * @dev Returns the downcasted int112 from int256, reverting on * overflow (when the input is less than smallest int112 or * greater than largest int112). * * Counterpart to Solidity's `int112` operator. * * Requirements: * * - input must fit into 112 bits */ function toInt112(int256 value) internal pure returns (int112 downcasted) { downcasted = int112(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(112, value); } } /** * @dev Returns the downcasted int104 from int256, reverting on * overflow (when the input is less than smallest int104 or * greater than largest int104). * * Counterpart to Solidity's `int104` operator. * * Requirements: * * - input must fit into 104 bits */ function toInt104(int256 value) internal pure returns (int104 downcasted) { downcasted = int104(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(104, value); } } /** * @dev Returns the downcasted int96 from int256, reverting on * overflow (when the input is less than smallest int96 or * greater than largest int96). * * Counterpart to Solidity's `int96` operator. * * Requirements: * * - input must fit into 96 bits */ function toInt96(int256 value) internal pure returns (int96 downcasted) { downcasted = int96(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(96, value); } } /** * @dev Returns the downcasted int88 from int256, reverting on * overflow (when the input is less than smallest int88 or * greater than largest int88). * * Counterpart to Solidity's `int88` operator. * * Requirements: * * - input must fit into 88 bits */ function toInt88(int256 value) internal pure returns (int88 downcasted) { downcasted = int88(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(88, value); } } /** * @dev Returns the downcasted int80 from int256, reverting on * overflow (when the input is less than smallest int80 or * greater than largest int80). * * Counterpart to Solidity's `int80` operator. * * Requirements: * * - input must fit into 80 bits */ function toInt80(int256 value) internal pure returns (int80 downcasted) { downcasted = int80(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(80, value); } } /** * @dev Returns the downcasted int72 from int256, reverting on * overflow (when the input is less than smallest int72 or * greater than largest int72). * * Counterpart to Solidity's `int72` operator. * * Requirements: * * - input must fit into 72 bits */ function toInt72(int256 value) internal pure returns (int72 downcasted) { downcasted = int72(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(72, value); } } /** * @dev Returns the downcasted int64 from int256, reverting on * overflow (when the input is less than smallest int64 or * greater than largest int64). * * Counterpart to Solidity's `int64` operator. * * Requirements: * * - input must fit into 64 bits */ function toInt64(int256 value) internal pure returns (int64 downcasted) { downcasted = int64(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(64, value); } } /** * @dev Returns the downcasted int56 from int256, reverting on * overflow (when the input is less than smallest int56 or * greater than largest int56). * * Counterpart to Solidity's `int56` operator. * * Requirements: * * - input must fit into 56 bits */ function toInt56(int256 value) internal pure returns (int56 downcasted) { downcasted = int56(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(56, value); } } /** * @dev Returns the downcasted int48 from int256, reverting on * overflow (when the input is less than smallest int48 or * greater than largest int48). * * Counterpart to Solidity's `int48` operator. * * Requirements: * * - input must fit into 48 bits */ function toInt48(int256 value) internal pure returns (int48 downcasted) { downcasted = int48(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(48, value); } } /** * @dev Returns the downcasted int40 from int256, reverting on * overflow (when the input is less than smallest int40 or * greater than largest int40). * * Counterpart to Solidity's `int40` operator. * * Requirements: * * - input must fit into 40 bits */ function toInt40(int256 value) internal pure returns (int40 downcasted) { downcasted = int40(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(40, value); } } /** * @dev Returns the downcasted int32 from int256, reverting on * overflow (when the input is less than smallest int32 or * greater than largest int32). * * Counterpart to Solidity's `int32` operator. * * Requirements: * * - input must fit into 32 bits */ function toInt32(int256 value) internal pure returns (int32 downcasted) { downcasted = int32(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(32, value); } } /** * @dev Returns the downcasted int24 from int256, reverting on * overflow (when the input is less than smallest int24 or * greater than largest int24). * * Counterpart to Solidity's `int24` operator. * * Requirements: * * - input must fit into 24 bits */ function toInt24(int256 value) internal pure returns (int24 downcasted) { downcasted = int24(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(24, value); } } /** * @dev Returns the downcasted int16 from int256, reverting on * overflow (when the input is less than smallest int16 or * greater than largest int16). * * Counterpart to Solidity's `int16` operator. * * Requirements: * * - input must fit into 16 bits */ function toInt16(int256 value) internal pure returns (int16 downcasted) { downcasted = int16(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(16, value); } } /** * @dev Returns the downcasted int8 from int256, reverting on * overflow (when the input is less than smallest int8 or * greater than largest int8). * * Counterpart to Solidity's `int8` operator. * * Requirements: * * - input must fit into 8 bits */ function toInt8(int256 value) internal pure returns (int8 downcasted) { downcasted = int8(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(8, value); } } /** * @dev Converts an unsigned uint256 into a signed int256. * * Requirements: * * - input must be less than or equal to maxInt256. */ function toInt256(uint256 value) internal pure returns (int256) { // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive if (value > uint256(type(int256).max)) { revert SafeCastOverflowedUintToInt(value); } return int256(value); } }
// 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) (interfaces/IERC5313.sol) pragma solidity ^0.8.20; /** * @dev Interface for the Light Contract Ownership Standard. * * A standardized minimal interface required to identify an account that controls a contract */ interface IERC5313 { /** * @dev Gets the address of the owner. */ function owner() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 value) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// 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) (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 pragma solidity >=0.8.0; import {wadExp, wadLn, wadMul, unsafeWadMul, toWadUnsafe} from "solmate/utils/SignedWadMath.sol"; /// @title Modified Variable Rate Gradual Dutch Auction /// @author transmissions11 <[email protected]> /// @author FrankieIsLost <[email protected]> /// @author Fantasy Labs <[email protected]> /// @notice Modified code for the Fantasy Minter. Sell tokens roughly according to an issuance schedule. abstract contract VRGDA { /*////////////////////////////////////////////////////////////// PRICING LOGIC //////////////////////////////////////////////////////////////*/ /// @notice Calculate the price of a token according to the VRGDA formula. /// @param timeSinceStart Time passed since the VRGDA began, scaled by 1e18. /// @param sold The total number of sells that have been performed so far. /// @param targetPrice The target price for a sell if done on pace, scaled by 1e18, e.g 1e18 for one eth, 1e6 for one usdc. /// @param priceDecayPercent The percent price decays per unit of time with no sales, scaled by 1e18, e.g 3e17 for 30%. If the unit of time is a day, this means the price decays by 30% every day. /// @param perTimeUnit The targeted number of sells to perform in 1 full unit of time, scaled by 1e18, e.g 1e18 for 1 pack. If the unit of time is a day, this means the target is to sell 1 pack every day. /// @return The price of a token according to VRGDA, scaled by 1e18. function getVRGDAPrice( int256 timeSinceStart, uint256 sold, int256 targetPrice, int256 priceDecayPercent, int256 perTimeUnit ) public view virtual returns (uint256) { require(targetPrice > 0, "Non zero target price"); int256 decayConstant = wadLn(1e18 - priceDecayPercent); require(decayConstant < 0, "NON_NEGATIVE_DECAY_CONSTANT"); unchecked { // prettier-ignore return uint256(wadMul(targetPrice, wadExp(unsafeWadMul(decayConstant, // Theoretically calling toWadUnsafe with sold can silently overflow but under // any reasonable circumstance it will never be large enough. We use sold + 1 as // the VRGDA formula's n param represents the nth token and sold is the n-1th token. timeSinceStart - getTargetSaleTime(toWadUnsafe(sold + 1), perTimeUnit) )))); } } /// @dev Given a number of tokens sold, return the target time that number of tokens should be sold by. /// @param sold A number of tokens sold, scaled by 1e18, to get the corresponding target sale time for. /// @param perTimeUnit The total number of tokens to target selling every full unit of time. /// @return The target time the tokens should be sold by, scaled by 1e18, where the time is /// relative, such that 0 means the tokens should be sold immediately when the VRGDA begins. function getTargetSaleTime(int256 sold, int256 perTimeUnit) public view virtual returns (int256); }
// 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/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) (access/IAccessControl.sol) pragma solidity ^0.8.20; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev The `account` is missing a role. */ error AccessControlUnauthorizedAccount(address account, bytes32 neededRole); /** * @dev The caller of a function is not the expected one. * * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}. */ error AccessControlBadConfirmation(); /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `callerConfirmation`. */ function renounceRole(bytes32 role, address callerConfirmation) external; }
// 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); }
{ "remappings": [ "@std/=lib/forge-std/src/", "@openzeppelin/=lib/openzeppelin-contracts/", "@VRGDAs/=lib/VRGDAs/src/", "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "VRGDAs/=lib/VRGDAs/src/", "ds-test/=lib/VRGDAs/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "solmate/=lib/VRGDAs/lib/solmate/src/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "shanghai", "viaIR": false, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_treasury","type":"address"},{"internalType":"address","name":"_executionDelegate","type":"address"},{"internalType":"uint256","name":"_cardsRequiredForLevelUp","type":"uint256"},{"internalType":"uint256","name":"_cardsRequiredForBurnToDraw","type":"uint256"},{"internalType":"uint256","name":"_cardsDrawnPerBurn","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"uint48","name":"schedule","type":"uint48"}],"name":"AccessControlEnforcedDefaultAdminDelay","type":"error"},{"inputs":[],"name":"AccessControlEnforcedDefaultAdminRules","type":"error"},{"inputs":[{"internalType":"address","name":"defaultAdmin","type":"address"}],"name":"AccessControlInvalidDefaultAdmin","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"uint8","name":"bits","type":"uint8"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"SafeCastOverflowedUintDowncast","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256[]","name":"burntTokenIds","type":"uint256[]"},{"indexed":false,"internalType":"address","name":"collection","type":"address"},{"indexed":false,"internalType":"address","name":"caller","type":"address"}],"name":"BatchBurn","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256[]","name":"burntTokenIds","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"mintedTokenIds","type":"uint256[]"},{"indexed":false,"internalType":"address","name":"collection","type":"address"},{"indexed":false,"internalType":"address","name":"caller","type":"address"}],"name":"BurnToDraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"mintConfigId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newCardsPerPack","type":"uint256"}],"name":"CardsPerPackUpdatedForMintConfig","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"mintConfigId","type":"uint256"},{"indexed":false,"internalType":"address","name":"newCollection","type":"address"}],"name":"CollectionUpdatedForMintConfig","type":"event"},{"anonymous":false,"inputs":[],"name":"DefaultAdminDelayChangeCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint48","name":"newDelay","type":"uint48"},{"indexed":false,"internalType":"uint48","name":"effectSchedule","type":"uint48"}],"name":"DefaultAdminDelayChangeScheduled","type":"event"},{"anonymous":false,"inputs":[],"name":"DefaultAdminTransferCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newAdmin","type":"address"},{"indexed":false,"internalType":"uint48","name":"acceptSchedule","type":"uint48"}],"name":"DefaultAdminTransferScheduled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"mintConfigId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newExpirationTimestamp","type":"uint256"}],"name":"ExpirationTimestampUpdatedForMintConfig","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"mintConfigId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newFixedPrice","type":"uint256"}],"name":"FixedPriceUpdatedForMintConfig","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256[]","name":"burntTokenIds","type":"uint256[]"},{"indexed":false,"internalType":"uint256","name":"mintedTokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"collection","type":"address"},{"indexed":false,"internalType":"address","name":"caller","type":"address"}],"name":"LevelUp","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"mintConfigId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxPacksPerAddress","type":"uint256"}],"name":"MaxPacksPerAddressUpdatedForMintConfig","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"mintConfigId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newMaxPacks","type":"uint256"}],"name":"MaxPacksUpdatedForMintConfig","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"mintConfigId","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"newMerkleRoot","type":"bytes32"}],"name":"MerkleRootUpdatedForMintConfig","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"mintConfigId","type":"uint256"},{"indexed":false,"internalType":"address","name":"buyer","type":"address"},{"indexed":false,"internalType":"uint256","name":"totalMintedPacks","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"firstTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lastTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"mintConfigId","type":"uint256"}],"name":"MintConfigCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_executionDelegate","type":"address"}],"name":"NewExecutionDelegate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"mintConfigId","type":"uint256"},{"indexed":false,"internalType":"address","name":"collection","type":"address"},{"indexed":false,"internalType":"uint256","name":"cardsPerPack","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxPacks","type":"uint256"},{"indexed":false,"internalType":"address","name":"paymentToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"fixedPrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxPacksPerAddress","type":"uint256"},{"indexed":false,"internalType":"bool","name":"requiresWhitelist","type":"bool"},{"indexed":false,"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"expirationTimestamp","type":"uint256"}],"name":"NewMintConfig","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_cardsDrawnPerBurn","type":"uint256"}],"name":"NewNumberOfCardsDrawnPerBurn","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_cardsRequiredForBurnToDraw","type":"uint256"}],"name":"NewNumberOfCardsRequiredForBurnToDraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_cardsRequiredForLevelUp","type":"uint256"}],"name":"NewNumberOfCardsRequiredForLevelUp","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"treasury","type":"address"}],"name":"NewTreasury","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"collection","type":"address"}],"name":"NewWhitelistedCollection","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"mintConfigId","type":"uint256"},{"indexed":false,"internalType":"address","name":"newPaymentToken","type":"address"}],"name":"PaymentTokenUpdatedForMintConfig","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"collection","type":"address"}],"name":"UnWhitelistedCollection","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"mintConfigId","type":"uint256"},{"indexed":false,"internalType":"int256","name":"targetPrice","type":"int256"},{"indexed":false,"internalType":"int256","name":"priceDecayPercent","type":"int256"},{"indexed":false,"internalType":"int256","name":"perTimeUnit","type":"int256"}],"name":"VRGDAUpdatedForMintConfig","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"mintConfigId","type":"uint256"},{"indexed":false,"internalType":"bool","name":"newRequiresWhitelist","type":"bool"}],"name":"WhitelistRequirementUpdatedForMintConfig","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINT_CONFIG_MASTER","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptDefaultAdminTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"batchBurn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[][]","name":"tokenIds","type":"uint256[][]"},{"internalType":"address","name":"collection","type":"address"}],"name":"batchBurnToDraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"configId","type":"uint256"},{"internalType":"bytes32[][]","name":"merkleProofs","type":"bytes32[][]"},{"internalType":"uint256","name":"maxPrice","type":"uint256"},{"internalType":"address[]","name":"recipients","type":"address[]"}],"name":"batchMintCardsTo","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newAdmin","type":"address"}],"name":"beginDefaultAdminTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"internalType":"address","name":"collection","type":"address"}],"name":"burnToDraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"cancelDefaultAdminTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"mintConfigId","type":"uint256"}],"name":"cancelMintConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"cardsDrawnPerBurn","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cardsRequiredForBurnToDraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cardsRequiredForLevelUp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint48","name":"newDelay","type":"uint48"}],"name":"changeDefaultAdminDelay","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"defaultAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"defaultAdminDelay","outputs":[{"internalType":"uint48","name":"","type":"uint48"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"defaultAdminDelayIncreaseWait","outputs":[{"internalType":"uint48","name":"","type":"uint48"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"executionDelegate","outputs":[{"internalType":"contract IExecutionDelegate","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"mintConfigId","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"getAmountMintedPerAddressForMintConfig","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"mintConfigId","type":"uint256"}],"name":"getMintConfig","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bool","name":"","type":"bool"},{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"configId","type":"uint256"}],"name":"getPackPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int256","name":"sold","type":"int256"},{"internalType":"int256","name":"perTimeUnit","type":"int256"}],"name":"getTargetSaleTime","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"mintConfigId","type":"uint256"}],"name":"getVRGDAConfig","outputs":[{"components":[{"internalType":"int256","name":"targetPrice","type":"int256"},{"internalType":"int256","name":"priceDecayPercent","type":"int256"},{"internalType":"int256","name":"perTimeUnit","type":"int256"},{"internalType":"int256","name":"secondsPerTimeUnit","type":"int256"}],"internalType":"struct IMinter.VRGDAConfig","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int256","name":"timeSinceStart","type":"int256"},{"internalType":"uint256","name":"sold","type":"uint256"},{"internalType":"int256","name":"targetPrice","type":"int256"},{"internalType":"int256","name":"priceDecayPercent","type":"int256"},{"internalType":"int256","name":"perTimeUnit","type":"int256"}],"name":"getVRGDAPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"internalType":"address","name":"collection","type":"address"}],"name":"levelUp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"configId","type":"uint256"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"},{"internalType":"uint256","name":"maxPrice","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"mintConfigIdCounter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"mintConfigId","type":"uint256"}],"name":"mintConfigs","outputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"cardsPerPack","type":"uint256"},{"internalType":"uint256","name":"maxPacks","type":"uint256"},{"internalType":"address","name":"paymentToken","type":"address"},{"components":[{"internalType":"int256","name":"targetPrice","type":"int256"},{"internalType":"int256","name":"priceDecayPercent","type":"int256"},{"internalType":"int256","name":"perTimeUnit","type":"int256"},{"internalType":"int256","name":"secondsPerTimeUnit","type":"int256"}],"internalType":"struct IMinter.VRGDAConfig","name":"vrgdaConfig","type":"tuple"},{"internalType":"uint256","name":"fixedPrice","type":"uint256"},{"internalType":"uint256","name":"maxPacksPerAddress","type":"uint256"},{"internalType":"bool","name":"requiresWhitelist","type":"bool"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"internalType":"uint256","name":"startTimestamp","type":"uint256"},{"internalType":"uint256","name":"expirationTimestamp","type":"uint256"},{"internalType":"uint256","name":"totalMintedPacks","type":"uint256"},{"internalType":"bool","name":"cancelled","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"cardsPerPack","type":"uint256"},{"internalType":"uint256","name":"maxPacks","type":"uint256"},{"internalType":"address","name":"paymentToken","type":"address"},{"internalType":"uint256","name":"fixedPrice","type":"uint256"},{"internalType":"uint256","name":"maxPacksPerAddress","type":"uint256"},{"internalType":"bool","name":"requiresWhitelist","type":"bool"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"internalType":"uint256","name":"startTimestamp","type":"uint256"},{"internalType":"uint256","name":"expirationTimestamp","type":"uint256"}],"name":"newMintConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingDefaultAdmin","outputs":[{"internalType":"address","name":"newAdmin","type":"address"},{"internalType":"uint48","name":"schedule","type":"uint48"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingDefaultAdminDelay","outputs":[{"internalType":"uint48","name":"newDelay","type":"uint48"},{"internalType":"uint48","name":"schedule","type":"uint48"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rollbackDefaultAdminDelay","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"paymentToken","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"saveFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"mintConfigId","type":"uint256"},{"internalType":"uint256","name":"cardsPerPack","type":"uint256"}],"name":"setCardsPerPackForMintConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"mintConfigId","type":"uint256"},{"internalType":"address","name":"collection","type":"address"}],"name":"setCollectionForMintConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_executionDelegate","type":"address"}],"name":"setExecutionDelegate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"mintConfigId","type":"uint256"},{"internalType":"uint256","name":"expirationTimestamp","type":"uint256"}],"name":"setExpirationTimestampForMintConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"mintConfigId","type":"uint256"},{"internalType":"uint256","name":"fixedPrice","type":"uint256"}],"name":"setFixedPriceForMintConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"mintConfigId","type":"uint256"},{"internalType":"uint256","name":"maxPacks","type":"uint256"}],"name":"setMaxPacksForMintConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"mintConfigId","type":"uint256"},{"internalType":"uint256","name":"maxPacksPerAddress","type":"uint256"}],"name":"setMaxPacksPerAddressForMintConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"mintConfigId","type":"uint256"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"name":"setMerkleRootForMintConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"mintConfigId","type":"uint256"},{"internalType":"bool","name":"requiresWhitelist","type":"bool"}],"name":"setRequiresWhitelistForMintConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_treasury","type":"address"}],"name":"setTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"mintConfigId","type":"uint256"},{"internalType":"int256","name":"targetPrice","type":"int256"},{"internalType":"int256","name":"priceDecayPercent","type":"int256"},{"internalType":"int256","name":"perTimeUnit","type":"int256"},{"internalType":"int256","name":"secondsPerTimeUnit","type":"int256"}],"name":"setVRGDAForMintConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_cardsDrawnPerBurn","type":"uint256"}],"name":"setcardsDrawnPerBurn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_cardsRequiredForBurnToDraw","type":"uint256"}],"name":"setcardsRequiredForBurnToDraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_cardsRequiredForLevelUp","type":"uint256"}],"name":"setcardsRequiredForLevelUp","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":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_collection","type":"address"}],"name":"unWhiteListCollection","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_collection","type":"address"}],"name":"whiteListCollection","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"}],"name":"whitelistedCollections","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405234801562000010575f80fd5b5060405162004e8e38038062004e8e833981016040819052620000339162000675565b5f33806200005b57604051636116401160e11b81525f60048201526024015b60405180910390fd5b600180546001600160d01b0316600160d01b65ffffffffffff851602179055620000865f82620001ff565b50505060016003819055507343000000000000000000000000000000000000026001600160a01b0316634e606c476040518163ffffffff1660e01b81526004015f604051808303815f87803b158015620000de575f80fd5b505af1158015620000f1573d5f803e3d5ffd5b5050604051631d70c8d360e31b8152336004820152734300000000000000000000000000000000000002925063eb86469891506024015f604051808303815f87803b1580156200013f575f80fd5b505af115801562000152573d5f803e3d5ffd5b50506040516336b91f2b60e01b8152336004820152732536fe9ab3f511540f2f9e2ec2a805005c3dd80092506336b91f2b91506024015f604051808303815f87803b158015620001a0575f80fd5b505af1158015620001b3573d5f803e3d5ffd5b50505050620001c8856200027360201b60201c565b620001d38462000320565b620001de83620003d8565b620001e98262000476565b620001f48162000516565b5050505050620006c4565b5f826200025e575f6200021a6002546001600160a01b031690565b6001600160a01b0316146200024257604051631fe1e13d60e11b815260040160405180910390fd5b600280546001600160a01b0319166001600160a01b0384161790555b6200026a8383620005ae565b90505b92915050565b6001600160a01b038116620002cb5760405162461bcd60e51b815260206004820152601e60248201527f547265617375727920616464726573732063616e6e6f74206265203078300000604482015260640162000052565b600680546001600160a01b0319166001600160a01b0383169081179091556040519081527fafa147634b29e2c7bd53ce194256b9f41cfb9ba3036f2b822fdd1d965beea086906020015b60405180910390a150565b6001600160a01b038116620003895760405162461bcd60e51b815260206004820152602860248201527f457865637574696f6e2064656c656761746520616464726573732063616e6e6f604482015267074206265203078360c41b606482015260840162000052565b600780546001600160a01b0319166001600160a01b0383169081179091556040519081527ff9a0f356a7ef079355de09d32ce45cc3cfabc8f118681c19a17501f005a376ac9060200162000315565b5f8111620004405760405162461bcd60e51b815260206004820152602e60248201527f63617264735265717569726564466f724c6576656c5570206d7573742062652060448201526d067726561746572207468616e20360941b606482015260840162000052565b60098190556040518181527f74108c1b435472b4b951929da5941e47e341e8be74a4e47d56de096fd48ead4d9060200162000315565b5f8111620004e05760405162461bcd60e51b815260206004820152603060248201527f63617264735265717569726564546f4275726e546f44726177206d757374206260448201526f0652067726561746572207468616e20360841b606482015260840162000052565b600a8190556040518181527f08e1b3eae26eb58425aa569f65f68f6a673e3a6114c985032899b41808591dcd9060200162000315565b5f8111620005785760405162461bcd60e51b815260206004820152602860248201527f6361726473447261776e5065724275726e206d75737420626520677265617465604482015267072207468616e20360c41b606482015260840162000052565b600b8190556040518181527fff9d1a7760c4901a5731a4921b0e6413ebfcb1ec08559be9d51c2bdb77f2daf39060200162000315565b5f828152602081815260408083206001600160a01b038516845290915281205460ff1662000651575f838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055620006083390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45060016200026d565b505f6200026d565b80516001600160a01b038116811462000670575f80fd5b919050565b5f805f805f60a086880312156200068a575f80fd5b620006958662000659565b9450620006a56020870162000659565b6040870151606088015160809098015196999198509695945092505050565b6147bc80620006d25f395ff3fe608060405260043610610371575f3560e01c80638da5cb5b116101c8578063d2c69922116100fd578063e195feb91161009d578063ef4f95bd1161006d578063ef4f95bd14610bc3578063f0f4426014610be2578063f76d22fd14610c01578063fe00629f14610c20575f80fd5b8063e195feb914610a8e578063e8beb1b614610aad578063ea9a3ff414610acc578063ec69a4b714610aeb575f80fd5b8063d602b9fd116100d8578063d602b9fd14610a27578063d710076a14610a3b578063db24f40014610a5a578063e07548bd14610a79575f80fd5b8063d2c69922146109ca578063d4936dab146109e9578063d547741f14610a08575f80fd5b8063afb926b911610168578063cbbfbccf11610143578063cbbfbccf14610949578063cc8463c814610968578063cefc14291461097c578063cf6eefb714610990575f80fd5b8063afb926b9146108ec578063b83f5a421461090b578063c62cf1db1461092a575f80fd5b80639a90abc2116101a35780639a90abc214610872578063a1eda53c14610891578063a217fddf146108c4578063adb79d17146108d7575f80fd5b80638da5cb5b1461082057806391d1485414610834578063986c9b2014610853575f80fd5b80634f05cbd8116102a9578063634e93da1161024957806374675f6b1161021957806374675f6b146107b05780637bad2380146107c55780638094cee4146107e457806384ef8ffc14610803575f80fd5b8063634e93da1461073e578063649a5ec71461075d5780637164ad401461077c57806372c7242b14610791575f80fd5b806353d157221161028457806353d15722146105d457806359df4edd146105f35780635e48091b146106e857806361d027b314610707575f80fd5b80634f05cbd81461056857806350946b6614610596578063530b3e54146105b5575f80fd5b806324413f5a116103145780632f2ff15d116102ef5780632f2ff15d146104c65780632f3d9885146104e5578063304588c01461052a57806336568abe14610549575f80fd5b806324413f5a14610466578063248a9ca3146104855780632929bb1c146104b3575f80fd5b80630aa6220b1161034f5780630aa6220b146103f257806313aaf266146104065780631ff7712f1461042557806321a8dcef14610438575f80fd5b806301ffc9a714610375578063022d63fb146103a9578063037c9be2146103d1575b5f80fd5b348015610380575f80fd5b5061039461038f366004613eee565b610c4c565b60405190151581526020015b60405180910390f35b3480156103b4575f80fd5b50620697805b60405165ffffffffffff90911681526020016103a0565b3480156103dc575f80fd5b506103f06103eb366004613f29565b610c76565b005b3480156103fd575f80fd5b506103f0610c8d565b348015610411575f80fd5b506103f0610420366004613f29565b610ca2565b6103f0610433366004613f8c565b610d04565b348015610443575f80fd5b506104585f8051602061476783398151915281565b6040519081526020016103a0565b348015610471575f80fd5b50610458610480366004613fdb565b610d51565b348015610490575f80fd5b5061045861049f366004613fdb565b5f9081526020819052604090206001015490565b6103f06104c1366004613ff2565b610e5d565b3480156104d1575f80fd5b506103f06104e036600461406f565b610f6f565b3480156104f0575f80fd5b506104586104ff36600461406f565b5f8281526004602090815260408083206001600160a01b0385168452600e0190915290205492915050565b348015610535575f80fd5b506103f061054436600461409d565b610f97565b348015610554575f80fd5b506103f061056336600461406f565b610fe0565b348015610573575f80fd5b50610394610582366004613f29565b60056020525f908152604090205460ff1681565b3480156105a1575f80fd5b506103f06105b03660046140fd565b611086565b3480156105c0575f80fd5b506103f06105cf36600461406f565b61141e565b3480156105df575f80fd5b506104586105ee366004614188565b611584565b3480156105fe575f80fd5b5061067d61060d366004613fdb565b5f908152600460205260409020805460018201546002830154600384015460088501546009860154600a870154600b880154600c890154600d8a0154600f8b01546010909b01546001600160a01b039a8b169c999b989a909716989597949660ff94851696939592949193911690565b604080516001600160a01b039d8e168152602081019c909c528b0199909952999096166060890152608088019490945260a0870192909252151560c086015260e0850152610100840152610120830152610140820192909252901515610160820152610180016103a0565b3480156106f3575f80fd5b506103f06107023660046141bf565b611680565b348015610712575f80fd5b50600654610726906001600160a01b031681565b6040516001600160a01b0390911681526020016103a0565b348015610749575f80fd5b506103f0610758366004613f29565b611748565b348015610768575f80fd5b506103f06107773660046141fd565b61175b565b348015610787575f80fd5b5061045860085481565b34801561079c575f80fd5b506103f06107ab366004614222565b61176e565b3480156107bb575f80fd5b50610458600b5481565b3480156107d0575f80fd5b506103f06107df366004614242565b611857565b3480156107ef575f80fd5b506103f06107fe36600461409d565b611a67565b34801561080e575f80fd5b506002546001600160a01b0316610726565b34801561082b575f80fd5b50610726611a77565b34801561083f575f80fd5b5061039461084e36600461406f565b611a8f565b34801561085e575f80fd5b50600754610726906001600160a01b031681565b34801561087d575f80fd5b506103f061088c366004614188565b611ab7565b34801561089c575f80fd5b506108a5611d0d565b6040805165ffffffffffff9384168152929091166020830152016103a0565b3480156108cf575f80fd5b506104585f81565b3480156108e2575f80fd5b50610458600a5481565b3480156108f7575f80fd5b506103f0610906366004613fdb565b611d5f565b348015610916575f80fd5b506103f0610925366004613fdb565b611d7f565b348015610935575f80fd5b50610458610944366004614222565b611e06565b348015610954575f80fd5b506103f0610963366004614222565b611e1d565b348015610973575f80fd5b506103ba611ec4565b348015610987575f80fd5b506103f0611f22565b34801561099b575f80fd5b506109a4611f61565b604080516001600160a01b03909316835265ffffffffffff9091166020830152016103a0565b3480156109d5575f80fd5b506103f06109e4366004613fdb565b611f82565b3480156109f4575f80fd5b506103f0610a03366004613f29565b611fa2565b348015610a13575f80fd5b506103f0610a2236600461406f565b611fff565b348015610a32575f80fd5b506103f0612027565b348015610a46575f80fd5b506103f0610a55366004614222565b612039565b348015610a65575f80fd5b506103f0610a7436600461409d565b6120ff565b348015610a84575f80fd5b5061045860095481565b348015610a99575f80fd5b506103f0610aa8366004614222565b6123e3565b348015610ab8575f80fd5b506103f0610ac7366004614293565b612490565b348015610ad7575f80fd5b506103f0610ae6366004614222565b612544565b348015610af6575f80fd5b50610baa610b05366004613fdb565b600460208181525f928352604092839020805460018201546002830154600384015487516080810189529685015487526005850154958701959095526006840154968601969096526007830154606086015260088301546009840154600a850154600b860154600c870154600d880154600f8901546010909901546001600160a01b039889169c979b979a9098169896979596949560ff94851695939492939192168d565b6040516103a09d9c9b9a999897969594939291906142b6565b348015610bce575f80fd5b506103f0610bdd366004613fdb565b6125eb565b348015610bed575f80fd5b506103f0610bfc366004613f29565b61260b565b348015610c0c575f80fd5b506103f0610c1b366004614222565b61261e565b348015610c2b575f80fd5b50610c3f610c3a366004613fdb565b612720565b6040516103a09190614356565b5f6001600160e01b031982166318a4c3c360e11b1480610c705750610c70826127d2565b92915050565b5f610c8081612806565b610c8982612810565b5050565b5f610c9781612806565b610c9f6128cc565b50565b5f610cac81612806565b6001600160a01b0382165f81815260056020908152604091829020805460ff1916905590519182527fed3eb8d0fbd0827cb7352b2abfeab8e86a413218ac1a55e47044db2c764ec1de91015b60405180910390a15050565b610d0c6128d8565b333214610d345760405162461bcd60e51b8152600401610d2b90614381565b60405180910390fd5b610d418484848433612902565b610d4b6001600355565b50505050565b5f818152600460205260408120601081015460ff1615610d835760405162461bcd60e51b8152600401610d2b906143c6565b60048101545f03610d98576008015492915050565b60408051608081018252600483015481526005830154602082015260068301549181019190915260078201546060820152600c8201545f90610dda9042614409565b1015610e1c5760405162461bcd60e51b81526020600482015260116024820152700494e56414c49445f54494d455354414d5607c1b6044820152606401610d2b565b610e55610e3f83600c015442038360600151670de0b6b3a7640000919091020490565b600f840154835160208501516040860151611584565b949350505050565b610e656128d8565b333214610e845760405162461bcd60e51b8152600401610d2b90614381565b5f80516020614767833981519152610e9b81612806565b848214610eea5760405162461bcd60e51b815260206004820152601c60248201527f6d65726b6c6550726f6f6673206c656e677468206d69736d61746368000000006044820152606401610d2b565b5f5b82811015610f5b57610f4988888884818110610f0a57610f0a61441c565b9050602002810190610f1c9190614430565b88888887818110610f2f57610f2f61441c565b9050602002016020810190610f449190613f29565b612902565b80610f5381614476565b915050610eec565b5050610f676001600355565b505050505050565b81610f8d57604051631fe1e13d60e11b815260040160405180910390fd5b610c898282612cc9565b5f5b82811015610d4b57610fce848483818110610fb657610fb661441c565b9050602002810190610fc89190614430565b84612ced565b80610fd881614476565b915050610f99565b81158015610ffb57506002546001600160a01b038281169116145b1561107c575f8061100a611f61565b90925090506001600160a01b03821615158061102c575065ffffffffffff8116155b8061103f57504265ffffffffffff821610155b15611067576040516319ca5ebb60e01b815265ffffffffffff82166004820152602401610d2b565b50506001805465ffffffffffff60a01b191690555b610c89828261305d565b5f8051602061476783398151915261109d81612806565b6001600160a01b038b165f9081526005602052604090205460ff166110d45760405162461bcd60e51b8152600401610d2b9061448e565b6001600160a01b038b1661112a5760405162461bcd60e51b815260206004820181905260248201527f436f6c6c656374696f6e20616464726573732063616e6e6f74206265203078306044820152606401610d2b565b5f8a116111495760405162461bcd60e51b8152600401610d2b906144c5565b5f89116111985760405162461bcd60e51b815260206004820181905260248201527f4d6178207061636b73206d7573742062652067726561746572207468616e20306044820152606401610d2b565b428310156111fd5760405162461bcd60e51b815260206004820152602c60248201527f4d696e74206d75737420737461727420696d6d6564696174656c79206f72206960448201526b6e207468652066757475726560a01b6064820152608401610d2b565b81158061120957508282115b6112555760405162461bcd60e51b815260206004820152601b60248201527f696e76616c69642065787069726174696f6e54696d657374616d7000000000006044820152606401610d2b565b84156112a0575f8490036112a05760405162461bcd60e51b81526020600482015260126024820152711b5a5cdcda5b99c81b595c9adb19549bdbdd60721b6044820152606401610d2b565b5f60045f60085481526020019081526020015f2090508b815f015f6101000a8154816001600160a01b0302191690836001600160a01b031602179055508a816001018190555089816002018190555088816003015f6101000a8154816001600160a01b0302191690836001600160a01b031602179055508781600801819055508681600901819055508581600a015f6101000a81548160ff0219169083151502179055508481600b01819055508381600c01819055508281600d01819055507f3bd6fc9da878be6bf571677edfa7b0915b71fcfe8fe71694926a70877d58cbbd6008548d8d8d8d8d8d8d8d8c6040516113f49a99989796959493929190998a526001600160a01b0398891660208b015260408a0197909752606089019590955292909516608087015260a086015260c085019390935291151560e08401526101008301919091526101208201526101400190565b60405180910390a160088054905f61140b83614476565b9190505550505050505050505050505050565b5f8051602061476783398151915261143581612806565b6001600160a01b0382165f9081526005602052604090205460ff1661146c5760405162461bcd60e51b8152600401610d2b9061448e565b600854831061148d5760405162461bcd60e51b8152600401610d2b9061450a565b6001600160a01b0382166114f65760405162461bcd60e51b815260206004820152602a60248201527f436f6c6c656374696f6e20616464726573732063616e6e6f7420746865207a65604482015269726f206164647265737360b01b6064820152608401610d2b565b5f838152600460205260409020601081015460ff16156115285760405162461bcd60e51b8152600401610d2b906143c6565b80546001600160a01b0319166001600160a01b03841690811782556040805186815260208101929092527fdf8345206ccfa90b2c8a9cecdf64f8fab8528fd37482a5258f1371c27a9374db91015b60405180910390a150505050565b5f8084136115cc5760405162461bcd60e51b81526020600482015260156024820152744e6f6e207a65726f2074617267657420707269636560581b6044820152606401610d2b565b5f6115e76115e285670de0b6b3a7640000614538565b613090565b90505f81126116385760405162461bcd60e51b815260206004820152601b60248201527f4e4f4e5f4e454741544956455f44454341595f434f4e5354414e5400000000006044820152606401610d2b565b6116758561167061166b8461165a670de0b6b3a764000060018d010289611e06565b8c03670de0b6b3a764000091020590565b6132c6565b61346c565b979650505050505050565b5f61168a81612806565b6001600160a01b0384166116d1576040516001600160a01b0384169083156108fc029084905f818181858888f193505050501580156116cb573d5f803e3d5ffd5b50610d4b565b60405163a9059cbb60e01b81526001600160a01b0384811660048301526024820184905285169063a9059cbb906044016020604051808303815f875af115801561171d573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611741919061455e565b5050505050565b5f61175281612806565b610c8982613490565b5f61176581612806565b610c8982613502565b5f8051602061476783398151915261178581612806565b60085483106117a65760405162461bcd60e51b8152600401610d2b9061450a565b816117e85760405162461bcd60e51b8152602060048201526012602482015271125b9d985b1a59081b595c9adb19549bdbdd60721b6044820152606401610d2b565b5f838152600460205260409020601081015460ff161561181a5760405162461bcd60e51b8152600401610d2b906143c6565b600b810183905560408051858152602081018590527f072c8a8b58331ede3802b3e5878f1fa116fefdcda23bf24cca9471c893621a809101611576565b806118985760405162461bcd60e51b81526020600482015260116024820152703737903a37b5b2b739903a3790313ab93760791b6044820152606401610d2b565b6001600160a01b0383165f9081526005602052604090205460ff166118cf5760405162461bcd60e51b8152600401610d2b9061448e565b5f5b81811015611a2457336001600160a01b038516636352211e8585858181106118fb576118fb61441c565b905060200201356040518263ffffffff1660e01b815260040161192091815260200190565b602060405180830381865afa15801561193b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061195f9190614579565b6001600160a01b0316146119855760405162461bcd60e51b8152600401610d2b90614594565b6007546001600160a01b0316634a439be2858585858181106119a9576119a961441c565b6040516001600160e01b031960e087901b1681526001600160a01b03909416600485015260200291909101356024830152503360448201526064015f604051808303815f87803b1580156119fb575f80fd5b505af1158015611a0d573d5f803e3d5ffd5b505050508080611a1c90614476565b9150506118d1565b507fc4b3faa7066f8b9faaceeddc5db478efb445eb5d75577d78b720af049d8b1cad82828533604051611a5a9493929190614609565b60405180910390a1505050565b611a72838383612ced565b505050565b5f611a8a6002546001600160a01b031690565b905090565b5f918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b5f80516020614767833981519152611ace81612806565b6008548610611aef5760405162461bcd60e51b8152600401610d2b9061450a565b5f8513611b365760405162461bcd60e51b81526020600482015260156024820152744e6f6e207a65726f2074617267657420707269636560581b6044820152606401610d2b565b5f8213611b855760405162461bcd60e51b815260206004820152601e60248201527f4e6f6e207a65726f207365636f6e6473207065722074696d6520756e697400006044820152606401610d2b565b5f611b9b6115e286670de0b6b3a7640000614538565b90505f8112611bec5760405162461bcd60e51b815260206004820152601b60248201527f4e4f4e5f4e454741544956455f44454341595f434f4e5354414e5400000000006044820152606401610d2b565b5f878152600460205260409020601081015460ff1615611c1e5760405162461bcd60e51b8152600401610d2b906143c6565b60038101546001600160a01b0316611c785760405162461bcd60e51b815260206004820152601b60248201527f5061796d656e7420746f6b656e2063616e6e6f742062652045544800000000006044820152606401610d2b565b604080516080808201835289825260208083018a90528284018990526060808401899052600486018c9055600586018b9055600686018a9055600786018990555f600887015584518d81529182018c90529381018a905292830188905290917f423aa27bc299bbc06e5c7096e9f4175abf43cfd355a3818ad30272249e99d3d8910160405180910390a1505050505050505050565b6002545f90600160d01b900465ffffffffffff168015158015611d3857504265ffffffffffff821610155b611d43575f80611d57565b600254600160a01b900465ffffffffffff16815b915091509091565b5f80516020614767833981519152611d7681612806565b610c898261356a565b5f80516020614767833981519152611d9681612806565b6008548210611db75760405162461bcd60e51b8152600401610d2b9061450a565b5f828152600460205260409081902060108101805460ff1916600117905590517f4b7de56f7dce4603dc3acec6390b6a16fbb140cea6fb3d7c36330a0e9e0c46b490611a5a9085815260200190565b5f670de0b6b3a764000083028290055b9392505050565b5f80516020614767833981519152611e3481612806565b6008548310611e555760405162461bcd60e51b8152600401610d2b9061450a565b5f838152600460205260409020601081015460ff1615611e875760405162461bcd60e51b8152600401610d2b906143c6565b600d810183905560408051858152602081018590527fbeab984f1dc2d5aa105ed4c4b4dd460009b20254dd62c43c38573a7edacbe1ef9101611576565b6002545f90600160d01b900465ffffffffffff168015158015611eee57504265ffffffffffff8216105b611f0957600154600160d01b900465ffffffffffff16611f1c565b600254600160a01b900465ffffffffffff165b91505090565b5f611f2b611f61565b509050336001600160a01b03821614611f5957604051636116401160e11b8152336004820152602401610d2b565b610c9f613607565b6001546001600160a01b03811691600160a01b90910465ffffffffffff1690565b5f80516020614767833981519152611f9981612806565b610c898261369d565b5f611fac81612806565b6001600160a01b0382165f81815260056020908152604091829020805460ff1916600117905590519182527f76e6d03d02c9b0a17e526874d022dad842ea72d3f29bb68e3c69647728c796119101610cf8565b8161201d57604051631fe1e13d60e11b815260040160405180910390fd5b610c898282613732565b5f61203181612806565b610c9f613756565b5f8051602061476783398151915261205081612806565b60085483106120715760405162461bcd60e51b8152600401610d2b9061450a565b5f82116120905760405162461bcd60e51b8152600401610d2b906144c5565b5f838152600460205260409020601081015460ff16156120c25760405162461bcd60e51b8152600401610d2b906143c6565b6001810183905560408051858152602081018590527fa1acab56cf4ced33302c9431597fc5d28ac4fca19efb1cc8a171c771dba04a069101611576565b6001600160a01b0381165f9081526005602052604090205460ff166121365760405162461bcd60e51b8152600401610d2b9061448e565b60095482146121915760405162461bcd60e51b815260206004820152602160248201527f77726f6e6720616d6f756e74206f6620636172647320746f206c6576656c20756044820152600760fc1b6064820152608401610d2b565b5f5b6009548110156122e857336001600160a01b038316636352211e8686858181106121bf576121bf61441c565b905060200201356040518263ffffffff1660e01b81526004016121e491815260200190565b602060405180830381865afa1580156121ff573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906122239190614579565b6001600160a01b0316146122495760405162461bcd60e51b8152600401610d2b90614594565b6007546001600160a01b0316634a439be28386868581811061226d5761226d61441c565b6040516001600160e01b031960e087901b1681526001600160a01b03909416600485015260200291909101356024830152503360448201526064015f604051808303815f87803b1580156122bf575f80fd5b505af11580156122d1573d5f803e3d5ffd5b5050505080806122e090614476565b915050612193565b505f816001600160a01b031663d082e3816040518163ffffffff1660e01b8152600401602060405180830381865afa158015612326573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061234a919061463d565b600754604051630bca392b60e01b81526001600160a01b038581166004830152336024830152929350911690630bca392b906044015f604051808303815f87803b158015612396575f80fd5b505af11580156123a8573d5f803e3d5ffd5b505050507fb896ef750ff1f78e491078417b01c8e59749b5eaa5d5531af12b01c7571a7f068484838533604051611576959493929190614654565b5f805160206147678339815191526123fa81612806565b600854831061241b5760405162461bcd60e51b8152600401610d2b9061450a565b5f838152600460205260409020601081015460ff161561244d5760405162461bcd60e51b8152600401610d2b906143c6565b600881018390555f600482015560408051858152602081018590527f2fafd57e08d8354f063b7425ce0c99715a1b869195c89039f74ecbbc7734695b9101611576565b5f805160206147678339815191526124a781612806565b60085483106124c85760405162461bcd60e51b8152600401610d2b9061450a565b5f838152600460205260409020601081015460ff16156124fa5760405162461bcd60e51b8152600401610d2b906143c6565b600a8101805460ff19168415159081179091556040805186815260208101929092527fd85a5e0cc24db438d24ee692c8d95fac67ed5f10cbb454fac53588b37231ed709101611576565b5f8051602061476783398151915261255b81612806565b600854831061257c5760405162461bcd60e51b8152600401610d2b9061450a565b5f838152600460205260409020601081015460ff16156125ae5760405162461bcd60e51b8152600401610d2b906143c6565b6009810183905560408051858152602081018590527f5dfd62351ab4b8f586b4456d11d85abae1d24ae10af9d0e2f3bae3e5abe0b0f09101611576565b5f8051602061476783398151915261260281612806565b610c8982613760565b5f61261581612806565b610c89826137fb565b5f8051602061476783398151915261263581612806565b60085483106126565760405162461bcd60e51b8152600401610d2b9061450a565b5f82116126b15760405162461bcd60e51b8152602060048201526024808201527f4d6178696d756d207061636b73206d75737420626520677265617465722074686044820152630616e20360e41b6064820152608401610d2b565b5f838152600460205260409020601081015460ff16156126e35760405162461bcd60e51b8152600401610d2b906143c6565b6002810183905560408051858152602081018590527f650f59bb42f63a7aca7d5df32553c73394e169ebf1ccd297814882ffc9b0fbd39101611576565b61274760405180608001604052805f81526020015f81526020015f81526020015f81525090565b5f82815260046020526040902060088101541561279a5760405162461bcd60e51b8152602060048201526011602482015270159491d110481b9bdd08195b98589b1959607a1b6044820152606401610d2b565b604080516080810182526004830154815260058301546020820152600683015491810191909152600790910154606082015292915050565b5f6001600160e01b03198216637965db0b60e01b1480610c7057506301ffc9a760e01b6001600160e01b0319831614610c70565b610c9f813361389f565b6001600160a01b0381166128775760405162461bcd60e51b815260206004820152602860248201527f457865637574696f6e2064656c656761746520616464726573732063616e6e6f604482015267074206265203078360c41b6064820152608401610d2b565b600780546001600160a01b0319166001600160a01b0383169081179091556040519081527ff9a0f356a7ef079355de09d32ce45cc3cfabc8f118681c19a17501f005a376ac906020015b60405180910390a150565b6128d65f806138d8565b565b6002600354036128fb57604051633ee5aeb560e01b815260040160405180910390fd5b6002600355565b5f858152600460205260409020600c8101544210156129635760405162461bcd60e51b815260206004820152601760248201527f4d696e7420636f6e666967206e6f7420737461727465640000000000000000006044820152606401610d2b565b600d810154158061297757504281600d0154115b6129b95760405162461bcd60e51b8152602060048201526013602482015272135a5b9d0818dbdb999a59c8195e1c1a5c9959606a1b6044820152606401610d2b565b601081015460ff16156129de5760405162461bcd60e51b8152600401610d2b906143c6565b600a81015460ff1615806129fd57506129fd81600b0154868685613997565b612a405760405162461bcd60e51b8152602060048201526014602482015273155cd95c881b9bdd081dda1a5d195b1a5cdd195960621b6044820152606401610d2b565b60098101541580612a6d575060098101546001600160a01b0383165f908152600e83016020526040902054105b612ab95760405162461bcd60e51b815260206004820152601b60248201527f557365722072656163686564206d6178206d696e74206c696d697400000000006044820152606401610d2b565b80600f0154816002015411612b005760405162461bcd60e51b815260206004820152600d60248201526c139bc81c1858dadcc81b19599d609a1b6044820152606401610d2b565b5f612b0a87610d51565b905083811115612b4d5760405162461bcd60e51b815260206004820152600e60248201526d0a0e4d2c6ca40e8dede40d0d2ced60931b6044820152606401610d2b565b600182600f015f828254612b61919061468e565b90915550506001600160a01b0383165f908152600e830160205260408120805460019290612b9090849061468e565b90915550506003820154600654612bb6916001600160a01b039081169186911684613a1b565b81546040805163d082e38160e01b815290515f926001600160a01b03169163d082e3819160048083019260209291908290030181865afa158015612bfc573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612c20919061463d565b83546001850154919250612c40916001600160a01b039091169086613a7b565b7f7a7be958aedb09208ae6ed49fc0841ccb7f951498c9afc1c2bfa4abbd0e3ff82888585600f0154846001886001015487612c7b919061468e565b612c859190614409565b604080519586526001600160a01b039094166020860152928401919091526060830152608082015260a0810184905260c00160405180910390a15050505050505050565b5f82815260208190526040902060010154612ce381612806565b610d4b8383613afa565b6001600160a01b0381165f9081526005602052604090205460ff16612d245760405162461bcd60e51b8152600401610d2b9061448e565b600a548214612d855760405162461bcd60e51b815260206004820152602760248201527f77726f6e6720616d6f756e74206f6620636172647320746f2064726177206e656044820152667720636172647360c81b6064820152608401610d2b565b5f5b600a54811015612edc57336001600160a01b038316636352211e868685818110612db357612db361441c565b905060200201356040518263ffffffff1660e01b8152600401612dd891815260200190565b602060405180830381865afa158015612df3573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612e179190614579565b6001600160a01b031614612e3d5760405162461bcd60e51b8152600401610d2b90614594565b6007546001600160a01b0316634a439be283868685818110612e6157612e6161441c565b6040516001600160e01b031960e087901b1681526001600160a01b03909416600485015260200291909101356024830152503360448201526064015f604051808303815f87803b158015612eb3575f80fd5b505af1158015612ec5573d5f803e3d5ffd5b505050508080612ed490614476565b915050612d87565b505f600b5467ffffffffffffffff811115612ef957612ef96146a1565b604051908082528060200260200182016040528015612f22578160200160208202803683370190505b5090505f5b600b54811015613025575f836001600160a01b031663d082e3816040518163ffffffff1660e01b8152600401602060405180830381865afa158015612f6e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612f92919061463d565b600754604051630bca392b60e01b81526001600160a01b038781166004830152336024830152929350911690630bca392b906044015f604051808303815f87803b158015612fde575f80fd5b505af1158015612ff0573d5f803e3d5ffd5b50505050808383815181106130075761300761441c565b6020908102919091010152508061301d81614476565b915050612f27565b507f8dc8de2032cffee9bedeca71a9cc32b78ac0a64716331eb90aaf5592ca40383b84848385336040516115769594939291906146b5565b6001600160a01b03811633146130865760405163334bd91960e11b815260040160405180910390fd5b611a728282613b60565b5f8082136130cc5760405162461bcd60e51b815260206004820152600960248201526815539111519253915160ba1b6044820152606401610d2b565b5060606fffffffffffffffffffffffffffffffff821160071b82811c67ffffffffffffffff1060061b1782811c63ffffffff1060051b1782811c61ffff1060041b1782811c60ff10600390811b90911783811c600f1060021b1783811c909110600190811b90911783811c90911017609f81810383019390931b90921c6c465772b2bbbb5f824b15207a3081018102821d6d0388eaa27412d5aca026815d636e018102821d6d0df99ac502031bf953eff472fdcc018102821d6d13cdffb29d51d99322bdff5f2211018102821d6d0a0f742023def783a307a986912e018102821d6d01920d8043ca89b5239253284e42018102821d6c0b7a86d7375468fac667a0a527016c29508e458543d8aa4df2abee7882018202831d6d0139601a2efabe717e604cbb4894018202831d6d02247f7a7b6594320649aa03aba1018202831d6c8c3f38e95a6b1ff2ab1c3b343619018202831d6d02384773bdf1ac5676facced60901901820290921d6cb9a025d814b29c212b8b1a07cd190102780a09507084cc699bb0e71ea869ffffffffffffffffffffffff190105711340daa0d5f769dba1915cef59f0815a550602605f19919091017d0267a36c0c95b3975ab3ee5b203a7614a3f75373f047d803ae7b6687f2b302017d57115e47018c7177eebf7cd370a3356a1b7863008a5ae8028c72b88642840160ae1d90565b5f680248ce36a70cb26b3e1982136132df57505f919050565b680755bf798b4a1bf1e582126133265760405162461bcd60e51b815260206004820152600c60248201526b4558505f4f564552464c4f5760a01b6044820152606401610d2b565b6503782dace9d9604e83901b0591505f60606bb17217f7d1cf79abc9e3b39884821b056001605f1b01901d6bb17217f7d1cf79abc9e3b39881029093036c240c330e9fb2d9cbaf0fd5aafb1981018102606090811d6d0277594991cfc85f6e2461837cd9018202811d6d1a521255e34f6a5061b25ef1c9c319018202811d6db1bbb201f443cf962f1a1d3db4a5018202811d6e02c72388d9f74f51a9331fed693f1419018202811d6e05180bb14799ab47a8a8cb2a527d57016d02d16720577bd19bf614176fe9ea6c10fe68e7fd37d0007b713f765084018402831d9081019084016d01d3967ed30fc4f89c02bab5708119010290911d6e0587f503bb6ea29d25fcb740196450019091026d360d7aeea093263ecc6e0ecb291760621b010574029d9dc38563c32e5c2f6dc192ee70ef65f9978af30260c3939093039290921c92915050565b818102821583820583141761347f575f80fd5b670de0b6b3a7640000900592915050565b5f613499611ec4565b6134a242613b9c565b6134ac9190614728565b90506134b88282613bd2565b60405165ffffffffffff821681526001600160a01b038316907f3377dc44241e779dd06afab5b788a35ca5f3b778836e2990bdb26a2a4b2e5ed69060200160405180910390a25050565b5f61350c82613c4f565b61351542613b9c565b61351f9190614728565b905061352b82826138d8565b6040805165ffffffffffff8085168252831660208201527ff1038c18cf84a56e432fdbfaf746924b7ea511dfe03a6506a0ceba4888788d9b9101610cf8565b5f81116135d25760405162461bcd60e51b815260206004820152603060248201527f63617264735265717569726564546f4275726e546f44726177206d757374206260448201526f0652067726561746572207468616e20360841b6064820152608401610d2b565b600a8190556040518181527f08e1b3eae26eb58425aa569f65f68f6a673e3a6114c985032899b41808591dcd906020016128c1565b5f80613611611f61565b915091506136268165ffffffffffff16151590565b158061363a57504265ffffffffffff821610155b15613662576040516319ca5ebb60e01b815265ffffffffffff82166004820152602401610d2b565b61367d5f6136786002546001600160a01b031690565b613b60565b506136885f83613afa565b5050600180546001600160d01b031916905550565b5f81116136fd5760405162461bcd60e51b815260206004820152602860248201527f6361726473447261776e5065724275726e206d75737420626520677265617465604482015267072207468616e20360c41b6064820152608401610d2b565b600b8190556040518181527fff9d1a7760c4901a5731a4921b0e6413ebfcb1ec08559be9d51c2bdb77f2daf3906020016128c1565b5f8281526020819052604090206001015461374c81612806565b610d4b8383613b60565b6128d65f80613bd2565b5f81116137c65760405162461bcd60e51b815260206004820152602e60248201527f63617264735265717569726564466f724c6576656c5570206d7573742062652060448201526d067726561746572207468616e20360941b6064820152608401610d2b565b60098190556040518181527f74108c1b435472b4b951929da5941e47e341e8be74a4e47d56de096fd48ead4d906020016128c1565b6001600160a01b0381166138515760405162461bcd60e51b815260206004820152601e60248201527f547265617375727920616464726573732063616e6e6f742062652030783000006044820152606401610d2b565b600680546001600160a01b0319166001600160a01b0383169081179091556040519081527fafa147634b29e2c7bd53ce194256b9f41cfb9ba3036f2b822fdd1d965beea086906020016128c1565b6138a98282611a8f565b610c895760405163e2517d3f60e01b81526001600160a01b038216600482015260248101839052604401610d2b565b600254600160d01b900465ffffffffffff16801561395a574265ffffffffffff8216101561393157600254600180546001600160d01b0316600160a01b90920465ffffffffffff16600160d01b0291909117905561395a565b6040517f2b1fa2edafe6f7b9e97c1a9e0c3660e645beb2dcaa2d45bdbf9beaf5472e1ec5905f90a15b50600280546001600160a01b0316600160a01b65ffffffffffff948516026001600160d01b031617600160d01b9290931691909102919091179055565b6040516bffffffffffffffffffffffff19606083901b1660208201525f908190603401604051602081830303815290604052805190602001209050613a118585808060200260200160405190810160405280939291908181526020018383602002808284375f920191909152508a9250859150613c969050565b9695505050505050565b6001600160a01b038416613a6f57803414613a6f5760405162461bcd60e51b8152602060048201526014602482015273125b98dbdc9c9958dd0811551208185b5bdd5b9d60621b6044820152606401610d2b565b610d4b84848484613cab565b5f5b82811015610d4b57600754604051630bca392b60e01b81526001600160a01b038681166004830152848116602483015290911690630bca392b906044015f604051808303815f87803b158015613ad1575f80fd5b505af1158015613ae3573d5f803e3d5ffd5b505050508080613af290614476565b915050613a7d565b5f82613b56575f613b136002546001600160a01b031690565b6001600160a01b031614613b3a57604051631fe1e13d60e11b815260040160405180910390fd5b600280546001600160a01b0319166001600160a01b0384161790555b611e168383613d69565b5f82158015613b7c57506002546001600160a01b038381169116145b15613b9257600280546001600160a01b03191690555b611e168383613df8565b5f65ffffffffffff821115613bce576040516306dfcc6560e41b81526030600482015260248101839052604401610d2b565b5090565b5f613bdb611f61565b6001805465ffffffffffff8616600160a01b026001600160d01b03199091166001600160a01b038816171790559150613c1d90508165ffffffffffff16151590565b15611a72576040517f8886ebfc4259abdbc16601dd8fb5678e54878f47b3c34836cfc51154a9605109905f90a1505050565b5f80613c59611ec4565b90508065ffffffffffff168365ffffffffffff1611613c8157613c7c8382614747565b611e16565b611e1665ffffffffffff841662069780613e61565b5f82613ca28584613e76565b14949350505050565b8015610d4b576001600160a01b038416613cf2576040516001600160a01b0383169082156108fc029083905f818181858888f193505050501580156116cb573d5f803e3d5ffd5b60075460405163368fa33960e21b81526001600160a01b03868116600483015285811660248301528481166044830152606482018490529091169063da3e8ce4906084015f604051808303815f87803b158015613d4d575f80fd5b505af1158015613d5f573d5f803e3d5ffd5b5050505050505050565b5f613d748383611a8f565b613df1575f838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055613da93390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610c70565b505f610c70565b5f613e038383611a8f565b15613df1575f838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610c70565b5f818310613e6f5781611e16565b5090919050565b5f81815b8451811015613eba57613ea682868381518110613e9957613e9961441c565b6020026020010151613ec2565b915080613eb281614476565b915050613e7a565b509392505050565b5f818310613edc575f828152602084905260409020611e16565b5f838152602083905260409020611e16565b5f60208284031215613efe575f80fd5b81356001600160e01b031981168114611e16575f80fd5b6001600160a01b0381168114610c9f575f80fd5b5f60208284031215613f39575f80fd5b8135611e1681613f15565b5f8083601f840112613f54575f80fd5b50813567ffffffffffffffff811115613f6b575f80fd5b6020830191508360208260051b8501011115613f85575f80fd5b9250929050565b5f805f8060608587031215613f9f575f80fd5b84359350602085013567ffffffffffffffff811115613fbc575f80fd5b613fc887828801613f44565b9598909750949560400135949350505050565b5f60208284031215613feb575f80fd5b5035919050565b5f805f805f8060808789031215614007575f80fd5b86359550602087013567ffffffffffffffff80821115614025575f80fd5b6140318a838b01613f44565b9097509550604089013594506060890135915080821115614050575f80fd5b5061405d89828a01613f44565b979a9699509497509295939492505050565b5f8060408385031215614080575f80fd5b82359150602083013561409281613f15565b809150509250929050565b5f805f604084860312156140af575f80fd5b833567ffffffffffffffff8111156140c5575f80fd5b6140d186828701613f44565b90945092505060208401356140e581613f15565b809150509250925092565b8015158114610c9f575f80fd5b5f805f805f805f805f806101408b8d031215614117575f80fd5b8a3561412281613f15565b995060208b0135985060408b0135975060608b013561414081613f15565b965060808b0135955060a08b0135945060c08b013561415e816140f0565b8094505060e08b013592506101008b013591506101208b013590509295989b9194979a5092959850565b5f805f805f60a0868803121561419c575f80fd5b505083359560208501359550604085013594606081013594506080013592509050565b5f805f606084860312156141d1575f80fd5b83356141dc81613f15565b925060208401356141ec81613f15565b929592945050506040919091013590565b5f6020828403121561420d575f80fd5b813565ffffffffffff81168114611e16575f80fd5b5f8060408385031215614233575f80fd5b50508035926020909101359150565b5f805f60408486031215614254575f80fd5b833561425f81613f15565b9250602084013567ffffffffffffffff81111561427a575f80fd5b61428686828701613f44565b9497909650939450505050565b5f80604083850312156142a4575f80fd5b823591506020830135614092816140f0565b6001600160a01b038e81168252602082018e9052604082018d90528b166060820152610200810161430b608083018c805182526020810151602083015260408101516040830152606081015160608301525050565b6101008201999099526101208101979097529415156101408701526101608601939093526101808501919091526101a08401526101c083015215156101e09091015295945050505050565b8151815260208083015190820152604080830151908201526060808301519082015260808101610c70565b60208082526025908201527f46756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920616040820152646e20454f4160d81b606082015260800190565b602080825260159082015274135a5b9d0818dbdb999a59c818d85b98d95b1b1959605a1b604082015260600190565b634e487b7160e01b5f52601160045260245ffd5b81810381811115610c7057610c706143f5565b634e487b7160e01b5f52603260045260245ffd5b5f808335601e19843603018112614445575f80fd5b83018035915067ffffffffffffffff82111561445f575f80fd5b6020019150600581901b3603821315613f85575f80fd5b5f60018201614487576144876143f5565b5060010190565b6020808252601d908201527f436f6c6c656374696f6e206973206e6f742077686974656c6973746564000000604082015260600190565b60208082526025908201527f436172647320706572207061636b206d75737420626520677265617465722074604082015264068616e20360dc1b606082015260800190565b602080825260149082015273125b9d985b1a59081b5a5b9d10dbdb999a59d25960621b604082015260600190565b8181035f831280158383131683831282161715614557576145576143f5565b5092915050565b5f6020828403121561456e575f80fd5b8151611e16816140f0565b5f60208284031215614589575f80fd5b8151611e1681613f15565b60208082526025908201527f63616c6c657220646f6573206e6f74206f776e206f6e65206f662074686520746040820152646f6b656e7360d81b606082015260800190565b8183525f6001600160fb1b038311156145f0575f80fd5b8260051b80836020870137939093016020019392505050565b606081525f61461c6060830186886145d9565b6001600160a01b039485166020840152929093166040909101529392505050565b5f6020828403121561464d575f80fd5b5051919050565b608081525f6146676080830187896145d9565b6020830195909552506001600160a01b039283166040820152911660609091015292915050565b80820180821115610c7057610c706143f5565b634e487b7160e01b5f52604160045260245ffd5b608081525f6146c86080830187896145d9565b8281036020848101919091528651808352878201928201905f5b818110156146fe578451835293830193918301916001016146e2565b50506001600160a01b03968716604086015294909516606090930192909252509095945050505050565b65ffffffffffff818116838216019080821115614557576145576143f5565b65ffffffffffff828116828216039080821115614557576145576143f556fe8ef5424f1c624ffaf3497d04d42eccad01bfa220921befd0568048879c2a01b3a2646970667358221220d61e99a597b6a78882e99cb9860eb3b57b860bcb9ff6360278aa7afa00a7ba9664736f6c634300081400330000000000000000000000008ab15fe88a00b03724ac91ee4ee1f998064f2e310000000000000000000000003d9fa58a6fe106efdd010802758067ba37dfd8e10000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000000000000000000000000000000000000000001
Deployed Bytecode
0x608060405260043610610371575f3560e01c80638da5cb5b116101c8578063d2c69922116100fd578063e195feb91161009d578063ef4f95bd1161006d578063ef4f95bd14610bc3578063f0f4426014610be2578063f76d22fd14610c01578063fe00629f14610c20575f80fd5b8063e195feb914610a8e578063e8beb1b614610aad578063ea9a3ff414610acc578063ec69a4b714610aeb575f80fd5b8063d602b9fd116100d8578063d602b9fd14610a27578063d710076a14610a3b578063db24f40014610a5a578063e07548bd14610a79575f80fd5b8063d2c69922146109ca578063d4936dab146109e9578063d547741f14610a08575f80fd5b8063afb926b911610168578063cbbfbccf11610143578063cbbfbccf14610949578063cc8463c814610968578063cefc14291461097c578063cf6eefb714610990575f80fd5b8063afb926b9146108ec578063b83f5a421461090b578063c62cf1db1461092a575f80fd5b80639a90abc2116101a35780639a90abc214610872578063a1eda53c14610891578063a217fddf146108c4578063adb79d17146108d7575f80fd5b80638da5cb5b1461082057806391d1485414610834578063986c9b2014610853575f80fd5b80634f05cbd8116102a9578063634e93da1161024957806374675f6b1161021957806374675f6b146107b05780637bad2380146107c55780638094cee4146107e457806384ef8ffc14610803575f80fd5b8063634e93da1461073e578063649a5ec71461075d5780637164ad401461077c57806372c7242b14610791575f80fd5b806353d157221161028457806353d15722146105d457806359df4edd146105f35780635e48091b146106e857806361d027b314610707575f80fd5b80634f05cbd81461056857806350946b6614610596578063530b3e54146105b5575f80fd5b806324413f5a116103145780632f2ff15d116102ef5780632f2ff15d146104c65780632f3d9885146104e5578063304588c01461052a57806336568abe14610549575f80fd5b806324413f5a14610466578063248a9ca3146104855780632929bb1c146104b3575f80fd5b80630aa6220b1161034f5780630aa6220b146103f257806313aaf266146104065780631ff7712f1461042557806321a8dcef14610438575f80fd5b806301ffc9a714610375578063022d63fb146103a9578063037c9be2146103d1575b5f80fd5b348015610380575f80fd5b5061039461038f366004613eee565b610c4c565b60405190151581526020015b60405180910390f35b3480156103b4575f80fd5b50620697805b60405165ffffffffffff90911681526020016103a0565b3480156103dc575f80fd5b506103f06103eb366004613f29565b610c76565b005b3480156103fd575f80fd5b506103f0610c8d565b348015610411575f80fd5b506103f0610420366004613f29565b610ca2565b6103f0610433366004613f8c565b610d04565b348015610443575f80fd5b506104585f8051602061476783398151915281565b6040519081526020016103a0565b348015610471575f80fd5b50610458610480366004613fdb565b610d51565b348015610490575f80fd5b5061045861049f366004613fdb565b5f9081526020819052604090206001015490565b6103f06104c1366004613ff2565b610e5d565b3480156104d1575f80fd5b506103f06104e036600461406f565b610f6f565b3480156104f0575f80fd5b506104586104ff36600461406f565b5f8281526004602090815260408083206001600160a01b0385168452600e0190915290205492915050565b348015610535575f80fd5b506103f061054436600461409d565b610f97565b348015610554575f80fd5b506103f061056336600461406f565b610fe0565b348015610573575f80fd5b50610394610582366004613f29565b60056020525f908152604090205460ff1681565b3480156105a1575f80fd5b506103f06105b03660046140fd565b611086565b3480156105c0575f80fd5b506103f06105cf36600461406f565b61141e565b3480156105df575f80fd5b506104586105ee366004614188565b611584565b3480156105fe575f80fd5b5061067d61060d366004613fdb565b5f908152600460205260409020805460018201546002830154600384015460088501546009860154600a870154600b880154600c890154600d8a0154600f8b01546010909b01546001600160a01b039a8b169c999b989a909716989597949660ff94851696939592949193911690565b604080516001600160a01b039d8e168152602081019c909c528b0199909952999096166060890152608088019490945260a0870192909252151560c086015260e0850152610100840152610120830152610140820192909252901515610160820152610180016103a0565b3480156106f3575f80fd5b506103f06107023660046141bf565b611680565b348015610712575f80fd5b50600654610726906001600160a01b031681565b6040516001600160a01b0390911681526020016103a0565b348015610749575f80fd5b506103f0610758366004613f29565b611748565b348015610768575f80fd5b506103f06107773660046141fd565b61175b565b348015610787575f80fd5b5061045860085481565b34801561079c575f80fd5b506103f06107ab366004614222565b61176e565b3480156107bb575f80fd5b50610458600b5481565b3480156107d0575f80fd5b506103f06107df366004614242565b611857565b3480156107ef575f80fd5b506103f06107fe36600461409d565b611a67565b34801561080e575f80fd5b506002546001600160a01b0316610726565b34801561082b575f80fd5b50610726611a77565b34801561083f575f80fd5b5061039461084e36600461406f565b611a8f565b34801561085e575f80fd5b50600754610726906001600160a01b031681565b34801561087d575f80fd5b506103f061088c366004614188565b611ab7565b34801561089c575f80fd5b506108a5611d0d565b6040805165ffffffffffff9384168152929091166020830152016103a0565b3480156108cf575f80fd5b506104585f81565b3480156108e2575f80fd5b50610458600a5481565b3480156108f7575f80fd5b506103f0610906366004613fdb565b611d5f565b348015610916575f80fd5b506103f0610925366004613fdb565b611d7f565b348015610935575f80fd5b50610458610944366004614222565b611e06565b348015610954575f80fd5b506103f0610963366004614222565b611e1d565b348015610973575f80fd5b506103ba611ec4565b348015610987575f80fd5b506103f0611f22565b34801561099b575f80fd5b506109a4611f61565b604080516001600160a01b03909316835265ffffffffffff9091166020830152016103a0565b3480156109d5575f80fd5b506103f06109e4366004613fdb565b611f82565b3480156109f4575f80fd5b506103f0610a03366004613f29565b611fa2565b348015610a13575f80fd5b506103f0610a2236600461406f565b611fff565b348015610a32575f80fd5b506103f0612027565b348015610a46575f80fd5b506103f0610a55366004614222565b612039565b348015610a65575f80fd5b506103f0610a7436600461409d565b6120ff565b348015610a84575f80fd5b5061045860095481565b348015610a99575f80fd5b506103f0610aa8366004614222565b6123e3565b348015610ab8575f80fd5b506103f0610ac7366004614293565b612490565b348015610ad7575f80fd5b506103f0610ae6366004614222565b612544565b348015610af6575f80fd5b50610baa610b05366004613fdb565b600460208181525f928352604092839020805460018201546002830154600384015487516080810189529685015487526005850154958701959095526006840154968601969096526007830154606086015260088301546009840154600a850154600b860154600c870154600d880154600f8901546010909901546001600160a01b039889169c979b979a9098169896979596949560ff94851695939492939192168d565b6040516103a09d9c9b9a999897969594939291906142b6565b348015610bce575f80fd5b506103f0610bdd366004613fdb565b6125eb565b348015610bed575f80fd5b506103f0610bfc366004613f29565b61260b565b348015610c0c575f80fd5b506103f0610c1b366004614222565b61261e565b348015610c2b575f80fd5b50610c3f610c3a366004613fdb565b612720565b6040516103a09190614356565b5f6001600160e01b031982166318a4c3c360e11b1480610c705750610c70826127d2565b92915050565b5f610c8081612806565b610c8982612810565b5050565b5f610c9781612806565b610c9f6128cc565b50565b5f610cac81612806565b6001600160a01b0382165f81815260056020908152604091829020805460ff1916905590519182527fed3eb8d0fbd0827cb7352b2abfeab8e86a413218ac1a55e47044db2c764ec1de91015b60405180910390a15050565b610d0c6128d8565b333214610d345760405162461bcd60e51b8152600401610d2b90614381565b60405180910390fd5b610d418484848433612902565b610d4b6001600355565b50505050565b5f818152600460205260408120601081015460ff1615610d835760405162461bcd60e51b8152600401610d2b906143c6565b60048101545f03610d98576008015492915050565b60408051608081018252600483015481526005830154602082015260068301549181019190915260078201546060820152600c8201545f90610dda9042614409565b1015610e1c5760405162461bcd60e51b81526020600482015260116024820152700494e56414c49445f54494d455354414d5607c1b6044820152606401610d2b565b610e55610e3f83600c015442038360600151670de0b6b3a7640000919091020490565b600f840154835160208501516040860151611584565b949350505050565b610e656128d8565b333214610e845760405162461bcd60e51b8152600401610d2b90614381565b5f80516020614767833981519152610e9b81612806565b848214610eea5760405162461bcd60e51b815260206004820152601c60248201527f6d65726b6c6550726f6f6673206c656e677468206d69736d61746368000000006044820152606401610d2b565b5f5b82811015610f5b57610f4988888884818110610f0a57610f0a61441c565b9050602002810190610f1c9190614430565b88888887818110610f2f57610f2f61441c565b9050602002016020810190610f449190613f29565b612902565b80610f5381614476565b915050610eec565b5050610f676001600355565b505050505050565b81610f8d57604051631fe1e13d60e11b815260040160405180910390fd5b610c898282612cc9565b5f5b82811015610d4b57610fce848483818110610fb657610fb661441c565b9050602002810190610fc89190614430565b84612ced565b80610fd881614476565b915050610f99565b81158015610ffb57506002546001600160a01b038281169116145b1561107c575f8061100a611f61565b90925090506001600160a01b03821615158061102c575065ffffffffffff8116155b8061103f57504265ffffffffffff821610155b15611067576040516319ca5ebb60e01b815265ffffffffffff82166004820152602401610d2b565b50506001805465ffffffffffff60a01b191690555b610c89828261305d565b5f8051602061476783398151915261109d81612806565b6001600160a01b038b165f9081526005602052604090205460ff166110d45760405162461bcd60e51b8152600401610d2b9061448e565b6001600160a01b038b1661112a5760405162461bcd60e51b815260206004820181905260248201527f436f6c6c656374696f6e20616464726573732063616e6e6f74206265203078306044820152606401610d2b565b5f8a116111495760405162461bcd60e51b8152600401610d2b906144c5565b5f89116111985760405162461bcd60e51b815260206004820181905260248201527f4d6178207061636b73206d7573742062652067726561746572207468616e20306044820152606401610d2b565b428310156111fd5760405162461bcd60e51b815260206004820152602c60248201527f4d696e74206d75737420737461727420696d6d6564696174656c79206f72206960448201526b6e207468652066757475726560a01b6064820152608401610d2b565b81158061120957508282115b6112555760405162461bcd60e51b815260206004820152601b60248201527f696e76616c69642065787069726174696f6e54696d657374616d7000000000006044820152606401610d2b565b84156112a0575f8490036112a05760405162461bcd60e51b81526020600482015260126024820152711b5a5cdcda5b99c81b595c9adb19549bdbdd60721b6044820152606401610d2b565b5f60045f60085481526020019081526020015f2090508b815f015f6101000a8154816001600160a01b0302191690836001600160a01b031602179055508a816001018190555089816002018190555088816003015f6101000a8154816001600160a01b0302191690836001600160a01b031602179055508781600801819055508681600901819055508581600a015f6101000a81548160ff0219169083151502179055508481600b01819055508381600c01819055508281600d01819055507f3bd6fc9da878be6bf571677edfa7b0915b71fcfe8fe71694926a70877d58cbbd6008548d8d8d8d8d8d8d8d8c6040516113f49a99989796959493929190998a526001600160a01b0398891660208b015260408a0197909752606089019590955292909516608087015260a086015260c085019390935291151560e08401526101008301919091526101208201526101400190565b60405180910390a160088054905f61140b83614476565b9190505550505050505050505050505050565b5f8051602061476783398151915261143581612806565b6001600160a01b0382165f9081526005602052604090205460ff1661146c5760405162461bcd60e51b8152600401610d2b9061448e565b600854831061148d5760405162461bcd60e51b8152600401610d2b9061450a565b6001600160a01b0382166114f65760405162461bcd60e51b815260206004820152602a60248201527f436f6c6c656374696f6e20616464726573732063616e6e6f7420746865207a65604482015269726f206164647265737360b01b6064820152608401610d2b565b5f838152600460205260409020601081015460ff16156115285760405162461bcd60e51b8152600401610d2b906143c6565b80546001600160a01b0319166001600160a01b03841690811782556040805186815260208101929092527fdf8345206ccfa90b2c8a9cecdf64f8fab8528fd37482a5258f1371c27a9374db91015b60405180910390a150505050565b5f8084136115cc5760405162461bcd60e51b81526020600482015260156024820152744e6f6e207a65726f2074617267657420707269636560581b6044820152606401610d2b565b5f6115e76115e285670de0b6b3a7640000614538565b613090565b90505f81126116385760405162461bcd60e51b815260206004820152601b60248201527f4e4f4e5f4e454741544956455f44454341595f434f4e5354414e5400000000006044820152606401610d2b565b6116758561167061166b8461165a670de0b6b3a764000060018d010289611e06565b8c03670de0b6b3a764000091020590565b6132c6565b61346c565b979650505050505050565b5f61168a81612806565b6001600160a01b0384166116d1576040516001600160a01b0384169083156108fc029084905f818181858888f193505050501580156116cb573d5f803e3d5ffd5b50610d4b565b60405163a9059cbb60e01b81526001600160a01b0384811660048301526024820184905285169063a9059cbb906044016020604051808303815f875af115801561171d573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611741919061455e565b5050505050565b5f61175281612806565b610c8982613490565b5f61176581612806565b610c8982613502565b5f8051602061476783398151915261178581612806565b60085483106117a65760405162461bcd60e51b8152600401610d2b9061450a565b816117e85760405162461bcd60e51b8152602060048201526012602482015271125b9d985b1a59081b595c9adb19549bdbdd60721b6044820152606401610d2b565b5f838152600460205260409020601081015460ff161561181a5760405162461bcd60e51b8152600401610d2b906143c6565b600b810183905560408051858152602081018590527f072c8a8b58331ede3802b3e5878f1fa116fefdcda23bf24cca9471c893621a809101611576565b806118985760405162461bcd60e51b81526020600482015260116024820152703737903a37b5b2b739903a3790313ab93760791b6044820152606401610d2b565b6001600160a01b0383165f9081526005602052604090205460ff166118cf5760405162461bcd60e51b8152600401610d2b9061448e565b5f5b81811015611a2457336001600160a01b038516636352211e8585858181106118fb576118fb61441c565b905060200201356040518263ffffffff1660e01b815260040161192091815260200190565b602060405180830381865afa15801561193b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061195f9190614579565b6001600160a01b0316146119855760405162461bcd60e51b8152600401610d2b90614594565b6007546001600160a01b0316634a439be2858585858181106119a9576119a961441c565b6040516001600160e01b031960e087901b1681526001600160a01b03909416600485015260200291909101356024830152503360448201526064015f604051808303815f87803b1580156119fb575f80fd5b505af1158015611a0d573d5f803e3d5ffd5b505050508080611a1c90614476565b9150506118d1565b507fc4b3faa7066f8b9faaceeddc5db478efb445eb5d75577d78b720af049d8b1cad82828533604051611a5a9493929190614609565b60405180910390a1505050565b611a72838383612ced565b505050565b5f611a8a6002546001600160a01b031690565b905090565b5f918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b5f80516020614767833981519152611ace81612806565b6008548610611aef5760405162461bcd60e51b8152600401610d2b9061450a565b5f8513611b365760405162461bcd60e51b81526020600482015260156024820152744e6f6e207a65726f2074617267657420707269636560581b6044820152606401610d2b565b5f8213611b855760405162461bcd60e51b815260206004820152601e60248201527f4e6f6e207a65726f207365636f6e6473207065722074696d6520756e697400006044820152606401610d2b565b5f611b9b6115e286670de0b6b3a7640000614538565b90505f8112611bec5760405162461bcd60e51b815260206004820152601b60248201527f4e4f4e5f4e454741544956455f44454341595f434f4e5354414e5400000000006044820152606401610d2b565b5f878152600460205260409020601081015460ff1615611c1e5760405162461bcd60e51b8152600401610d2b906143c6565b60038101546001600160a01b0316611c785760405162461bcd60e51b815260206004820152601b60248201527f5061796d656e7420746f6b656e2063616e6e6f742062652045544800000000006044820152606401610d2b565b604080516080808201835289825260208083018a90528284018990526060808401899052600486018c9055600586018b9055600686018a9055600786018990555f600887015584518d81529182018c90529381018a905292830188905290917f423aa27bc299bbc06e5c7096e9f4175abf43cfd355a3818ad30272249e99d3d8910160405180910390a1505050505050505050565b6002545f90600160d01b900465ffffffffffff168015158015611d3857504265ffffffffffff821610155b611d43575f80611d57565b600254600160a01b900465ffffffffffff16815b915091509091565b5f80516020614767833981519152611d7681612806565b610c898261356a565b5f80516020614767833981519152611d9681612806565b6008548210611db75760405162461bcd60e51b8152600401610d2b9061450a565b5f828152600460205260409081902060108101805460ff1916600117905590517f4b7de56f7dce4603dc3acec6390b6a16fbb140cea6fb3d7c36330a0e9e0c46b490611a5a9085815260200190565b5f670de0b6b3a764000083028290055b9392505050565b5f80516020614767833981519152611e3481612806565b6008548310611e555760405162461bcd60e51b8152600401610d2b9061450a565b5f838152600460205260409020601081015460ff1615611e875760405162461bcd60e51b8152600401610d2b906143c6565b600d810183905560408051858152602081018590527fbeab984f1dc2d5aa105ed4c4b4dd460009b20254dd62c43c38573a7edacbe1ef9101611576565b6002545f90600160d01b900465ffffffffffff168015158015611eee57504265ffffffffffff8216105b611f0957600154600160d01b900465ffffffffffff16611f1c565b600254600160a01b900465ffffffffffff165b91505090565b5f611f2b611f61565b509050336001600160a01b03821614611f5957604051636116401160e11b8152336004820152602401610d2b565b610c9f613607565b6001546001600160a01b03811691600160a01b90910465ffffffffffff1690565b5f80516020614767833981519152611f9981612806565b610c898261369d565b5f611fac81612806565b6001600160a01b0382165f81815260056020908152604091829020805460ff1916600117905590519182527f76e6d03d02c9b0a17e526874d022dad842ea72d3f29bb68e3c69647728c796119101610cf8565b8161201d57604051631fe1e13d60e11b815260040160405180910390fd5b610c898282613732565b5f61203181612806565b610c9f613756565b5f8051602061476783398151915261205081612806565b60085483106120715760405162461bcd60e51b8152600401610d2b9061450a565b5f82116120905760405162461bcd60e51b8152600401610d2b906144c5565b5f838152600460205260409020601081015460ff16156120c25760405162461bcd60e51b8152600401610d2b906143c6565b6001810183905560408051858152602081018590527fa1acab56cf4ced33302c9431597fc5d28ac4fca19efb1cc8a171c771dba04a069101611576565b6001600160a01b0381165f9081526005602052604090205460ff166121365760405162461bcd60e51b8152600401610d2b9061448e565b60095482146121915760405162461bcd60e51b815260206004820152602160248201527f77726f6e6720616d6f756e74206f6620636172647320746f206c6576656c20756044820152600760fc1b6064820152608401610d2b565b5f5b6009548110156122e857336001600160a01b038316636352211e8686858181106121bf576121bf61441c565b905060200201356040518263ffffffff1660e01b81526004016121e491815260200190565b602060405180830381865afa1580156121ff573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906122239190614579565b6001600160a01b0316146122495760405162461bcd60e51b8152600401610d2b90614594565b6007546001600160a01b0316634a439be28386868581811061226d5761226d61441c565b6040516001600160e01b031960e087901b1681526001600160a01b03909416600485015260200291909101356024830152503360448201526064015f604051808303815f87803b1580156122bf575f80fd5b505af11580156122d1573d5f803e3d5ffd5b5050505080806122e090614476565b915050612193565b505f816001600160a01b031663d082e3816040518163ffffffff1660e01b8152600401602060405180830381865afa158015612326573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061234a919061463d565b600754604051630bca392b60e01b81526001600160a01b038581166004830152336024830152929350911690630bca392b906044015f604051808303815f87803b158015612396575f80fd5b505af11580156123a8573d5f803e3d5ffd5b505050507fb896ef750ff1f78e491078417b01c8e59749b5eaa5d5531af12b01c7571a7f068484838533604051611576959493929190614654565b5f805160206147678339815191526123fa81612806565b600854831061241b5760405162461bcd60e51b8152600401610d2b9061450a565b5f838152600460205260409020601081015460ff161561244d5760405162461bcd60e51b8152600401610d2b906143c6565b600881018390555f600482015560408051858152602081018590527f2fafd57e08d8354f063b7425ce0c99715a1b869195c89039f74ecbbc7734695b9101611576565b5f805160206147678339815191526124a781612806565b60085483106124c85760405162461bcd60e51b8152600401610d2b9061450a565b5f838152600460205260409020601081015460ff16156124fa5760405162461bcd60e51b8152600401610d2b906143c6565b600a8101805460ff19168415159081179091556040805186815260208101929092527fd85a5e0cc24db438d24ee692c8d95fac67ed5f10cbb454fac53588b37231ed709101611576565b5f8051602061476783398151915261255b81612806565b600854831061257c5760405162461bcd60e51b8152600401610d2b9061450a565b5f838152600460205260409020601081015460ff16156125ae5760405162461bcd60e51b8152600401610d2b906143c6565b6009810183905560408051858152602081018590527f5dfd62351ab4b8f586b4456d11d85abae1d24ae10af9d0e2f3bae3e5abe0b0f09101611576565b5f8051602061476783398151915261260281612806565b610c8982613760565b5f61261581612806565b610c89826137fb565b5f8051602061476783398151915261263581612806565b60085483106126565760405162461bcd60e51b8152600401610d2b9061450a565b5f82116126b15760405162461bcd60e51b8152602060048201526024808201527f4d6178696d756d207061636b73206d75737420626520677265617465722074686044820152630616e20360e41b6064820152608401610d2b565b5f838152600460205260409020601081015460ff16156126e35760405162461bcd60e51b8152600401610d2b906143c6565b6002810183905560408051858152602081018590527f650f59bb42f63a7aca7d5df32553c73394e169ebf1ccd297814882ffc9b0fbd39101611576565b61274760405180608001604052805f81526020015f81526020015f81526020015f81525090565b5f82815260046020526040902060088101541561279a5760405162461bcd60e51b8152602060048201526011602482015270159491d110481b9bdd08195b98589b1959607a1b6044820152606401610d2b565b604080516080810182526004830154815260058301546020820152600683015491810191909152600790910154606082015292915050565b5f6001600160e01b03198216637965db0b60e01b1480610c7057506301ffc9a760e01b6001600160e01b0319831614610c70565b610c9f813361389f565b6001600160a01b0381166128775760405162461bcd60e51b815260206004820152602860248201527f457865637574696f6e2064656c656761746520616464726573732063616e6e6f604482015267074206265203078360c41b6064820152608401610d2b565b600780546001600160a01b0319166001600160a01b0383169081179091556040519081527ff9a0f356a7ef079355de09d32ce45cc3cfabc8f118681c19a17501f005a376ac906020015b60405180910390a150565b6128d65f806138d8565b565b6002600354036128fb57604051633ee5aeb560e01b815260040160405180910390fd5b6002600355565b5f858152600460205260409020600c8101544210156129635760405162461bcd60e51b815260206004820152601760248201527f4d696e7420636f6e666967206e6f7420737461727465640000000000000000006044820152606401610d2b565b600d810154158061297757504281600d0154115b6129b95760405162461bcd60e51b8152602060048201526013602482015272135a5b9d0818dbdb999a59c8195e1c1a5c9959606a1b6044820152606401610d2b565b601081015460ff16156129de5760405162461bcd60e51b8152600401610d2b906143c6565b600a81015460ff1615806129fd57506129fd81600b0154868685613997565b612a405760405162461bcd60e51b8152602060048201526014602482015273155cd95c881b9bdd081dda1a5d195b1a5cdd195960621b6044820152606401610d2b565b60098101541580612a6d575060098101546001600160a01b0383165f908152600e83016020526040902054105b612ab95760405162461bcd60e51b815260206004820152601b60248201527f557365722072656163686564206d6178206d696e74206c696d697400000000006044820152606401610d2b565b80600f0154816002015411612b005760405162461bcd60e51b815260206004820152600d60248201526c139bc81c1858dadcc81b19599d609a1b6044820152606401610d2b565b5f612b0a87610d51565b905083811115612b4d5760405162461bcd60e51b815260206004820152600e60248201526d0a0e4d2c6ca40e8dede40d0d2ced60931b6044820152606401610d2b565b600182600f015f828254612b61919061468e565b90915550506001600160a01b0383165f908152600e830160205260408120805460019290612b9090849061468e565b90915550506003820154600654612bb6916001600160a01b039081169186911684613a1b565b81546040805163d082e38160e01b815290515f926001600160a01b03169163d082e3819160048083019260209291908290030181865afa158015612bfc573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612c20919061463d565b83546001850154919250612c40916001600160a01b039091169086613a7b565b7f7a7be958aedb09208ae6ed49fc0841ccb7f951498c9afc1c2bfa4abbd0e3ff82888585600f0154846001886001015487612c7b919061468e565b612c859190614409565b604080519586526001600160a01b039094166020860152928401919091526060830152608082015260a0810184905260c00160405180910390a15050505050505050565b5f82815260208190526040902060010154612ce381612806565b610d4b8383613afa565b6001600160a01b0381165f9081526005602052604090205460ff16612d245760405162461bcd60e51b8152600401610d2b9061448e565b600a548214612d855760405162461bcd60e51b815260206004820152602760248201527f77726f6e6720616d6f756e74206f6620636172647320746f2064726177206e656044820152667720636172647360c81b6064820152608401610d2b565b5f5b600a54811015612edc57336001600160a01b038316636352211e868685818110612db357612db361441c565b905060200201356040518263ffffffff1660e01b8152600401612dd891815260200190565b602060405180830381865afa158015612df3573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612e179190614579565b6001600160a01b031614612e3d5760405162461bcd60e51b8152600401610d2b90614594565b6007546001600160a01b0316634a439be283868685818110612e6157612e6161441c565b6040516001600160e01b031960e087901b1681526001600160a01b03909416600485015260200291909101356024830152503360448201526064015f604051808303815f87803b158015612eb3575f80fd5b505af1158015612ec5573d5f803e3d5ffd5b505050508080612ed490614476565b915050612d87565b505f600b5467ffffffffffffffff811115612ef957612ef96146a1565b604051908082528060200260200182016040528015612f22578160200160208202803683370190505b5090505f5b600b54811015613025575f836001600160a01b031663d082e3816040518163ffffffff1660e01b8152600401602060405180830381865afa158015612f6e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612f92919061463d565b600754604051630bca392b60e01b81526001600160a01b038781166004830152336024830152929350911690630bca392b906044015f604051808303815f87803b158015612fde575f80fd5b505af1158015612ff0573d5f803e3d5ffd5b50505050808383815181106130075761300761441c565b6020908102919091010152508061301d81614476565b915050612f27565b507f8dc8de2032cffee9bedeca71a9cc32b78ac0a64716331eb90aaf5592ca40383b84848385336040516115769594939291906146b5565b6001600160a01b03811633146130865760405163334bd91960e11b815260040160405180910390fd5b611a728282613b60565b5f8082136130cc5760405162461bcd60e51b815260206004820152600960248201526815539111519253915160ba1b6044820152606401610d2b565b5060606fffffffffffffffffffffffffffffffff821160071b82811c67ffffffffffffffff1060061b1782811c63ffffffff1060051b1782811c61ffff1060041b1782811c60ff10600390811b90911783811c600f1060021b1783811c909110600190811b90911783811c90911017609f81810383019390931b90921c6c465772b2bbbb5f824b15207a3081018102821d6d0388eaa27412d5aca026815d636e018102821d6d0df99ac502031bf953eff472fdcc018102821d6d13cdffb29d51d99322bdff5f2211018102821d6d0a0f742023def783a307a986912e018102821d6d01920d8043ca89b5239253284e42018102821d6c0b7a86d7375468fac667a0a527016c29508e458543d8aa4df2abee7882018202831d6d0139601a2efabe717e604cbb4894018202831d6d02247f7a7b6594320649aa03aba1018202831d6c8c3f38e95a6b1ff2ab1c3b343619018202831d6d02384773bdf1ac5676facced60901901820290921d6cb9a025d814b29c212b8b1a07cd190102780a09507084cc699bb0e71ea869ffffffffffffffffffffffff190105711340daa0d5f769dba1915cef59f0815a550602605f19919091017d0267a36c0c95b3975ab3ee5b203a7614a3f75373f047d803ae7b6687f2b302017d57115e47018c7177eebf7cd370a3356a1b7863008a5ae8028c72b88642840160ae1d90565b5f680248ce36a70cb26b3e1982136132df57505f919050565b680755bf798b4a1bf1e582126133265760405162461bcd60e51b815260206004820152600c60248201526b4558505f4f564552464c4f5760a01b6044820152606401610d2b565b6503782dace9d9604e83901b0591505f60606bb17217f7d1cf79abc9e3b39884821b056001605f1b01901d6bb17217f7d1cf79abc9e3b39881029093036c240c330e9fb2d9cbaf0fd5aafb1981018102606090811d6d0277594991cfc85f6e2461837cd9018202811d6d1a521255e34f6a5061b25ef1c9c319018202811d6db1bbb201f443cf962f1a1d3db4a5018202811d6e02c72388d9f74f51a9331fed693f1419018202811d6e05180bb14799ab47a8a8cb2a527d57016d02d16720577bd19bf614176fe9ea6c10fe68e7fd37d0007b713f765084018402831d9081019084016d01d3967ed30fc4f89c02bab5708119010290911d6e0587f503bb6ea29d25fcb740196450019091026d360d7aeea093263ecc6e0ecb291760621b010574029d9dc38563c32e5c2f6dc192ee70ef65f9978af30260c3939093039290921c92915050565b818102821583820583141761347f575f80fd5b670de0b6b3a7640000900592915050565b5f613499611ec4565b6134a242613b9c565b6134ac9190614728565b90506134b88282613bd2565b60405165ffffffffffff821681526001600160a01b038316907f3377dc44241e779dd06afab5b788a35ca5f3b778836e2990bdb26a2a4b2e5ed69060200160405180910390a25050565b5f61350c82613c4f565b61351542613b9c565b61351f9190614728565b905061352b82826138d8565b6040805165ffffffffffff8085168252831660208201527ff1038c18cf84a56e432fdbfaf746924b7ea511dfe03a6506a0ceba4888788d9b9101610cf8565b5f81116135d25760405162461bcd60e51b815260206004820152603060248201527f63617264735265717569726564546f4275726e546f44726177206d757374206260448201526f0652067726561746572207468616e20360841b6064820152608401610d2b565b600a8190556040518181527f08e1b3eae26eb58425aa569f65f68f6a673e3a6114c985032899b41808591dcd906020016128c1565b5f80613611611f61565b915091506136268165ffffffffffff16151590565b158061363a57504265ffffffffffff821610155b15613662576040516319ca5ebb60e01b815265ffffffffffff82166004820152602401610d2b565b61367d5f6136786002546001600160a01b031690565b613b60565b506136885f83613afa565b5050600180546001600160d01b031916905550565b5f81116136fd5760405162461bcd60e51b815260206004820152602860248201527f6361726473447261776e5065724275726e206d75737420626520677265617465604482015267072207468616e20360c41b6064820152608401610d2b565b600b8190556040518181527fff9d1a7760c4901a5731a4921b0e6413ebfcb1ec08559be9d51c2bdb77f2daf3906020016128c1565b5f8281526020819052604090206001015461374c81612806565b610d4b8383613b60565b6128d65f80613bd2565b5f81116137c65760405162461bcd60e51b815260206004820152602e60248201527f63617264735265717569726564466f724c6576656c5570206d7573742062652060448201526d067726561746572207468616e20360941b6064820152608401610d2b565b60098190556040518181527f74108c1b435472b4b951929da5941e47e341e8be74a4e47d56de096fd48ead4d906020016128c1565b6001600160a01b0381166138515760405162461bcd60e51b815260206004820152601e60248201527f547265617375727920616464726573732063616e6e6f742062652030783000006044820152606401610d2b565b600680546001600160a01b0319166001600160a01b0383169081179091556040519081527fafa147634b29e2c7bd53ce194256b9f41cfb9ba3036f2b822fdd1d965beea086906020016128c1565b6138a98282611a8f565b610c895760405163e2517d3f60e01b81526001600160a01b038216600482015260248101839052604401610d2b565b600254600160d01b900465ffffffffffff16801561395a574265ffffffffffff8216101561393157600254600180546001600160d01b0316600160a01b90920465ffffffffffff16600160d01b0291909117905561395a565b6040517f2b1fa2edafe6f7b9e97c1a9e0c3660e645beb2dcaa2d45bdbf9beaf5472e1ec5905f90a15b50600280546001600160a01b0316600160a01b65ffffffffffff948516026001600160d01b031617600160d01b9290931691909102919091179055565b6040516bffffffffffffffffffffffff19606083901b1660208201525f908190603401604051602081830303815290604052805190602001209050613a118585808060200260200160405190810160405280939291908181526020018383602002808284375f920191909152508a9250859150613c969050565b9695505050505050565b6001600160a01b038416613a6f57803414613a6f5760405162461bcd60e51b8152602060048201526014602482015273125b98dbdc9c9958dd0811551208185b5bdd5b9d60621b6044820152606401610d2b565b610d4b84848484613cab565b5f5b82811015610d4b57600754604051630bca392b60e01b81526001600160a01b038681166004830152848116602483015290911690630bca392b906044015f604051808303815f87803b158015613ad1575f80fd5b505af1158015613ae3573d5f803e3d5ffd5b505050508080613af290614476565b915050613a7d565b5f82613b56575f613b136002546001600160a01b031690565b6001600160a01b031614613b3a57604051631fe1e13d60e11b815260040160405180910390fd5b600280546001600160a01b0319166001600160a01b0384161790555b611e168383613d69565b5f82158015613b7c57506002546001600160a01b038381169116145b15613b9257600280546001600160a01b03191690555b611e168383613df8565b5f65ffffffffffff821115613bce576040516306dfcc6560e41b81526030600482015260248101839052604401610d2b565b5090565b5f613bdb611f61565b6001805465ffffffffffff8616600160a01b026001600160d01b03199091166001600160a01b038816171790559150613c1d90508165ffffffffffff16151590565b15611a72576040517f8886ebfc4259abdbc16601dd8fb5678e54878f47b3c34836cfc51154a9605109905f90a1505050565b5f80613c59611ec4565b90508065ffffffffffff168365ffffffffffff1611613c8157613c7c8382614747565b611e16565b611e1665ffffffffffff841662069780613e61565b5f82613ca28584613e76565b14949350505050565b8015610d4b576001600160a01b038416613cf2576040516001600160a01b0383169082156108fc029083905f818181858888f193505050501580156116cb573d5f803e3d5ffd5b60075460405163368fa33960e21b81526001600160a01b03868116600483015285811660248301528481166044830152606482018490529091169063da3e8ce4906084015f604051808303815f87803b158015613d4d575f80fd5b505af1158015613d5f573d5f803e3d5ffd5b5050505050505050565b5f613d748383611a8f565b613df1575f838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055613da93390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610c70565b505f610c70565b5f613e038383611a8f565b15613df1575f838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610c70565b5f818310613e6f5781611e16565b5090919050565b5f81815b8451811015613eba57613ea682868381518110613e9957613e9961441c565b6020026020010151613ec2565b915080613eb281614476565b915050613e7a565b509392505050565b5f818310613edc575f828152602084905260409020611e16565b5f838152602083905260409020611e16565b5f60208284031215613efe575f80fd5b81356001600160e01b031981168114611e16575f80fd5b6001600160a01b0381168114610c9f575f80fd5b5f60208284031215613f39575f80fd5b8135611e1681613f15565b5f8083601f840112613f54575f80fd5b50813567ffffffffffffffff811115613f6b575f80fd5b6020830191508360208260051b8501011115613f85575f80fd5b9250929050565b5f805f8060608587031215613f9f575f80fd5b84359350602085013567ffffffffffffffff811115613fbc575f80fd5b613fc887828801613f44565b9598909750949560400135949350505050565b5f60208284031215613feb575f80fd5b5035919050565b5f805f805f8060808789031215614007575f80fd5b86359550602087013567ffffffffffffffff80821115614025575f80fd5b6140318a838b01613f44565b9097509550604089013594506060890135915080821115614050575f80fd5b5061405d89828a01613f44565b979a9699509497509295939492505050565b5f8060408385031215614080575f80fd5b82359150602083013561409281613f15565b809150509250929050565b5f805f604084860312156140af575f80fd5b833567ffffffffffffffff8111156140c5575f80fd5b6140d186828701613f44565b90945092505060208401356140e581613f15565b809150509250925092565b8015158114610c9f575f80fd5b5f805f805f805f805f806101408b8d031215614117575f80fd5b8a3561412281613f15565b995060208b0135985060408b0135975060608b013561414081613f15565b965060808b0135955060a08b0135945060c08b013561415e816140f0565b8094505060e08b013592506101008b013591506101208b013590509295989b9194979a5092959850565b5f805f805f60a0868803121561419c575f80fd5b505083359560208501359550604085013594606081013594506080013592509050565b5f805f606084860312156141d1575f80fd5b83356141dc81613f15565b925060208401356141ec81613f15565b929592945050506040919091013590565b5f6020828403121561420d575f80fd5b813565ffffffffffff81168114611e16575f80fd5b5f8060408385031215614233575f80fd5b50508035926020909101359150565b5f805f60408486031215614254575f80fd5b833561425f81613f15565b9250602084013567ffffffffffffffff81111561427a575f80fd5b61428686828701613f44565b9497909650939450505050565b5f80604083850312156142a4575f80fd5b823591506020830135614092816140f0565b6001600160a01b038e81168252602082018e9052604082018d90528b166060820152610200810161430b608083018c805182526020810151602083015260408101516040830152606081015160608301525050565b6101008201999099526101208101979097529415156101408701526101608601939093526101808501919091526101a08401526101c083015215156101e09091015295945050505050565b8151815260208083015190820152604080830151908201526060808301519082015260808101610c70565b60208082526025908201527f46756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920616040820152646e20454f4160d81b606082015260800190565b602080825260159082015274135a5b9d0818dbdb999a59c818d85b98d95b1b1959605a1b604082015260600190565b634e487b7160e01b5f52601160045260245ffd5b81810381811115610c7057610c706143f5565b634e487b7160e01b5f52603260045260245ffd5b5f808335601e19843603018112614445575f80fd5b83018035915067ffffffffffffffff82111561445f575f80fd5b6020019150600581901b3603821315613f85575f80fd5b5f60018201614487576144876143f5565b5060010190565b6020808252601d908201527f436f6c6c656374696f6e206973206e6f742077686974656c6973746564000000604082015260600190565b60208082526025908201527f436172647320706572207061636b206d75737420626520677265617465722074604082015264068616e20360dc1b606082015260800190565b602080825260149082015273125b9d985b1a59081b5a5b9d10dbdb999a59d25960621b604082015260600190565b8181035f831280158383131683831282161715614557576145576143f5565b5092915050565b5f6020828403121561456e575f80fd5b8151611e16816140f0565b5f60208284031215614589575f80fd5b8151611e1681613f15565b60208082526025908201527f63616c6c657220646f6573206e6f74206f776e206f6e65206f662074686520746040820152646f6b656e7360d81b606082015260800190565b8183525f6001600160fb1b038311156145f0575f80fd5b8260051b80836020870137939093016020019392505050565b606081525f61461c6060830186886145d9565b6001600160a01b039485166020840152929093166040909101529392505050565b5f6020828403121561464d575f80fd5b5051919050565b608081525f6146676080830187896145d9565b6020830195909552506001600160a01b039283166040820152911660609091015292915050565b80820180821115610c7057610c706143f5565b634e487b7160e01b5f52604160045260245ffd5b608081525f6146c86080830187896145d9565b8281036020848101919091528651808352878201928201905f5b818110156146fe578451835293830193918301916001016146e2565b50506001600160a01b03968716604086015294909516606090930192909252509095945050505050565b65ffffffffffff818116838216019080821115614557576145576143f5565b65ffffffffffff828116828216039080821115614557576145576143f556fe8ef5424f1c624ffaf3497d04d42eccad01bfa220921befd0568048879c2a01b3a2646970667358221220d61e99a597b6a78882e99cb9860eb3b57b860bcb9ff6360278aa7afa00a7ba9664736f6c63430008140033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000008ab15fe88a00b03724ac91ee4ee1f998064f2e310000000000000000000000003d9fa58a6fe106efdd010802758067ba37dfd8e10000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000000000000000000000000000000000000000001
-----Decoded View---------------
Arg [0] : _treasury (address): 0x8Ab15fE88a00b03724aC91EE4eE1f998064F2e31
Arg [1] : _executionDelegate (address): 0x3D9FA58a6fe106efDD010802758067Ba37DfD8e1
Arg [2] : _cardsRequiredForLevelUp (uint256): 5
Arg [3] : _cardsRequiredForBurnToDraw (uint256): 15
Arg [4] : _cardsDrawnPerBurn (uint256): 1
-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 0000000000000000000000008ab15fe88a00b03724ac91ee4ee1f998064f2e31
Arg [1] : 0000000000000000000000003d9fa58a6fe106efdd010802758067ba37dfd8e1
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [3] : 000000000000000000000000000000000000000000000000000000000000000f
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000001
Loading...
Loading
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.