Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Source Code Verified (Exact Match)
Contract Name:
WLBoxShop
Compiler Version
v0.8.18+commit.87f61d96
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.18; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/cryptography/MerkleProofUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "./IWLBox.sol"; import "./WLVerify.sol"; /** * @dev WLBoxShop is a shop contract selling various boxes * Those box NFTs will be used to claim part NFTs */ contract WLBoxShop is WLVerify, AccessControlUpgradeable, UUPSUpgradeable, ReentrancyGuardUpgradeable { /** * @dev Roles * DEFAULT_ADMIN_ROLE * - can update role of each account * * OPERATOR_ROLE * - can enable/disable shopEnabled * - can update allow list * - can update box settings * * RESERVE_MINTER_ROLE * - can call mintReservedBox function * * DEPLOYER_ROLE * - can update the logic contract */ bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR_ROLE"); bytes32 public constant RESERVE_MINTER_ROLE = keccak256("RESERVE_MINTER_ROLE"); bytes32 public constant DEPLOYER_ROLE = keccak256("DEPLOYER_ROLE"); IERC721 public promoteToken; address public paymentReceiver; address public encryptor; IERC20Upgradeable public paymentToken; bytes32 public allowListMerkleRoot; mapping(uint => Box) public boxes; mapping(uint256 => address) public promoteTokenUsedInClaim; mapping(address => bool) public accountUsedInSeason1; bool public shopEnabled; bool public claimEnabled; bool public checkAllowList; bool public purchaseLimited; struct Box { IWLBoxMint boxContract; uint256 price; uint maxCount; uint purchased; uint accountLimit; } struct PurchaseCount { uint boxType; uint maxCount; uint purchased; } /// @custom:oz-upgrades-unsafe-allow constructor constructor() initializer {} function _authorizeUpgrade(address) internal override only(DEPLOYER_ROLE) {} /** * @dev * Params * `adminAddress`: `DEFAULT_ADMIN_ROLE` will be granted * `operatorAddress`: `OPERATOR_ROLE` will be granted * `promoteTokenAddress`: a NFT contract address that can claim founders box * `_encryptor`: admin address that encrypts openBox transaction data * `_paymentReceiver`: box payment fee will be transferred to this account * `_paymentToken`: box payment will receive this token */ function initialize( address adminAddress, address operatorAddress, address promoteTokenAddress, address reservedBoxMinterAddress, address _encryptor, address _paymentReceiver, address _paymentToken, address _warmWalletContract, address _delegateCashContract) initializer public { paymentReceiver = _paymentReceiver; paymentToken = IERC20Upgradeable(_paymentToken); promoteToken = IERC721(promoteTokenAddress); encryptor = _encryptor; shopEnabled = true; claimEnabled = false; checkAllowList = true; purchaseLimited = true; __ReentrancyGuard_init(); __WLVerify_init(_warmWalletContract, _delegateCashContract); _setupRole(DEFAULT_ADMIN_ROLE, adminAddress); _setupRole(OPERATOR_ROLE, operatorAddress); _setupRole(RESERVE_MINTER_ROLE, reservedBoxMinterAddress); _setupRole(DEPLOYER_ROLE, _msgSender()); } // modifier modifier only(bytes32 role) { require(hasRole(role, _msgSender()), "Caller does not have permission"); _; } /** * @dev Claims founders box from promote token NFTs * To support delegated wallet, it fetches token owner from delegated service and aggregates count to mint NFTs * * Requirements * - message sender should have the right of promote token NFTs that are not used before */ function claimBox(uint256[] memory tokenIds) external nonReentrant { require(claimEnabled, "ClaimBox has not been enabled"); require(tokenIds.length > 0, "Invalid tokenId list"); uint256[] memory tokenIds2 = new uint256[](tokenIds.length); uint idCount = tokenIds.length; address currentTokenOwner = address(0); uint nextIndex = 0; while (idCount > 0) { uint count = 0; for (uint i=0; i<idCount; i++) { (bool isVerified, address tokenOwnerAddress) = verifyTokenOwner( address(promoteToken), tokenIds[i] ); require(isVerified, "Account doesn't have all promote token NFTs"); if (currentTokenOwner == address(0)) { currentTokenOwner = tokenOwnerAddress; } if (currentTokenOwner == tokenOwnerAddress) { require(tokenOwnerAddress != address(0), "Token owner should not be zero address"); require(promoteTokenUsedInClaim[tokenIds[i]] == address(0), "One of promote token tokenIds has already been used"); promoteTokenUsedInClaim[tokenIds[i]] = tokenOwnerAddress; count++; } else { tokenIds2[nextIndex] = tokenIds[i]; nextIndex++; } } _mintFoundersBox( currentTokenOwner, count, true, false ); idCount = nextIndex; tokenIds = tokenIds2; currentTokenOwner = address(0); nextIndex = 0; } } /** * @dev Accounts can buy multiple box NFTs at once * Each box NFT contract can have different address * All box NFT contracts consist of ERC721A * * Params * - `merkleProof`: proof to validate the msg sender is in the allow list * - `signature`: signature to validate all parameters * - `blockNumberLimit`: a transaction should end before blockNumberLimit * - `boxCountList`: box count list that an account wants to buy * - `promoted`: boolean value indicating it is promoted or not * * Requirements * - shopEnabled must be true * - account can buy boxes only once in a season: checked by accountUsedInSeason1 * - all boxes have limited total count * - all boxes have limited count per account * - msg sender should be in merkle tree to proof allow list * - if a account use promote NFT tokenId, It can be used only once * - account should have enough erc20 tokens for payment */ function buyBox( bytes32[] calldata merkleProof, bytes calldata signature, uint256 blockNumberLimit, uint[] calldata boxCountList, bool promoted) external nonReentrant { require(block.number <= blockNumberLimit, "Transaction has expired"); require(boxCountList.length == 4, "Invalid box count list"); require(boxCountList[0] + boxCountList[1] + boxCountList[2] + boxCountList[3] >= 1, "Total box count should be greater than 1"); require(shopEnabled, "BuyBox has not been enabled"); require( validateBuyBox(signature, blockNumberLimit, boxCountList, promoted), "Invalid signature" ); if(purchaseLimited) { require(!accountUsedInSeason1[_msgSender()], "Account has already participated in this sale"); } if(checkAllowList) { require(isAllowed(_msgSender(), merkleProof), "Wallet address has not been allowed"); } uint majesticCount = checkAvailableBoxCount( "Majestic Box", BoxType.SEASON1_MAJESTIC_BOX, boxCountList[0]); uint boosterBasicCount = checkAvailableBoxCount( "Booster BASIC Box", BoxType.SEASON1_BOOSTER_BASIC_BOX, boxCountList[1]); uint boosterPremiumCount = checkAvailableBoxCount( "Booster PREMIUM Box", BoxType.SEASON1_BOOSTER_PREMIUM_BOX, boxCountList[2]); uint boosterOmegaCount = checkAvailableBoxCount( "Booster OMEGA Box", BoxType.SEASON1_BOOSTER_OMEGA_BOX, boxCountList[3]); require(majesticCount + boosterBasicCount + boosterPremiumCount + boosterOmegaCount > 0, "Insufficient amount of boxes"); // payment SafeERC20Upgradeable.safeTransferFrom( paymentToken, _msgSender(), paymentReceiver, calculateBoxPrice(BoxType.SEASON1_MAJESTIC_BOX, majesticCount) + calculateBoxPrice(BoxType.SEASON1_BOOSTER_BASIC_BOX, boosterBasicCount) + calculateBoxPrice(BoxType.SEASON1_BOOSTER_PREMIUM_BOX, boosterPremiumCount) + calculateBoxPrice(BoxType.SEASON1_BOOSTER_OMEGA_BOX, boosterOmegaCount) ); accountUsedInSeason1[_msgSender()] = true; _mintMajesticBox(_msgSender(), majesticCount, promoted, false); _mintBoosterBox(_msgSender(), boosterBasicCount, boosterPremiumCount, boosterOmegaCount, promoted, false); } /** * @dev Creates reserved boxes * Each box contract has a total reserved minted count to track the total number of reserved NFTs * * Requirements * - the caller must have the `RESERVE_MINTER_ROLE` */ function mintReservedBox( address to, uint majesticBoxCount, uint boosterBasicBoxCount, uint boosterPremiumBoxCount, uint boosterOmegaBoxCount, uint foundersBoxCount) external only(RESERVE_MINTER_ROLE) nonReentrant { _mintMajesticBox(to, majesticBoxCount, false, true); _mintBoosterBox(to, boosterBasicBoxCount, boosterPremiumBoxCount, boosterOmegaBoxCount, false, true); _mintFoundersBox(to, foundersBoxCount, false, true); } /** * @dev Returns purchased count list of majestic, booster boxes */ function getPurchasedBoxCount(uint[] calldata boxTypes) external view returns (PurchaseCount[] memory) { PurchaseCount[] memory list = new PurchaseCount[](boxTypes.length); for (uint i=0; i<boxTypes.length; i++) { uint boxType = boxTypes[i]; list[i].purchased = boxes[boxType].purchased; list[i].maxCount = boxes[boxType].maxCount; list[i].boxType = boxType; } return list; } /** * @dev Returns boolean list of whether each tokenIds has been used or not */ function getPromoteTokenUsedInClaim(uint256[] calldata tokenIds) external view returns(bool[] memory) { bool[] memory used = new bool[](tokenIds.length); for (uint i=0; i<tokenIds.length; i++) { if (promoteTokenUsedInClaim[tokenIds[i]] != address(0)) { used[i] = true; } else { used[i] = false; } } return used; } /** * @dev Creates Majestic box NFTs */ function _mintMajesticBox( address owner, uint amount, bool promoted, bool reserved) private { if (amount > 0) { (uint256 start, uint256 end) = boxes[BoxType.SEASON1_MAJESTIC_BOX].boxContract.mint(owner, amount, reserved); if (!reserved) { boxes[BoxType.SEASON1_MAJESTIC_BOX].purchased += amount; } emit BoxMinted( _msgSender(), address(boxes[BoxType.SEASON1_MAJESTIC_BOX].boxContract), start, end, BoxType.SEASON1_MAJESTIC_BOX, promoted, reserved ); } } /** * @dev Creates Booster box NFTs * All Booster box types(Basic, Premium, Omega) have same nft contract, it mints NFTs at once to reduce gas fee */ function _mintBoosterBox( address owner, uint basicBoxAmount, uint premiumBoxAmount, uint omegaBoxAmount, bool promoted, bool reserved) private { uint total = basicBoxAmount + premiumBoxAmount + omegaBoxAmount; if (total > 0) { (uint256 start, uint256 end) = boxes[BoxType.SEASON1_BOOSTER_BASIC_BOX].boxContract.mint(owner, total, reserved); require(end - start + 1 == total, "Invalid amount of Booster box is minted"); if (basicBoxAmount > 0) { if (!reserved) { boxes[BoxType.SEASON1_BOOSTER_BASIC_BOX].purchased += basicBoxAmount; } emit BoxMinted( _msgSender(), address(boxes[BoxType.SEASON1_BOOSTER_BASIC_BOX].boxContract), start, start + basicBoxAmount -1, BoxType.SEASON1_BOOSTER_BASIC_BOX, promoted, reserved ); } if (premiumBoxAmount > 0) { if (!reserved) { boxes[BoxType.SEASON1_BOOSTER_PREMIUM_BOX].purchased += premiumBoxAmount; } emit BoxMinted( _msgSender(), address(boxes[BoxType.SEASON1_BOOSTER_PREMIUM_BOX].boxContract), start + basicBoxAmount, start + basicBoxAmount + premiumBoxAmount -1, BoxType.SEASON1_BOOSTER_PREMIUM_BOX, promoted, reserved ); } if (omegaBoxAmount > 0) { if (!reserved) { boxes[BoxType.SEASON1_BOOSTER_OMEGA_BOX].purchased += omegaBoxAmount; } emit BoxMinted( _msgSender(), address(boxes[BoxType.SEASON1_BOOSTER_OMEGA_BOX].boxContract), start + basicBoxAmount + premiumBoxAmount, start + basicBoxAmount + premiumBoxAmount + omegaBoxAmount -1, BoxType.SEASON1_BOOSTER_OMEGA_BOX, promoted, reserved ); } } } /** * @dev Creates Founders box NFTs */ function _mintFoundersBox(address owner, uint amount, bool promoted, bool reserved) private { if (amount > 0) { (uint256 start, uint256 end) = boxes[BoxType.SEASON1_FOUNDERS_BOX].boxContract.mint(owner, amount, reserved); emit BoxMinted( owner, address(boxes[BoxType.SEASON1_FOUNDERS_BOX].boxContract), start, end, BoxType.SEASON1_FOUNDERS_BOX, promoted, reserved ); } } function calculateBoxPrice(uint boxType, uint amount) internal view returns (uint) { if (amount <= 0) { return 0; } return boxes[boxType].price * amount; } function checkAvailableBoxCount(string memory boxName, uint boxType, uint amount) internal view returns (uint) { if(amount <= 0) { return 0; } require( amount <= boxes[boxType].accountLimit, string(abi.encodePacked(boxName, " cannot purchase more than the allotted limit")) ); if (boxes[boxType].purchased + amount > boxes[boxType].maxCount) { // return available count return boxes[boxType].maxCount - boxes[boxType].purchased; } return amount; } /** * @dev Validates buyBox function parameters */ function validateBuyBox( bytes calldata signature, uint256 blockNumberLimit, uint[] calldata boxCountList, bool promoted) internal view returns (bool) { bytes32 hashed = keccak256(abi.encode(_msgSender(), blockNumberLimit, boxCountList, promoted)); (address recovered, ECDSAUpgradeable.RecoverError error) = ECDSAUpgradeable.tryRecover(hashed, signature); if (error == ECDSAUpgradeable.RecoverError.NoError && recovered == encryptor ) { return true; } return false; } /** * @dev Checks allow list */ function isAllowed(address account, bytes32[] calldata merkleProof) public view returns (bool) { return MerkleProofUpgradeable.verifyCalldata( merkleProof, allowListMerkleRoot, keccak256(abi.encodePacked(account)) ); } // admin /** * @dev Enables shop * * Requirements * - the caller must have the `OPERATOR_ROLE` */ function setShopEnabled(bool shop, bool claim) external only(OPERATOR_ROLE) { shopEnabled = shop; claimEnabled = claim; } /** * @dev Sets allow list * * Requirements * - the caller must have the `OPERATOR_ROLE` */ function setAllowList(bool use, bytes32 merkleRoot) external only(OPERATOR_ROLE) { checkAllowList = use; allowListMerkleRoot = merkleRoot; } /** * @dev Sets purchaseLimited * * Requirements * - the caller must have the `OPERATOR_ROLE` */ function setPurchaseLimit(bool value) external only(OPERATOR_ROLE) { purchaseLimited = value; } /** * @dev Sets Encryptor * * Requirements * - the caller must have the `OPERATOR_ROLE` */ function updateEncryptor(address _encryptor) external only(OPERATOR_ROLE) { require(_encryptor != address(0), "Zero address cannot be used"); encryptor = _encryptor; } /** * @dev Sets box settings * * Params * - `boxTypeList`: each box type can have different contract address (ex, BoxType.SEASON1_MAJESTIC_BOX) * - `maxCountList`: max count limits total selling amount of each box * - `accountLimitList`: each account can buy each box up to accountLimit * - `priceList`: selling price of each box * - `contractList`: box NFT contract list * * Requirements * - the caller must have the `OPERATOR_ROLE` */ function setBox( uint[] calldata boxTypeList, uint[] calldata maxCountList, uint[] calldata accountLimitList, uint256[] calldata priceList, address majesticBoxContract, address boosterBoxContract, address foundersBoxContract) external only(OPERATOR_ROLE) { require(boxTypeList.length == maxCountList.length, "Invalid array length at maxCount"); require(boxTypeList.length == accountLimitList.length, "Invalid array length at accountLimit"); require(boxTypeList.length == priceList.length, "Invalid array length at price"); for(uint i=0; i<boxTypeList.length; i++) { if (boxTypeList[i] == BoxType.SEASON1_MAJESTIC_BOX) { boxes[boxTypeList[i]].boxContract = IWLBoxMint(majesticBoxContract); } else if (boxTypeList[i] == BoxType.SEASON1_FOUNDERS_BOX) { boxes[boxTypeList[i]].boxContract = IWLBoxMint(foundersBoxContract); } else { boxes[boxTypeList[i]].boxContract = IWLBoxMint(boosterBoxContract); } boxes[boxTypeList[i]].price = priceList[i]; boxes[boxTypeList[i]].maxCount = maxCountList[i]; boxes[boxTypeList[i]].accountLimit = accountLimitList[i]; } } function updatePaymentToken(address _paymentReceiver, address _paymentToken) external only(OPERATOR_ROLE) { require(_paymentReceiver != address(0), "Invalid payment receiver"); require(_paymentToken != address(0), "Invalid payment token"); paymentReceiver = _paymentReceiver; paymentToken = IERC20Upgradeable(_paymentToken); } // events event BoxMinted( address indexed owner, address boxContract, uint256 start, uint256 end, uint boxType, bool promoted, bool reserved ); /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControlUpgradeable.sol"; import "../utils/ContextUpgradeable.sol"; import "../utils/StringsUpgradeable.sol"; import "../utils/introspection/ERC165Upgradeable.sol"; import "../proxy/utils/Initializable.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 AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable { function __AccessControl_init() internal onlyInitializing { } function __AccessControl_init_unchained() internal onlyInitializing { } struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", StringsUpgradeable.toHexString(account), " is missing role ", StringsUpgradeable.toHexString(uint256(role), 32) ) ) ); } } /** * @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 override 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 override 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 override 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 `account`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * May emit a {RoleGranted} event. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @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 Grants `role` to `account`. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControlUpgradeable { /** * @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. * * _Available since v3.1._ */ 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 `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol) pragma solidity ^0.8.0; /** * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified * proxy whose upgrades are fully controlled by the current implementation. */ interface IERC1822ProxiableUpgradeable { /** * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation * address. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. */ function proxiableUUID() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol) pragma solidity ^0.8.0; /** * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC. * * _Available since v4.8.3._ */ interface IERC1967Upgradeable { /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Emitted when the beacon is changed. */ event BeaconUpgraded(address indexed beacon); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeaconUpgradeable { /** * @dev Must return an address that can be used as a delegate call target. * * {BeaconProxy} will check that this address is a contract. */ function implementation() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol) pragma solidity ^0.8.2; import "../beacon/IBeaconUpgradeable.sol"; import "../../interfaces/IERC1967Upgradeable.sol"; import "../../interfaces/draft-IERC1822Upgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "../../utils/StorageSlotUpgradeable.sol"; import "../utils/Initializable.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. * * _Available since v4.1._ */ abstract contract ERC1967UpgradeUpgradeable is Initializable, IERC1967Upgradeable { function __ERC1967Upgrade_init() internal onlyInitializing { } function __ERC1967Upgrade_init_unchained() internal onlyInitializing { } // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1 bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143; /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Returns the current implementation address. */ function _getImplementation() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { require(AddressUpgradeable.isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Perform implementation upgrade * * Emits an {Upgraded} event. */ function _upgradeTo(address newImplementation) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Perform implementation upgrade with additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { AddressUpgradeable.functionDelegateCall(newImplementation, data); } } /** * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal { // Upgrades from old implementations will perform a rollback test. This test requires the new // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing // this special case will break upgrade paths from old UUPS implementation to new ones. if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) { _setImplementation(newImplementation); } else { try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) { require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID"); } catch { revert("ERC1967Upgrade: new implementation is not UUPS"); } _upgradeToAndCall(newImplementation, data, forceCall); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Returns the current admin. */ function _getAdmin() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { require(newAdmin != address(0), "ERC1967: new admin is the zero address"); StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. */ function _changeAdmin(address newAdmin) internal { emit AdminChanged(_getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor. */ bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Returns the current beacon. */ function _getBeacon() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { require(AddressUpgradeable.isContract(newBeacon), "ERC1967: new beacon is not a contract"); require( AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()), "ERC1967: beacon implementation is not a contract" ); StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon; } /** * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that). * * Emits a {BeaconUpgraded} event. */ function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0 || forceCall) { AddressUpgradeable.functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data); } } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ```solidity * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized != type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/UUPSUpgradeable.sol) pragma solidity ^0.8.0; import "../../interfaces/draft-IERC1822Upgradeable.sol"; import "../ERC1967/ERC1967UpgradeUpgradeable.sol"; import "./Initializable.sol"; /** * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy. * * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing * `UUPSUpgradeable` with a custom implementation of upgrades. * * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism. * * _Available since v4.1._ */ abstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable { function __UUPSUpgradeable_init() internal onlyInitializing { } function __UUPSUpgradeable_init_unchained() internal onlyInitializing { } /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment address private immutable __self = address(this); /** * @dev Check that the execution is being performed through a delegatecall call and that the execution context is * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to * fail. */ modifier onlyProxy() { require(address(this) != __self, "Function must be called through delegatecall"); require(_getImplementation() == __self, "Function must be called through active proxy"); _; } /** * @dev Check that the execution is not being performed through a delegate call. This allows a function to be * callable on the implementing contract but not through proxies. */ modifier notDelegated() { require(address(this) == __self, "UUPSUpgradeable: must not be called through delegatecall"); _; } /** * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the * implementation. It is used to validate the implementation's compatibility when performing an upgrade. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier. */ function proxiableUUID() external view virtual override notDelegated returns (bytes32) { return _IMPLEMENTATION_SLOT; } /** * @dev Upgrade the implementation of the proxy to `newImplementation`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. * * @custom:oz-upgrades-unsafe-allow-reachable delegatecall */ function upgradeTo(address newImplementation) public virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, new bytes(0), false); } /** * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call * encoded in `data`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. * * @custom:oz-upgrades-unsafe-allow-reachable delegatecall */ function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, data, true); } /** * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by * {upgradeTo} and {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal override onlyOwner {} * ``` */ function _authorizeUpgrade(address newImplementation) internal virtual; /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuardUpgradeable is Initializable { // 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; function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev 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; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20PermitUpgradeable { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20Upgradeable { /** * @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 amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` 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 amount) 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 `amount` 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 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` 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 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20Upgradeable.sol"; import "../extensions/IERC20PermitUpgradeable.sol"; import "../../../utils/AddressUpgradeable.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20Upgradeable { using AddressUpgradeable for address; /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20Upgradeable token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20Upgradeable token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20Upgradeable token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to * 0 before setting it to a non-zero value. */ function forceApprove(IERC20Upgradeable token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20PermitUpgradeable token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20Upgradeable token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && AddressUpgradeable.isContract(address(token)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @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 ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../StringsUpgradeable.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSAUpgradeable { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV // Deprecated in v4.8 } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) { // 32 is the length in bytes of hash, // enforced by the type signature above /// @solidity memory-safe-assembly assembly { mstore(0x00, "\x19Ethereum Signed Message:\n32") mstore(0x1c, hash) message := keccak256(0x00, 0x3c) } } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", StringsUpgradeable.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(ptr, "\x19\x01") mstore(add(ptr, 0x02), domainSeparator) mstore(add(ptr, 0x22), structHash) data := keccak256(ptr, 0x42) } } /** * @dev Returns an Ethereum Signed Data with intended validator, created from a * `validator` and `data` according to the version 0 of EIP-191. * * See {recover}. */ function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x00", validator, data)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.2) (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** * @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 MerkleProofUpgradeable { /** * @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} * * _Available since v4.7._ */ 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. * * _Available since v4.4._ */ 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} * * _Available since v4.7._ */ 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. * * _Available since v4.7._ */ 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. * * _Available since v4.7._ */ 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). * * _Available since v4.7._ */ 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. require(leavesLen + proofLen - 1 == totalHashes, "MerkleProof: invalid multiproof"); // 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) { require(proofPos == proofLen, "MerkleProof: invalid multiproof"); 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. * * _Available since v4.7._ */ 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. require(leavesLen + proofLen - 1 == totalHashes, "MerkleProof: invalid multiproof"); // 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) { require(proofPos == proofLen, "MerkleProof: invalid multiproof"); unchecked { return hashes[totalHashes - 1]; } } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) { return a < b ? _efficientHash(a, b) : _efficientHash(b, a); } 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 v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.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); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable { function __ERC165_init() internal onlyInitializing { } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @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 IERC165Upgradeable { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library MathUpgradeable { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @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 up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (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; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) 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. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 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. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); 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 (rounding == Rounding.Up && 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 down. * * 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 + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * 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 + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * 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 + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * 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 + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.0; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMathUpgradeable { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol) // This file was procedurally generated from scripts/generate/templates/StorageSlot.js. pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ```solidity * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._ * _Available since v4.9 for `string`, `bytes`._ */ library StorageSlotUpgradeable { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } struct StringSlot { string value; } struct BytesSlot { bytes value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` with member `value` located at `slot`. */ function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` representation of the string storage pointer `store`. */ function getStringSlot(string storage store) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } /** * @dev Returns an `BytesSlot` with member `value` located at `slot`. */ function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`. */ function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/MathUpgradeable.sol"; import "./math/SignedMathUpgradeable.sol"; /** * @dev String operations. */ library StringsUpgradeable { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = MathUpgradeable.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toString(int256 value) internal pure returns (string memory) { return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMathUpgradeable.abs(value)))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, MathUpgradeable.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../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 caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.18; import "erc721a-upgradeable/contracts/IERC721AUpgradeable.sol"; library BoxType { /** * @dev Box types * BoxType.SEASON1_MAJESTIC_BOX * - Majestic box type for season1 * * BoxType.SEASON1_BOOSTER_OMEGA_BOX * - Booster Omega box type for season1 * * BoxType.SEASON1_BOOSTER_PREMIUM_BOX * - Booster Premium box type for season1 * * BoxType.SEASON1_BOOSTER_BASIC_BOX * - Booster Basic box type for season1 * * BoxType.SEASON1_FOUNDERS_BOX * - Founders box type for season1 */ uint public constant SEASON1_MAJESTIC_BOX = 1; uint public constant SEASON1_BOOSTER_OMEGA_BOX = 20; uint public constant SEASON1_BOOSTER_PREMIUM_BOX = 21; uint public constant SEASON1_BOOSTER_BASIC_BOX = 22; uint public constant SEASON1_FOUNDERS_BOX = 30; } interface IWLBox is IERC721AUpgradeable { function mint(address to, uint256 quantity, bool reserved) external returns (uint256, uint256); function burn(uint256[] calldata tokenIds) external; function claimCount() external view returns (uint); } interface IWLBoxMint { function mint(address to, uint256 quantity, bool reserved) external returns (uint256, uint256); }
// SPDX-License-Identifier: MIT // This contract is forked from https://etherscan.io/address/0xe2be48D3bE2663A83b433E88205b39fF48F0FF4c pragma solidity 0.8.18; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; interface WarmInterface { function ownerOf( address contractAddress, uint256 tokenId ) external view returns (address); } interface DelegateCashInterface { function checkDelegateForToken( address delegate, address vault, address contract_, uint256 tokenId ) external view returns (bool); } error ZeroAddressCheck(); /** * @title WLVerify - check for token ownership via contract, warm wallet and delegate cash * Warm Wallet https://github.com/wenewlabs/public/tree/main/HotWalletProxy * Delegate.cash https://github.com/delegatecash/delegation-registry */ abstract contract WLVerify is Initializable { address public WARM_WALLET_CONTRACT; address public DELEGATE_CASH_CONTRACT; function __WLVerify_init(address _warmWalletContract, address _delegateCashContract) internal onlyInitializing { if ( _warmWalletContract == address(0) || _delegateCashContract == address(0) ) revert ZeroAddressCheck(); WARM_WALLET_CONTRACT = _warmWalletContract; DELEGATE_CASH_CONTRACT = _delegateCashContract; } /** * @notice verify contract token based claim using warm wallet and delegate cash * @param tokenContract the smart contract address of the token * @param tokenId the tokenId * @return bool token ownership check * @return address token owner's wallet address */ function verifyTokenOwner( address tokenContract, uint256 tokenId ) internal view returns (bool, address) { address tokenOwner = IERC721(tokenContract).ownerOf(tokenId); if (tokenOwner == address(0)) revert ZeroAddressCheck(); // 1. check contract token owner // 2. check warm wallet delegation - ownerOf() // all delegation // is a mapping of token owner's wallet to hot wallet // coldWalletToHotWallet[owner].walletAddress // 3. check delegate.cash delegation - checkDelegateForToken() // checks three forms of delegation all, contract, and contract/token id return ( (msg.sender == tokenOwner || msg.sender == WarmInterface(WARM_WALLET_CONTRACT).ownerOf( tokenContract, tokenId ) || DelegateCashInterface(DELEGATE_CASH_CONTRACT) .checkDelegateForToken( msg.sender, tokenOwner, tokenContract, tokenId )), tokenOwner ); } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; /** * @dev Interface of ERC721A. */ interface IERC721AUpgradeable { /** * The caller must own the token or be an approved operator. */ error ApprovalCallerNotOwnerNorApproved(); /** * The token does not exist. */ error ApprovalQueryForNonexistentToken(); /** * Cannot query the balance for the zero address. */ error BalanceQueryForZeroAddress(); /** * Cannot mint to the zero address. */ error MintToZeroAddress(); /** * The quantity of tokens minted must be more than zero. */ error MintZeroQuantity(); /** * The token does not exist. */ error OwnerQueryForNonexistentToken(); /** * The caller must own the token or be an approved operator. */ error TransferCallerNotOwnerNorApproved(); /** * The token must be owned by `from`. */ error TransferFromIncorrectOwner(); /** * Cannot safely transfer to a contract that does not implement the * ERC721Receiver interface. */ error TransferToNonERC721ReceiverImplementer(); /** * Cannot transfer to the zero address. */ error TransferToZeroAddress(); /** * The token does not exist. */ error URIQueryForNonexistentToken(); /** * The `quantity` minted with ERC2309 exceeds the safety limit. */ error MintERC2309QuantityExceedsLimit(); /** * The `extraData` cannot be set on an unintialized ownership slot. */ error OwnershipNotInitializedForExtraData(); // ============================================================= // STRUCTS // ============================================================= struct TokenOwnership { // The address of the owner. address addr; // Stores the start time of ownership with minimal overhead for tokenomics. uint64 startTimestamp; // Whether the token has been burned. bool burned; // Arbitrary data similar to `startTimestamp` that can be set via {_extraData}. uint24 extraData; } // ============================================================= // TOKEN COUNTERS // ============================================================= /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() external view returns (uint256); // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); // ============================================================= // IERC721 // ============================================================= /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables * (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, * checking first that contract recipients are aware of the ERC721 protocol * to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move * this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external payable; /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external payable; /** * @dev Transfers `tokenId` from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} * whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external payable; /** * @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 payable; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} * for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll}. */ function isApprovedForAll(address owner, address operator) external view returns (bool); // ============================================================= // IERC721Metadata // ============================================================= /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); // ============================================================= // IERC2309 // ============================================================= /** * @dev Emitted when tokens in `fromTokenId` to `toTokenId` * (inclusive) is transferred from `from` to `to`, as defined in the * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard. * * See {_mintERC2309} for more details. */ event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to); }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ZeroAddressCheck","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"address","name":"boxContract","type":"address"},{"indexed":false,"internalType":"uint256","name":"start","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"end","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"boxType","type":"uint256"},{"indexed":false,"internalType":"bool","name":"promoted","type":"bool"},{"indexed":false,"internalType":"bool","name":"reserved","type":"bool"}],"name":"BoxMinted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","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":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DELEGATE_CASH_CONTRACT","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEPLOYER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RESERVE_MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WARM_WALLET_CONTRACT","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"accountUsedInSeason1","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"allowListMerkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"boxes","outputs":[{"internalType":"contract IWLBoxMint","name":"boxContract","type":"address"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"maxCount","type":"uint256"},{"internalType":"uint256","name":"purchased","type":"uint256"},{"internalType":"uint256","name":"accountLimit","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"uint256","name":"blockNumberLimit","type":"uint256"},{"internalType":"uint256[]","name":"boxCountList","type":"uint256[]"},{"internalType":"bool","name":"promoted","type":"bool"}],"name":"buyBox","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"checkAllowList","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"claimBox","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"encryptor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"getPromoteTokenUsedInClaim","outputs":[{"internalType":"bool[]","name":"","type":"bool[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"boxTypes","type":"uint256[]"}],"name":"getPurchasedBoxCount","outputs":[{"components":[{"internalType":"uint256","name":"boxType","type":"uint256"},{"internalType":"uint256","name":"maxCount","type":"uint256"},{"internalType":"uint256","name":"purchased","type":"uint256"}],"internalType":"struct WLBoxShop.PurchaseCount[]","name":"","type":"tuple[]"}],"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":"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":"address","name":"adminAddress","type":"address"},{"internalType":"address","name":"operatorAddress","type":"address"},{"internalType":"address","name":"promoteTokenAddress","type":"address"},{"internalType":"address","name":"reservedBoxMinterAddress","type":"address"},{"internalType":"address","name":"_encryptor","type":"address"},{"internalType":"address","name":"_paymentReceiver","type":"address"},{"internalType":"address","name":"_paymentToken","type":"address"},{"internalType":"address","name":"_warmWalletContract","type":"address"},{"internalType":"address","name":"_delegateCashContract","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"}],"name":"isAllowed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"majesticBoxCount","type":"uint256"},{"internalType":"uint256","name":"boosterBasicBoxCount","type":"uint256"},{"internalType":"uint256","name":"boosterPremiumBoxCount","type":"uint256"},{"internalType":"uint256","name":"boosterOmegaBoxCount","type":"uint256"},{"internalType":"uint256","name":"foundersBoxCount","type":"uint256"}],"name":"mintReservedBox","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paymentReceiver","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paymentToken","outputs":[{"internalType":"contract IERC20Upgradeable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"promoteToken","outputs":[{"internalType":"contract IERC721","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"promoteTokenUsedInClaim","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"purchaseLimited","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":[{"internalType":"bool","name":"use","type":"bool"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"name":"setAllowList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"boxTypeList","type":"uint256[]"},{"internalType":"uint256[]","name":"maxCountList","type":"uint256[]"},{"internalType":"uint256[]","name":"accountLimitList","type":"uint256[]"},{"internalType":"uint256[]","name":"priceList","type":"uint256[]"},{"internalType":"address","name":"majesticBoxContract","type":"address"},{"internalType":"address","name":"boosterBoxContract","type":"address"},{"internalType":"address","name":"foundersBoxContract","type":"address"}],"name":"setBox","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"value","type":"bool"}],"name":"setPurchaseLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"shop","type":"bool"},{"internalType":"bool","name":"claim","type":"bool"}],"name":"setShopEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"shopEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_encryptor","type":"address"}],"name":"updateEncryptor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_paymentReceiver","type":"address"},{"internalType":"address","name":"_paymentToken","type":"address"}],"name":"updatePaymentToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"}]
Contract Creation Code
60a0604052306080523480156200001557600080fd5b50600054610100900460ff1615808015620000375750600054600160ff909116105b8062000067575062000054306200014160201b6200203e1760201c565b15801562000067575060005460ff166001145b620000cf5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840160405180910390fd5b6000805460ff191660011790558015620000f3576000805461ff0019166101001790555b80156200013a576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5062000150565b6001600160a01b03163b151590565b6080516142836200018860003960008181610d5f01528181610d9f015281816113b1015281816113f1015261148001526142836000f3fe60806040526004361061023b5760003560e01c8063670164151161012e578063c5d7bd67116100ab578063e454fa7d1161006f578063e454fa7d14610786578063ec0a2af8146107a6578063ecd00261146107c6578063f5b541a6146107fa578063f5e95acb1461081c57600080fd5b8063c5d7bd67146106bd578063cb37f3b2146106ee578063d07ce7b61461070f578063d547741f14610746578063d5b1e9c81461076657600080fd5b80639bb906e0116100f25780639bb906e014610610578063a217fddf14610627578063a40cfcff1461063c578063a7ca8c7d1461065c578063b25e86221461069057600080fd5b8063670164151461056157806368404efc146105815780636b1c802f146105a35780638f4b3c02146105d057806391d14854146105f057600080fd5b80633659cfe6116101bc5780634f1ef286116101805780634f1ef286146104d857806352d1902d146104eb57806358c58681146105005780635c764c0414610520578063626e61bc1461054057600080fd5b80633659cfe6146103d557806339be1683146103f557806342e2d4e31461041557806348531614146104365780634ed3faf21461045157600080fd5b80632866ed21116102035780632866ed211461032e5780632cd5859e1461034e5780632f2ff15d146103745780633013ce291461039457806336568abe146103b557600080fd5b806301ffc9a71461024057806306d5bba7146102755780630f1a1dbe14610297578063211339b9146102b7578063248a9ca3146102f0575b600080fd5b34801561024c57600080fd5b5061026061025b366004613655565b61083c565b60405190151581526020015b60405180910390f35b34801561028157600080fd5b5061029561029036600461369d565b610873565b005b3480156102a357600080fd5b506102956102b236600461371d565b6108d7565b3480156102c357600080fd5b5061012e546102d8906001600160a01b031681565b6040516001600160a01b03909116815260200161026c565b3480156102fc57600080fd5b5061032061030b3660046137c3565b60009081526066602052604090206001015490565b60405190815260200161026c565b34801561033a57600080fd5b506101365461026090610100900460ff1681565b34801561035a57600080fd5b506000546102d8906201000090046001600160a01b031681565b34801561038057600080fd5b5061029561038f3660046137fc565b610cad565b3480156103a057600080fd5b50610131546102d8906001600160a01b031681565b3480156103c157600080fd5b506102956103d03660046137fc565b610cd7565b3480156103e157600080fd5b506102956103f0366004613821565b610d55565b34801561040157600080fd5b50610295610410366004613883565b610e31565b34801561042157600080fd5b50610130546102d8906001600160a01b031681565b34801561044257600080fd5b50610136546102609060ff1681565b34801561045d57600080fd5b506104a661046c3660046137c3565b61013360205260009081526040902080546001820154600283015460038401546004909401546001600160a01b0390931693919290919085565b604080516001600160a01b0390961686526020860194909452928401919091526060830152608082015260a00161026c565b6102956104e6366004613965565b6113a7565b3480156104f757600080fd5b50610320611473565b34801561050c57600080fd5b5061029561051b366004613a0d565b611526565b34801561052c57600080fd5b5061029561053b366004613821565b61157b565b34801561054c57600080fd5b50610136546102609062010000900460ff1681565b34801561056d57600080fd5b5061029561057c366004613a2a565b61162a565b34801561058d57600080fd5b5061013654610260906301000000900460ff1681565b3480156105af57600080fd5b506105c36105be366004613a76565b6116b8565b60405161026c9190613ab8565b3480156105dc57600080fd5b506102606105eb366004613b11565b611803565b3480156105fc57600080fd5b5061026061060b3660046137fc565b611856565b34801561061c57600080fd5b506103206101325481565b34801561063357600080fd5b50610320600081565b34801561064857600080fd5b50610295610657366004613b66565b611881565b34801561066857600080fd5b506103207f82ce2ced7fc86cde9b16f1f3a5508a82078c42c54a7cf0af011ce529199a18bb81565b34801561069c57600080fd5b506106b06106ab366004613a76565b6118d9565b60405161026c9190613b92565b3480156106c957600080fd5b506102606106d8366004613821565b6101356020526000908152604090205460ff1681565b3480156106fa57600080fd5b5061012f546102d8906001600160a01b031681565b34801561071b57600080fd5b506102d861072a3660046137c3565b610134602052600090815260409020546001600160a01b031681565b34801561075257600080fd5b506102956107613660046137fc565b6119cd565b34801561077257600080fd5b50610295610781366004613bd8565b6119f2565b34801561079257600080fd5b506001546102d8906001600160a01b031681565b3480156107b257600080fd5b506102956107c1366004613c06565b611afc565b3480156107d257600080fd5b506103207ffc425f2263d0df187444b70e47283d622c70181c5baebb1306a01edba1ce184c81565b34801561080657600080fd5b506103206000805160206141e783398151915281565b34801561082857600080fd5b50610295610837366004613cfd565b611e41565b60006001600160e01b03198216637965db0b60e01b148061086d57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6000805160206141e783398151915261088c8133611856565b6108b15760405162461bcd60e51b81526004016108a890613db9565b60405180910390fd5b50610136805461ffff191692151561ff0019169290921761010091151591909102179055565b6108df61204d565b61013654610100900460ff166109375760405162461bcd60e51b815260206004820152601d60248201527f436c61696d426f7820686173206e6f74206265656e20656e61626c656400000060448201526064016108a8565b600081511161097f5760405162461bcd60e51b8152602060048201526014602482015273125b9d985b1a59081d1bdad95b9259081b1a5cdd60621b60448201526064016108a8565b6000815167ffffffffffffffff81111561099b5761099b6136d6565b6040519080825280602002602001820160405280156109c4578160200160208202803683370190505b5082519091506000805b8215610c9c576000805b84811015610c7b5761012e5487516000918291610a18916001600160a01b0316908b9086908110610a0b57610a0b613df0565b60200260200101516120a6565b9150915081610a7d5760405162461bcd60e51b815260206004820152602b60248201527f4163636f756e7420646f65736e2774206861766520616c6c2070726f6d6f746560448201526a20746f6b656e204e46547360a81b60648201526084016108a8565b6001600160a01b038616610a8f578095505b806001600160a01b0316866001600160a01b031603610c21576001600160a01b038116610b0d5760405162461bcd60e51b815260206004820152602660248201527f546f6b656e206f776e65722073686f756c64206e6f74206265207a65726f206160448201526564647265737360d01b60648201526084016108a8565b60006001600160a01b031661013460008b8681518110610b2f57610b2f613df0565b6020908102919091018101518252810191909152604001600020546001600160a01b031614610bbc5760405162461bcd60e51b815260206004820152603360248201527f4f6e65206f662070726f6d6f746520746f6b656e20746f6b656e4964732068616044820152721cc8185b1c9958591e481899595b881d5cd959606a1b60648201526084016108a8565b8061013460008b8681518110610bd457610bd4613df0565b6020026020010151815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055508380610c1990613e1c565b945050610c66565b888381518110610c3357610c33613df0565b6020026020010151888681518110610c4d57610c4d613df0565b602090810291909101015284610c6281613e1c565b9550505b50508080610c7390613e1c565b9150506109d8565b50610c8a83826001600061227b565b509293508392915060009050806109ce565b50505050610caa600160fc55565b50565b600082815260666020526040902060010154610cc8816123ac565b610cd283836123b6565b505050565b6001600160a01b0381163314610d475760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016108a8565b610d51828261243c565b5050565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163003610d9d5760405162461bcd60e51b81526004016108a890613e35565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610de66000805160206141c7833981519152546001600160a01b031690565b6001600160a01b031614610e0c5760405162461bcd60e51b81526004016108a890613e81565b610e15816124a3565b60408051600080825260208201909252610caa918391906124ea565b610e3961204d565b83431115610e895760405162461bcd60e51b815260206004820152601760248201527f5472616e73616374696f6e20686173206578706972656400000000000000000060448201526064016108a8565b60048214610ed25760405162461bcd60e51b8152602060048201526016602482015275125b9d985b1a5908189bde0818dbdd5b9d081b1a5cdd60521b60448201526064016108a8565b600183836003818110610ee757610ee7613df0565b9050602002013584846002818110610f0157610f01613df0565b9050602002013585856001818110610f1b57610f1b613df0565b9050602002013586866000818110610f3557610f35613df0565b90506020020135610f469190613ecd565b610f509190613ecd565b610f5a9190613ecd565b1015610fb95760405162461bcd60e51b815260206004820152602860248201527f546f74616c20626f7820636f756e742073686f756c642062652067726561746560448201526772207468616e203160c01b60648201526084016108a8565b6101365460ff1661100c5760405162461bcd60e51b815260206004820152601b60248201527f427579426f7820686173206e6f74206265656e20656e61626c6564000000000060448201526064016108a8565b61101a868686868686612655565b61105a5760405162461bcd60e51b8152602060048201526011602482015270496e76616c6964207369676e617475726560781b60448201526064016108a8565b610136546301000000900460ff16156110e457336000908152610135602052604090205460ff16156110e45760405162461bcd60e51b815260206004820152602d60248201527f4163636f756e742068617320616c72656164792070617274696369706174656460448201526c20696e20746869732073616c6560981b60648201526084016108a8565b6101365462010000900460ff161561115957611101338989611803565b6111595760405162461bcd60e51b815260206004820152602360248201527f57616c6c6574206164647265737320686173206e6f74206265656e20616c6c6f6044820152621dd95960ea1b60648201526084016108a8565b60006111a46040518060400160405280600c81526020016b09ac2d4cae6e8d2c64084def60a31b81525060018686600081811061119857611198613df0565b90506020020135612723565b905060006111ea60405180604001604052806011815260200170084dedee6e8cae4408482a692864084def607b1b81525060168787600181811061119857611198613df0565b9050600061123260405180604001604052806013815260200172084dedee6e8cae440a0a48a9a92aa9a4084def606b1b81525060158888600281811061119857611198613df0565b9050600061127860405180604001604052806011815260200170084dedee6e8cae4409e9a8a8e824084def607b1b81525060148989600381811061119857611198613df0565b9050600081836112888688613ecd565b6112929190613ecd565b61129c9190613ecd565b116112e95760405162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e7420616d6f756e74206f6620626f7865730000000060448201526064016108a8565b61013154611357906001600160a01b03163361012f546001600160a01b03166113136014866127eb565b61131e6015886127eb565b61132960168a6127eb565b61133460018c6127eb565b61133e9190613ecd565b6113489190613ecd565b6113529190613ecd565b61281a565b33600081815261013560205260408120805460ff19166001179055611380919086908890612874565b61138f338484848960006129d3565b5050505061139d600160fc55565b5050505050505050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036113ef5760405162461bcd60e51b81526004016108a890613e35565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166114386000805160206141c7833981519152546001600160a01b031690565b6001600160a01b03161461145e5760405162461bcd60e51b81526004016108a890613e81565b611467826124a3565b610d51828260016124ea565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146115135760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c000000000000000060648201526084016108a8565b506000805160206141c783398151915290565b6000805160206141e783398151915261153f8133611856565b61155b5760405162461bcd60e51b81526004016108a890613db9565b50610136805491151563010000000263ff00000019909216919091179055565b6000805160206141e78339815191526115948133611856565b6115b05760405162461bcd60e51b81526004016108a890613db9565b6001600160a01b0382166116065760405162461bcd60e51b815260206004820152601b60248201527f5a65726f20616464726573732063616e6e6f742062652075736564000000000060448201526064016108a8565b5061013080546001600160a01b0319166001600160a01b0392909216919091179055565b7f82ce2ced7fc86cde9b16f1f3a5508a82078c42c54a7cf0af011ce529199a18bb6116558133611856565b6116715760405162461bcd60e51b81526004016108a890613db9565b61167961204d565b611687878760006001612874565b61169787868686600060016129d3565b6116a587836000600161227b565b6116af600160fc55565b50505050505050565b606060008267ffffffffffffffff8111156116d5576116d56136d6565b60405190808252806020026020018201604052801561172a57816020015b61171760405180606001604052806000815260200160008152602001600081525090565b8152602001906001900390816116f35790505b50905060005b838110156117fb57600085858381811061174c5761174c613df0565b90506020020135905061013360008281526020019081526020016000206003015483838151811061177f5761177f613df0565b602002602001015160400181815250506101336000828152602001908152602001600020600201548383815181106117b9576117b9613df0565b60200260200101516020018181525050808383815181106117dc576117dc613df0565b60209081029190910101515250806117f381613e1c565b915050611730565b509392505050565b610132546040516bffffffffffffffffffffffff19606086901b16602082015260009161184c918591859160340160405160208183030381529060405280519060200120612dc4565b90505b9392505050565b60009182526066602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6000805160206141e783398151915261189a8133611856565b6118b65760405162461bcd60e51b81526004016108a890613db9565b506101368054921515620100000262ff0000199093169290921790915561013255565b606060008267ffffffffffffffff8111156118f6576118f66136d6565b60405190808252806020026020018201604052801561191f578160200160208202803683370190505b50905060005b838110156117fb5760006101348187878581811061194557611945613df0565b60209081029290920135835250810191909152604001600020546001600160a01b03161461199657600182828151811061198157611981613df0565b911515602092830291909101909101526119bb565b60008282815181106119aa576119aa613df0565b911515602092830291909101909101525b806119c581613e1c565b915050611925565b6000828152606660205260409020600101546119e8816123ac565b610cd2838361243c565b6000805160206141e7833981519152611a0b8133611856565b611a275760405162461bcd60e51b81526004016108a890613db9565b6001600160a01b038316611a7d5760405162461bcd60e51b815260206004820152601860248201527f496e76616c6964207061796d656e74207265636569766572000000000000000060448201526064016108a8565b6001600160a01b038216611acb5760405162461bcd60e51b815260206004820152601560248201527424b73b30b634b2103830bcb6b2b73a103a37b5b2b760591b60448201526064016108a8565b5061012f80546001600160a01b039384166001600160a01b0319918216179091556101318054929093169116179055565b6000805160206141e7833981519152611b158133611856565b611b315760405162461bcd60e51b81526004016108a890613db9565b8a8914611b805760405162461bcd60e51b815260206004820181905260248201527f496e76616c6964206172726179206c656e677468206174206d6178436f756e7460448201526064016108a8565b8a8714611bdb5760405162461bcd60e51b8152602060048201526024808201527f496e76616c6964206172726179206c656e677468206174206163636f756e744c6044820152631a5b5a5d60e21b60648201526084016108a8565b8a8514611c2a5760405162461bcd60e51b815260206004820152601d60248201527f496e76616c6964206172726179206c656e67746820617420707269636500000060448201526064016108a8565b60005b8b811015611e325760018d8d83818110611c4957611c49613df0565b9050602002013503611cae578461013360008f8f85818110611c6d57611c6d613df0565b90506020020135815260200190815260200160002060000160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550611d3b565b601e8d8d83818110611cc257611cc2613df0565b9050602002013503611ce6578261013360008f8f85818110611c6d57611c6d613df0565b8361013360008f8f85818110611cfe57611cfe613df0565b90506020020135815260200190815260200160002060000160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b868682818110611d4d57611d4d613df0565b9050602002013561013360008f8f85818110611d6b57611d6b613df0565b905060200201358152602001908152602001600020600101819055508a8a82818110611d9957611d99613df0565b9050602002013561013360008f8f85818110611db757611db7613df0565b90506020020135815260200190815260200160002060020181905550888882818110611de557611de5613df0565b9050602002013561013360008f8f85818110611e0357611e03613df0565b905060200201358152602001908152602001600020600401819055508080611e2a90613e1c565b915050611c2d565b50505050505050505050505050565b600054610100900460ff1615808015611e615750600054600160ff909116105b80611e7b5750303b158015611e7b575060005460ff166001145b611ede5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016108a8565b6000805460ff191660011790558015611f01576000805461ff0019166101001790555b61012f80546001600160a01b03199081166001600160a01b03888116919091179092556101318054821687841617905561012e805482168b84161790556101308054909116918816919091179055610136805463ffffffff19166301010001179055611f6b612dde565b611f758383612e0f565b611f8060008b612eab565b611f986000805160206141e78339815191528a612eab565b611fc27f82ce2ced7fc86cde9b16f1f3a5508a82078c42c54a7cf0af011ce529199a18bb88612eab565b611fec7ffc425f2263d0df187444b70e47283d622c70181c5baebb1306a01edba1ce184c33612eab565b8015612032576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050505050565b6001600160a01b03163b151590565b600260fc540361209f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016108a8565b600260fc55565b6000806000846001600160a01b0316636352211e856040518263ffffffff1660e01b81526004016120d991815260200190565b602060405180830381865afa1580156120f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061211a9190613ee0565b90506001600160a01b038116612143576040516399676b1160e01b815260040160405180910390fd5b336001600160a01b03821614806121e657506000546040516307ca74b760e21b81526001600160a01b038781166004830152602482018790526201000090920490911690631f29d2dc90604401602060405180830381865afa1580156121ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121d19190613ee0565b6001600160a01b0316336001600160a01b0316145b8061226f5750600154604051631574d39f60e31b81523360048201526001600160a01b0383811660248301528781166044830152606482018790529091169063aba69cf890608401602060405180830381865afa15801561224b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061226f9190613efd565b925090505b9250929050565b821561239f57601e60009081526101336020527ff1a3db9a79cd016adee65e5daf8b6502a23f170e3010ebc22bd2da4749a5c17a546040516334686fad60e21b81526001600160a01b0387811660048301526024820187905284151560448301528392169063d1a1beb49060640160408051808303816000875af1158015612307573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061232b9190613f1a565b601e60008190526101336020527ff1a3db9a79cd016adee65e5daf8b6502a23f170e3010ebc22bd2da4749a5c17a546040519395509193506001600160a01b03808a169360008051602061422e833981519152936123949392169187918791908b908b90613f3e565b60405180910390a250505b50505050565b600160fc55565b610caa8133612eb5565b6123c08282611856565b610d515760008281526066602090815260408083206001600160a01b03851684529091529020805460ff191660011790556123f83390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6124468282611856565b15610d515760008281526066602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b7ffc425f2263d0df187444b70e47283d622c70181c5baebb1306a01edba1ce184c6124ce8133611856565b610d515760405162461bcd60e51b81526004016108a890613db9565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff161561251d57610cd283612f0e565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015612577575060408051601f3d908101601f1916820190925261257491810190613f75565b60015b6125da5760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b60648201526084016108a8565b6000805160206141c783398151915281146126495760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b60648201526084016108a8565b50610cd2838383612faa565b6000803386868686604051602001612671959493929190613f8e565b6040516020818303038152906040528051906020012090506000806126cc838b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612fcf92505050565b909250905060008160048111156126e5576126e5613fe5565b1480156127005750610130546001600160a01b038381169116145b156127115760019350505050612719565b600093505050505b9695505050505050565b60008082116127345750600061184f565b61013360008481526020019081526020016000206004015482111584604051602001612760919061401f565b6040516020818303038152906040529061278d5760405162461bcd60e51b81526004016108a89190614076565b5060008381526101336020526040902060028101546003909101546127b3908490613ecd565b11156127e45760008381526101336020526040902060038101546002909101546127dd91906140a9565b905061184f565b5092915050565b60008082116127fc5750600061086d565b6000838152610133602052604090206001015461184f9083906140bc565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261239f908590613011565b821561239f57600160009081526101336020527f2268e5b55252839d7cb4baadda5cc1ac7a7ffea49b6689cd90f3df5e995ceb2e546040516334686fad60e21b81526001600160a01b0387811660048301526024820187905284151560448301528392169063d1a1beb49060640160408051808303816000875af1158015612900573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129249190613f1a565b915091508261297157600160009081526101336020527f2268e5b55252839d7cb4baadda5cc1ac7a7ffea49b6689cd90f3df5e995ceb31805487929061296b908490613ecd565b90915550505b600160008190526101336020527f2268e5b55252839d7cb4baadda5cc1ac7a7ffea49b6689cd90f3df5e995ceb2e54604051339260008051602061422e83398151915292612394926001600160a01b039091169187918791908b908b90613f3e565b6000836129e08688613ecd565b6129ea9190613ecd565b905080156116af57601660009081526101336020527febc5e1065ce2d539f3667d3595ce6115645954aba42189f9cf04d60352567151546040516334686fad60e21b81526001600160a01b038a811660048301526024820185905285151560448301528392169063d1a1beb49060640160408051808303816000875af1158015612a78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a9c9190613f1a565b909250905082612aac83836140a9565b612ab7906001613ecd565b14612b145760405162461bcd60e51b815260206004820152602760248201527f496e76616c696420616d6f756e74206f6620426f6f7374657220626f78206973604482015266081b5a5b9d195960ca1b60648201526084016108a8565b8715612be15783612b6357601660009081526101336020527febc5e1065ce2d539f3667d3595ce6115645954aba42189f9cf04d6035256715480548a9290612b5d908490613ecd565b90915550505b60166000526101336020527febc5e1065ce2d539f3667d3595ce6115645954aba42189f9cf04d6035256715154339060008051602061422e833981519152906001600160a01b0316846001612bb88d83613ecd565b612bc291906140a9565b60168a8a604051612bd896959493929190613f3e565b60405180910390a25b8615612cc25783612c3057601560009081526101336020527f32997d22972e1417579e071d4f690ed7c347e7a4ddebd3ed7156211d3b1d3a768054899290612c2a908490613ecd565b90915550505b60156000526101336020527f32997d22972e1417579e071d4f690ed7c347e7a4ddebd3ed7156211d3b1d3a7354339060008051602061422e833981519152906001600160a01b0316612c828b86613ecd565b60018b612c8f8e89613ecd565b612c999190613ecd565b612ca391906140a9565b60158a8a604051612cb996959493929190613f3e565b60405180910390a25b8515612db95783612d1157601460009081526101336020527f3c57a83313455c0fc7a6a0ed3ebb6d6ab30a1c70f74c388f9d4951c6db3518738054889290612d0b908490613ecd565b90915550505b60146000526101336020527f3c57a83313455c0fc7a6a0ed3ebb6d6ab30a1c70f74c388f9d4951c6db35187054339060008051602061422e833981519152906001600160a01b031689612d648c87613ecd565b612d6e9190613ecd565b60018a8c612d7c8f8a613ecd565b612d869190613ecd565b612d909190613ecd565b612d9a91906140a9565b60148a8a604051612db096959493929190613f3e565b60405180910390a25b505050505050505050565b600082612dd28686856130e6565b1490505b949350505050565b600054610100900460ff16612e055760405162461bcd60e51b81526004016108a8906140d3565b612e0d613132565b565b600054610100900460ff16612e365760405162461bcd60e51b81526004016108a8906140d3565b6001600160a01b0382161580612e5357506001600160a01b038116155b15612e71576040516399676b1160e01b815260040160405180910390fd5b6000805462010000600160b01b031916620100006001600160a01b0394851602179055600180546001600160a01b03191691909216179055565b610d5182826123b6565b612ebf8282611856565b610d5157612ecc81613159565b612ed783602061316b565b604051602001612ee892919061411e565b60408051601f198184030181529082905262461bcd60e51b82526108a891600401614076565b6001600160a01b0381163b612f7b5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016108a8565b6000805160206141c783398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b612fb383613307565b600082511180612fc05750805b15610cd25761239f8383613347565b60008082516041036130055760208301516040840151606085015160001a612ff98782858561336c565b94509450505050612274565b50600090506002612274565b6000613066826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166134309092919063ffffffff16565b90508051600014806130875750808060200190518101906130879190613efd565b610cd25760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016108a8565b600081815b84811015613129576131158287878481811061310957613109613df0565b9050602002013561343f565b91508061312181613e1c565b9150506130eb565b50949350505050565b600054610100900460ff166123a55760405162461bcd60e51b81526004016108a8906140d3565b606061086d6001600160a01b03831660145b6060600061317a8360026140bc565b613185906002613ecd565b67ffffffffffffffff81111561319d5761319d6136d6565b6040519080825280601f01601f1916602001820160405280156131c7576020820181803683370190505b509050600360fc1b816000815181106131e2576131e2613df0565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061321157613211613df0565b60200101906001600160f81b031916908160001a90535060006132358460026140bc565b613240906001613ecd565b90505b60018111156132b8576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061327457613274613df0565b1a60f81b82828151811061328a5761328a613df0565b60200101906001600160f81b031916908160001a90535060049490941c936132b181614193565b9050613243565b50831561184f5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016108a8565b61331081612f0e565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b606061184f83836040518060600160405280602781526020016142076027913961346e565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156133a35750600090506003613427565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156133f7573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661342057600060019250925050613427565b9150600090505b94509492505050565b606061184c84846000856134dc565b600081831061345b57600082815260208490526040902061184f565b600083815260208390526040902061184f565b6060600080856001600160a01b03168560405161348b91906141aa565b600060405180830381855af49150503d80600081146134c6576040519150601f19603f3d011682016040523d82523d6000602084013e6134cb565b606091505b5091509150612719868383876135b7565b60608247101561353d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016108a8565b600080866001600160a01b0316858760405161355991906141aa565b60006040518083038185875af1925050503d8060008114613596576040519150601f19603f3d011682016040523d82523d6000602084013e61359b565b606091505b50915091506135ac878383876135b7565b979650505050505050565b6060831561362657825160000361361f576001600160a01b0385163b61361f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016108a8565b5081612dd6565b612dd6838381511561363b5781518083602001fd5b8060405162461bcd60e51b81526004016108a89190614076565b60006020828403121561366757600080fd5b81356001600160e01b03198116811461184f57600080fd5b8015158114610caa57600080fd5b80356136988161367f565b919050565b600080604083850312156136b057600080fd5b82356136bb8161367f565b915060208301356136cb8161367f565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613715576137156136d6565b604052919050565b6000602080838503121561373057600080fd5b823567ffffffffffffffff8082111561374857600080fd5b818501915085601f83011261375c57600080fd5b81358181111561376e5761376e6136d6565b8060051b915061377f8483016136ec565b818152918301840191848101908884111561379957600080fd5b938501935b838510156137b75784358252938501939085019061379e565b98975050505050505050565b6000602082840312156137d557600080fd5b5035919050565b6001600160a01b0381168114610caa57600080fd5b8035613698816137dc565b6000806040838503121561380f57600080fd5b8235915060208301356136cb816137dc565b60006020828403121561383357600080fd5b813561184f816137dc565b60008083601f84011261385057600080fd5b50813567ffffffffffffffff81111561386857600080fd5b6020830191508360208260051b850101111561227457600080fd5b60008060008060008060008060a0898b03121561389f57600080fd5b883567ffffffffffffffff808211156138b757600080fd5b6138c38c838d0161383e565b909a50985060208b01359150808211156138dc57600080fd5b818b0191508b601f8301126138f057600080fd5b8135818111156138ff57600080fd5b8c602082850101111561391157600080fd5b6020830198508097505060408b0135955060608b013591508082111561393657600080fd5b506139438b828c0161383e565b9094509250613956905060808a0161368d565b90509295985092959890939650565b6000806040838503121561397857600080fd5b8235613983816137dc565b915060208381013567ffffffffffffffff808211156139a157600080fd5b818601915086601f8301126139b557600080fd5b8135818111156139c7576139c76136d6565b6139d9601f8201601f191685016136ec565b915080825287848285010111156139ef57600080fd5b80848401858401376000848284010152508093505050509250929050565b600060208284031215613a1f57600080fd5b813561184f8161367f565b60008060008060008060c08789031215613a4357600080fd5b8635613a4e816137dc565b9860208801359850604088013597606081013597506080810135965060a00135945092505050565b60008060208385031215613a8957600080fd5b823567ffffffffffffffff811115613aa057600080fd5b613aac8582860161383e565b90969095509350505050565b602080825282518282018190526000919060409081850190868401855b82811015613b045781518051855286810151878601528501518585015260609093019290850190600101613ad5565b5091979650505050505050565b600080600060408486031215613b2657600080fd5b8335613b31816137dc565b9250602084013567ffffffffffffffff811115613b4d57600080fd5b613b598682870161383e565b9497909650939450505050565b60008060408385031215613b7957600080fd5b8235613b848161367f565b946020939093013593505050565b6020808252825182820181905260009190848201906040850190845b81811015613bcc578351151583529284019291840191600101613bae565b50909695505050505050565b60008060408385031215613beb57600080fd5b8235613bf6816137dc565b915060208301356136cb816137dc565b600080600080600080600080600080600060e08c8e031215613c2757600080fd5b67ffffffffffffffff808d351115613c3e57600080fd5b613c4b8e8e358f0161383e565b909c509a5060208d0135811015613c6157600080fd5b613c718e60208f01358f0161383e565b909a50985060408d0135811015613c8757600080fd5b613c978e60408f01358f0161383e565b909850965060608d0135811015613cad57600080fd5b50613cbe8d60608e01358e0161383e565b9095509350613ccf60808d016137f1565b9250613cdd60a08d016137f1565b9150613ceb60c08d016137f1565b90509295989b509295989b9093969950565b60008060008060008060008060006101208a8c031215613d1c57600080fd5b8935613d27816137dc565b985060208a0135613d37816137dc565b975060408a0135613d47816137dc565b965060608a0135613d57816137dc565b955060808a0135613d67816137dc565b945060a08a0135613d77816137dc565b935060c08a0135613d87816137dc565b925060e08a0135613d97816137dc565b91506101008a0135613da8816137dc565b809150509295985092959850929598565b6020808252601f908201527f43616c6c657220646f6573206e6f742068617665207065726d697373696f6e00604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201613e2e57613e2e613e06565b5060010190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b8082018082111561086d5761086d613e06565b600060208284031215613ef257600080fd5b815161184f816137dc565b600060208284031215613f0f57600080fd5b815161184f8161367f565b60008060408385031215613f2d57600080fd5b505080516020909101519092909150565b6001600160a01b0396909616865260208601949094526040850192909252606084015215156080830152151560a082015260c00190565b600060208284031215613f8757600080fd5b5051919050565b6001600160a01b038616815260208101859052608060408201819052810183905260006001600160fb1b03841115613fc557600080fd5b8360051b808660a08501379215156060830152500160a001949350505050565b634e487b7160e01b600052602160045260246000fd5b60005b83811015614016578181015183820152602001613ffe565b50506000910152565b60008251614031818460208701613ffb565b7f2063616e6e6f74207075726368617365206d6f7265207468616e2074686520619201918252506c1b1b1bdd1d1959081b1a5b5a5d609a1b6020820152602d01919050565b6020815260008251806020840152614095816040850160208701613ffb565b601f01601f19169190910160400192915050565b8181038181111561086d5761086d613e06565b808202811582820484141761086d5761086d613e06565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351614156816017850160208801613ffb565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351614187816028840160208801613ffb565b01602801949350505050565b6000816141a2576141a2613e06565b506000190190565b600082516141bc818460208701613ffb565b919091019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b929416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564c2ecce86b9fe22044f8dae8b3b5d38734243cca0d3f91cbe36887c897b04c59fa2646970667358221220217822a143853d2fd76381a5278006935cac2bca927b319803ffc35ba14546ae64736f6c63430008120033
Deployed Bytecode
0x60806040526004361061023b5760003560e01c8063670164151161012e578063c5d7bd67116100ab578063e454fa7d1161006f578063e454fa7d14610786578063ec0a2af8146107a6578063ecd00261146107c6578063f5b541a6146107fa578063f5e95acb1461081c57600080fd5b8063c5d7bd67146106bd578063cb37f3b2146106ee578063d07ce7b61461070f578063d547741f14610746578063d5b1e9c81461076657600080fd5b80639bb906e0116100f25780639bb906e014610610578063a217fddf14610627578063a40cfcff1461063c578063a7ca8c7d1461065c578063b25e86221461069057600080fd5b8063670164151461056157806368404efc146105815780636b1c802f146105a35780638f4b3c02146105d057806391d14854146105f057600080fd5b80633659cfe6116101bc5780634f1ef286116101805780634f1ef286146104d857806352d1902d146104eb57806358c58681146105005780635c764c0414610520578063626e61bc1461054057600080fd5b80633659cfe6146103d557806339be1683146103f557806342e2d4e31461041557806348531614146104365780634ed3faf21461045157600080fd5b80632866ed21116102035780632866ed211461032e5780632cd5859e1461034e5780632f2ff15d146103745780633013ce291461039457806336568abe146103b557600080fd5b806301ffc9a71461024057806306d5bba7146102755780630f1a1dbe14610297578063211339b9146102b7578063248a9ca3146102f0575b600080fd5b34801561024c57600080fd5b5061026061025b366004613655565b61083c565b60405190151581526020015b60405180910390f35b34801561028157600080fd5b5061029561029036600461369d565b610873565b005b3480156102a357600080fd5b506102956102b236600461371d565b6108d7565b3480156102c357600080fd5b5061012e546102d8906001600160a01b031681565b6040516001600160a01b03909116815260200161026c565b3480156102fc57600080fd5b5061032061030b3660046137c3565b60009081526066602052604090206001015490565b60405190815260200161026c565b34801561033a57600080fd5b506101365461026090610100900460ff1681565b34801561035a57600080fd5b506000546102d8906201000090046001600160a01b031681565b34801561038057600080fd5b5061029561038f3660046137fc565b610cad565b3480156103a057600080fd5b50610131546102d8906001600160a01b031681565b3480156103c157600080fd5b506102956103d03660046137fc565b610cd7565b3480156103e157600080fd5b506102956103f0366004613821565b610d55565b34801561040157600080fd5b50610295610410366004613883565b610e31565b34801561042157600080fd5b50610130546102d8906001600160a01b031681565b34801561044257600080fd5b50610136546102609060ff1681565b34801561045d57600080fd5b506104a661046c3660046137c3565b61013360205260009081526040902080546001820154600283015460038401546004909401546001600160a01b0390931693919290919085565b604080516001600160a01b0390961686526020860194909452928401919091526060830152608082015260a00161026c565b6102956104e6366004613965565b6113a7565b3480156104f757600080fd5b50610320611473565b34801561050c57600080fd5b5061029561051b366004613a0d565b611526565b34801561052c57600080fd5b5061029561053b366004613821565b61157b565b34801561054c57600080fd5b50610136546102609062010000900460ff1681565b34801561056d57600080fd5b5061029561057c366004613a2a565b61162a565b34801561058d57600080fd5b5061013654610260906301000000900460ff1681565b3480156105af57600080fd5b506105c36105be366004613a76565b6116b8565b60405161026c9190613ab8565b3480156105dc57600080fd5b506102606105eb366004613b11565b611803565b3480156105fc57600080fd5b5061026061060b3660046137fc565b611856565b34801561061c57600080fd5b506103206101325481565b34801561063357600080fd5b50610320600081565b34801561064857600080fd5b50610295610657366004613b66565b611881565b34801561066857600080fd5b506103207f82ce2ced7fc86cde9b16f1f3a5508a82078c42c54a7cf0af011ce529199a18bb81565b34801561069c57600080fd5b506106b06106ab366004613a76565b6118d9565b60405161026c9190613b92565b3480156106c957600080fd5b506102606106d8366004613821565b6101356020526000908152604090205460ff1681565b3480156106fa57600080fd5b5061012f546102d8906001600160a01b031681565b34801561071b57600080fd5b506102d861072a3660046137c3565b610134602052600090815260409020546001600160a01b031681565b34801561075257600080fd5b506102956107613660046137fc565b6119cd565b34801561077257600080fd5b50610295610781366004613bd8565b6119f2565b34801561079257600080fd5b506001546102d8906001600160a01b031681565b3480156107b257600080fd5b506102956107c1366004613c06565b611afc565b3480156107d257600080fd5b506103207ffc425f2263d0df187444b70e47283d622c70181c5baebb1306a01edba1ce184c81565b34801561080657600080fd5b506103206000805160206141e783398151915281565b34801561082857600080fd5b50610295610837366004613cfd565b611e41565b60006001600160e01b03198216637965db0b60e01b148061086d57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6000805160206141e783398151915261088c8133611856565b6108b15760405162461bcd60e51b81526004016108a890613db9565b60405180910390fd5b50610136805461ffff191692151561ff0019169290921761010091151591909102179055565b6108df61204d565b61013654610100900460ff166109375760405162461bcd60e51b815260206004820152601d60248201527f436c61696d426f7820686173206e6f74206265656e20656e61626c656400000060448201526064016108a8565b600081511161097f5760405162461bcd60e51b8152602060048201526014602482015273125b9d985b1a59081d1bdad95b9259081b1a5cdd60621b60448201526064016108a8565b6000815167ffffffffffffffff81111561099b5761099b6136d6565b6040519080825280602002602001820160405280156109c4578160200160208202803683370190505b5082519091506000805b8215610c9c576000805b84811015610c7b5761012e5487516000918291610a18916001600160a01b0316908b9086908110610a0b57610a0b613df0565b60200260200101516120a6565b9150915081610a7d5760405162461bcd60e51b815260206004820152602b60248201527f4163636f756e7420646f65736e2774206861766520616c6c2070726f6d6f746560448201526a20746f6b656e204e46547360a81b60648201526084016108a8565b6001600160a01b038616610a8f578095505b806001600160a01b0316866001600160a01b031603610c21576001600160a01b038116610b0d5760405162461bcd60e51b815260206004820152602660248201527f546f6b656e206f776e65722073686f756c64206e6f74206265207a65726f206160448201526564647265737360d01b60648201526084016108a8565b60006001600160a01b031661013460008b8681518110610b2f57610b2f613df0565b6020908102919091018101518252810191909152604001600020546001600160a01b031614610bbc5760405162461bcd60e51b815260206004820152603360248201527f4f6e65206f662070726f6d6f746520746f6b656e20746f6b656e4964732068616044820152721cc8185b1c9958591e481899595b881d5cd959606a1b60648201526084016108a8565b8061013460008b8681518110610bd457610bd4613df0565b6020026020010151815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055508380610c1990613e1c565b945050610c66565b888381518110610c3357610c33613df0565b6020026020010151888681518110610c4d57610c4d613df0565b602090810291909101015284610c6281613e1c565b9550505b50508080610c7390613e1c565b9150506109d8565b50610c8a83826001600061227b565b509293508392915060009050806109ce565b50505050610caa600160fc55565b50565b600082815260666020526040902060010154610cc8816123ac565b610cd283836123b6565b505050565b6001600160a01b0381163314610d475760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016108a8565b610d51828261243c565b5050565b6001600160a01b037f000000000000000000000000165da95a6d63358d0c8d193815eca1fc0e6806e6163003610d9d5760405162461bcd60e51b81526004016108a890613e35565b7f000000000000000000000000165da95a6d63358d0c8d193815eca1fc0e6806e66001600160a01b0316610de66000805160206141c7833981519152546001600160a01b031690565b6001600160a01b031614610e0c5760405162461bcd60e51b81526004016108a890613e81565b610e15816124a3565b60408051600080825260208201909252610caa918391906124ea565b610e3961204d565b83431115610e895760405162461bcd60e51b815260206004820152601760248201527f5472616e73616374696f6e20686173206578706972656400000000000000000060448201526064016108a8565b60048214610ed25760405162461bcd60e51b8152602060048201526016602482015275125b9d985b1a5908189bde0818dbdd5b9d081b1a5cdd60521b60448201526064016108a8565b600183836003818110610ee757610ee7613df0565b9050602002013584846002818110610f0157610f01613df0565b9050602002013585856001818110610f1b57610f1b613df0565b9050602002013586866000818110610f3557610f35613df0565b90506020020135610f469190613ecd565b610f509190613ecd565b610f5a9190613ecd565b1015610fb95760405162461bcd60e51b815260206004820152602860248201527f546f74616c20626f7820636f756e742073686f756c642062652067726561746560448201526772207468616e203160c01b60648201526084016108a8565b6101365460ff1661100c5760405162461bcd60e51b815260206004820152601b60248201527f427579426f7820686173206e6f74206265656e20656e61626c6564000000000060448201526064016108a8565b61101a868686868686612655565b61105a5760405162461bcd60e51b8152602060048201526011602482015270496e76616c6964207369676e617475726560781b60448201526064016108a8565b610136546301000000900460ff16156110e457336000908152610135602052604090205460ff16156110e45760405162461bcd60e51b815260206004820152602d60248201527f4163636f756e742068617320616c72656164792070617274696369706174656460448201526c20696e20746869732073616c6560981b60648201526084016108a8565b6101365462010000900460ff161561115957611101338989611803565b6111595760405162461bcd60e51b815260206004820152602360248201527f57616c6c6574206164647265737320686173206e6f74206265656e20616c6c6f6044820152621dd95960ea1b60648201526084016108a8565b60006111a46040518060400160405280600c81526020016b09ac2d4cae6e8d2c64084def60a31b81525060018686600081811061119857611198613df0565b90506020020135612723565b905060006111ea60405180604001604052806011815260200170084dedee6e8cae4408482a692864084def607b1b81525060168787600181811061119857611198613df0565b9050600061123260405180604001604052806013815260200172084dedee6e8cae440a0a48a9a92aa9a4084def606b1b81525060158888600281811061119857611198613df0565b9050600061127860405180604001604052806011815260200170084dedee6e8cae4409e9a8a8e824084def607b1b81525060148989600381811061119857611198613df0565b9050600081836112888688613ecd565b6112929190613ecd565b61129c9190613ecd565b116112e95760405162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e7420616d6f756e74206f6620626f7865730000000060448201526064016108a8565b61013154611357906001600160a01b03163361012f546001600160a01b03166113136014866127eb565b61131e6015886127eb565b61132960168a6127eb565b61133460018c6127eb565b61133e9190613ecd565b6113489190613ecd565b6113529190613ecd565b61281a565b33600081815261013560205260408120805460ff19166001179055611380919086908890612874565b61138f338484848960006129d3565b5050505061139d600160fc55565b5050505050505050565b6001600160a01b037f000000000000000000000000165da95a6d63358d0c8d193815eca1fc0e6806e61630036113ef5760405162461bcd60e51b81526004016108a890613e35565b7f000000000000000000000000165da95a6d63358d0c8d193815eca1fc0e6806e66001600160a01b03166114386000805160206141c7833981519152546001600160a01b031690565b6001600160a01b03161461145e5760405162461bcd60e51b81526004016108a890613e81565b611467826124a3565b610d51828260016124ea565b6000306001600160a01b037f000000000000000000000000165da95a6d63358d0c8d193815eca1fc0e6806e616146115135760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c000000000000000060648201526084016108a8565b506000805160206141c783398151915290565b6000805160206141e783398151915261153f8133611856565b61155b5760405162461bcd60e51b81526004016108a890613db9565b50610136805491151563010000000263ff00000019909216919091179055565b6000805160206141e78339815191526115948133611856565b6115b05760405162461bcd60e51b81526004016108a890613db9565b6001600160a01b0382166116065760405162461bcd60e51b815260206004820152601b60248201527f5a65726f20616464726573732063616e6e6f742062652075736564000000000060448201526064016108a8565b5061013080546001600160a01b0319166001600160a01b0392909216919091179055565b7f82ce2ced7fc86cde9b16f1f3a5508a82078c42c54a7cf0af011ce529199a18bb6116558133611856565b6116715760405162461bcd60e51b81526004016108a890613db9565b61167961204d565b611687878760006001612874565b61169787868686600060016129d3565b6116a587836000600161227b565b6116af600160fc55565b50505050505050565b606060008267ffffffffffffffff8111156116d5576116d56136d6565b60405190808252806020026020018201604052801561172a57816020015b61171760405180606001604052806000815260200160008152602001600081525090565b8152602001906001900390816116f35790505b50905060005b838110156117fb57600085858381811061174c5761174c613df0565b90506020020135905061013360008281526020019081526020016000206003015483838151811061177f5761177f613df0565b602002602001015160400181815250506101336000828152602001908152602001600020600201548383815181106117b9576117b9613df0565b60200260200101516020018181525050808383815181106117dc576117dc613df0565b60209081029190910101515250806117f381613e1c565b915050611730565b509392505050565b610132546040516bffffffffffffffffffffffff19606086901b16602082015260009161184c918591859160340160405160208183030381529060405280519060200120612dc4565b90505b9392505050565b60009182526066602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6000805160206141e783398151915261189a8133611856565b6118b65760405162461bcd60e51b81526004016108a890613db9565b506101368054921515620100000262ff0000199093169290921790915561013255565b606060008267ffffffffffffffff8111156118f6576118f66136d6565b60405190808252806020026020018201604052801561191f578160200160208202803683370190505b50905060005b838110156117fb5760006101348187878581811061194557611945613df0565b60209081029290920135835250810191909152604001600020546001600160a01b03161461199657600182828151811061198157611981613df0565b911515602092830291909101909101526119bb565b60008282815181106119aa576119aa613df0565b911515602092830291909101909101525b806119c581613e1c565b915050611925565b6000828152606660205260409020600101546119e8816123ac565b610cd2838361243c565b6000805160206141e7833981519152611a0b8133611856565b611a275760405162461bcd60e51b81526004016108a890613db9565b6001600160a01b038316611a7d5760405162461bcd60e51b815260206004820152601860248201527f496e76616c6964207061796d656e74207265636569766572000000000000000060448201526064016108a8565b6001600160a01b038216611acb5760405162461bcd60e51b815260206004820152601560248201527424b73b30b634b2103830bcb6b2b73a103a37b5b2b760591b60448201526064016108a8565b5061012f80546001600160a01b039384166001600160a01b0319918216179091556101318054929093169116179055565b6000805160206141e7833981519152611b158133611856565b611b315760405162461bcd60e51b81526004016108a890613db9565b8a8914611b805760405162461bcd60e51b815260206004820181905260248201527f496e76616c6964206172726179206c656e677468206174206d6178436f756e7460448201526064016108a8565b8a8714611bdb5760405162461bcd60e51b8152602060048201526024808201527f496e76616c6964206172726179206c656e677468206174206163636f756e744c6044820152631a5b5a5d60e21b60648201526084016108a8565b8a8514611c2a5760405162461bcd60e51b815260206004820152601d60248201527f496e76616c6964206172726179206c656e67746820617420707269636500000060448201526064016108a8565b60005b8b811015611e325760018d8d83818110611c4957611c49613df0565b9050602002013503611cae578461013360008f8f85818110611c6d57611c6d613df0565b90506020020135815260200190815260200160002060000160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550611d3b565b601e8d8d83818110611cc257611cc2613df0565b9050602002013503611ce6578261013360008f8f85818110611c6d57611c6d613df0565b8361013360008f8f85818110611cfe57611cfe613df0565b90506020020135815260200190815260200160002060000160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b868682818110611d4d57611d4d613df0565b9050602002013561013360008f8f85818110611d6b57611d6b613df0565b905060200201358152602001908152602001600020600101819055508a8a82818110611d9957611d99613df0565b9050602002013561013360008f8f85818110611db757611db7613df0565b90506020020135815260200190815260200160002060020181905550888882818110611de557611de5613df0565b9050602002013561013360008f8f85818110611e0357611e03613df0565b905060200201358152602001908152602001600020600401819055508080611e2a90613e1c565b915050611c2d565b50505050505050505050505050565b600054610100900460ff1615808015611e615750600054600160ff909116105b80611e7b5750303b158015611e7b575060005460ff166001145b611ede5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016108a8565b6000805460ff191660011790558015611f01576000805461ff0019166101001790555b61012f80546001600160a01b03199081166001600160a01b03888116919091179092556101318054821687841617905561012e805482168b84161790556101308054909116918816919091179055610136805463ffffffff19166301010001179055611f6b612dde565b611f758383612e0f565b611f8060008b612eab565b611f986000805160206141e78339815191528a612eab565b611fc27f82ce2ced7fc86cde9b16f1f3a5508a82078c42c54a7cf0af011ce529199a18bb88612eab565b611fec7ffc425f2263d0df187444b70e47283d622c70181c5baebb1306a01edba1ce184c33612eab565b8015612032576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050505050565b6001600160a01b03163b151590565b600260fc540361209f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016108a8565b600260fc55565b6000806000846001600160a01b0316636352211e856040518263ffffffff1660e01b81526004016120d991815260200190565b602060405180830381865afa1580156120f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061211a9190613ee0565b90506001600160a01b038116612143576040516399676b1160e01b815260040160405180910390fd5b336001600160a01b03821614806121e657506000546040516307ca74b760e21b81526001600160a01b038781166004830152602482018790526201000090920490911690631f29d2dc90604401602060405180830381865afa1580156121ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121d19190613ee0565b6001600160a01b0316336001600160a01b0316145b8061226f5750600154604051631574d39f60e31b81523360048201526001600160a01b0383811660248301528781166044830152606482018790529091169063aba69cf890608401602060405180830381865afa15801561224b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061226f9190613efd565b925090505b9250929050565b821561239f57601e60009081526101336020527ff1a3db9a79cd016adee65e5daf8b6502a23f170e3010ebc22bd2da4749a5c17a546040516334686fad60e21b81526001600160a01b0387811660048301526024820187905284151560448301528392169063d1a1beb49060640160408051808303816000875af1158015612307573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061232b9190613f1a565b601e60008190526101336020527ff1a3db9a79cd016adee65e5daf8b6502a23f170e3010ebc22bd2da4749a5c17a546040519395509193506001600160a01b03808a169360008051602061422e833981519152936123949392169187918791908b908b90613f3e565b60405180910390a250505b50505050565b600160fc55565b610caa8133612eb5565b6123c08282611856565b610d515760008281526066602090815260408083206001600160a01b03851684529091529020805460ff191660011790556123f83390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6124468282611856565b15610d515760008281526066602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b7ffc425f2263d0df187444b70e47283d622c70181c5baebb1306a01edba1ce184c6124ce8133611856565b610d515760405162461bcd60e51b81526004016108a890613db9565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff161561251d57610cd283612f0e565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015612577575060408051601f3d908101601f1916820190925261257491810190613f75565b60015b6125da5760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b60648201526084016108a8565b6000805160206141c783398151915281146126495760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b60648201526084016108a8565b50610cd2838383612faa565b6000803386868686604051602001612671959493929190613f8e565b6040516020818303038152906040528051906020012090506000806126cc838b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612fcf92505050565b909250905060008160048111156126e5576126e5613fe5565b1480156127005750610130546001600160a01b038381169116145b156127115760019350505050612719565b600093505050505b9695505050505050565b60008082116127345750600061184f565b61013360008481526020019081526020016000206004015482111584604051602001612760919061401f565b6040516020818303038152906040529061278d5760405162461bcd60e51b81526004016108a89190614076565b5060008381526101336020526040902060028101546003909101546127b3908490613ecd565b11156127e45760008381526101336020526040902060038101546002909101546127dd91906140a9565b905061184f565b5092915050565b60008082116127fc5750600061086d565b6000838152610133602052604090206001015461184f9083906140bc565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261239f908590613011565b821561239f57600160009081526101336020527f2268e5b55252839d7cb4baadda5cc1ac7a7ffea49b6689cd90f3df5e995ceb2e546040516334686fad60e21b81526001600160a01b0387811660048301526024820187905284151560448301528392169063d1a1beb49060640160408051808303816000875af1158015612900573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129249190613f1a565b915091508261297157600160009081526101336020527f2268e5b55252839d7cb4baadda5cc1ac7a7ffea49b6689cd90f3df5e995ceb31805487929061296b908490613ecd565b90915550505b600160008190526101336020527f2268e5b55252839d7cb4baadda5cc1ac7a7ffea49b6689cd90f3df5e995ceb2e54604051339260008051602061422e83398151915292612394926001600160a01b039091169187918791908b908b90613f3e565b6000836129e08688613ecd565b6129ea9190613ecd565b905080156116af57601660009081526101336020527febc5e1065ce2d539f3667d3595ce6115645954aba42189f9cf04d60352567151546040516334686fad60e21b81526001600160a01b038a811660048301526024820185905285151560448301528392169063d1a1beb49060640160408051808303816000875af1158015612a78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a9c9190613f1a565b909250905082612aac83836140a9565b612ab7906001613ecd565b14612b145760405162461bcd60e51b815260206004820152602760248201527f496e76616c696420616d6f756e74206f6620426f6f7374657220626f78206973604482015266081b5a5b9d195960ca1b60648201526084016108a8565b8715612be15783612b6357601660009081526101336020527febc5e1065ce2d539f3667d3595ce6115645954aba42189f9cf04d6035256715480548a9290612b5d908490613ecd565b90915550505b60166000526101336020527febc5e1065ce2d539f3667d3595ce6115645954aba42189f9cf04d6035256715154339060008051602061422e833981519152906001600160a01b0316846001612bb88d83613ecd565b612bc291906140a9565b60168a8a604051612bd896959493929190613f3e565b60405180910390a25b8615612cc25783612c3057601560009081526101336020527f32997d22972e1417579e071d4f690ed7c347e7a4ddebd3ed7156211d3b1d3a768054899290612c2a908490613ecd565b90915550505b60156000526101336020527f32997d22972e1417579e071d4f690ed7c347e7a4ddebd3ed7156211d3b1d3a7354339060008051602061422e833981519152906001600160a01b0316612c828b86613ecd565b60018b612c8f8e89613ecd565b612c999190613ecd565b612ca391906140a9565b60158a8a604051612cb996959493929190613f3e565b60405180910390a25b8515612db95783612d1157601460009081526101336020527f3c57a83313455c0fc7a6a0ed3ebb6d6ab30a1c70f74c388f9d4951c6db3518738054889290612d0b908490613ecd565b90915550505b60146000526101336020527f3c57a83313455c0fc7a6a0ed3ebb6d6ab30a1c70f74c388f9d4951c6db35187054339060008051602061422e833981519152906001600160a01b031689612d648c87613ecd565b612d6e9190613ecd565b60018a8c612d7c8f8a613ecd565b612d869190613ecd565b612d909190613ecd565b612d9a91906140a9565b60148a8a604051612db096959493929190613f3e565b60405180910390a25b505050505050505050565b600082612dd28686856130e6565b1490505b949350505050565b600054610100900460ff16612e055760405162461bcd60e51b81526004016108a8906140d3565b612e0d613132565b565b600054610100900460ff16612e365760405162461bcd60e51b81526004016108a8906140d3565b6001600160a01b0382161580612e5357506001600160a01b038116155b15612e71576040516399676b1160e01b815260040160405180910390fd5b6000805462010000600160b01b031916620100006001600160a01b0394851602179055600180546001600160a01b03191691909216179055565b610d5182826123b6565b612ebf8282611856565b610d5157612ecc81613159565b612ed783602061316b565b604051602001612ee892919061411e565b60408051601f198184030181529082905262461bcd60e51b82526108a891600401614076565b6001600160a01b0381163b612f7b5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016108a8565b6000805160206141c783398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b612fb383613307565b600082511180612fc05750805b15610cd25761239f8383613347565b60008082516041036130055760208301516040840151606085015160001a612ff98782858561336c565b94509450505050612274565b50600090506002612274565b6000613066826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166134309092919063ffffffff16565b90508051600014806130875750808060200190518101906130879190613efd565b610cd25760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016108a8565b600081815b84811015613129576131158287878481811061310957613109613df0565b9050602002013561343f565b91508061312181613e1c565b9150506130eb565b50949350505050565b600054610100900460ff166123a55760405162461bcd60e51b81526004016108a8906140d3565b606061086d6001600160a01b03831660145b6060600061317a8360026140bc565b613185906002613ecd565b67ffffffffffffffff81111561319d5761319d6136d6565b6040519080825280601f01601f1916602001820160405280156131c7576020820181803683370190505b509050600360fc1b816000815181106131e2576131e2613df0565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061321157613211613df0565b60200101906001600160f81b031916908160001a90535060006132358460026140bc565b613240906001613ecd565b90505b60018111156132b8576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061327457613274613df0565b1a60f81b82828151811061328a5761328a613df0565b60200101906001600160f81b031916908160001a90535060049490941c936132b181614193565b9050613243565b50831561184f5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016108a8565b61331081612f0e565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b606061184f83836040518060600160405280602781526020016142076027913961346e565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156133a35750600090506003613427565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156133f7573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661342057600060019250925050613427565b9150600090505b94509492505050565b606061184c84846000856134dc565b600081831061345b57600082815260208490526040902061184f565b600083815260208390526040902061184f565b6060600080856001600160a01b03168560405161348b91906141aa565b600060405180830381855af49150503d80600081146134c6576040519150601f19603f3d011682016040523d82523d6000602084013e6134cb565b606091505b5091509150612719868383876135b7565b60608247101561353d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016108a8565b600080866001600160a01b0316858760405161355991906141aa565b60006040518083038185875af1925050503d8060008114613596576040519150601f19603f3d011682016040523d82523d6000602084013e61359b565b606091505b50915091506135ac878383876135b7565b979650505050505050565b6060831561362657825160000361361f576001600160a01b0385163b61361f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016108a8565b5081612dd6565b612dd6838381511561363b5781518083602001fd5b8060405162461bcd60e51b81526004016108a89190614076565b60006020828403121561366757600080fd5b81356001600160e01b03198116811461184f57600080fd5b8015158114610caa57600080fd5b80356136988161367f565b919050565b600080604083850312156136b057600080fd5b82356136bb8161367f565b915060208301356136cb8161367f565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613715576137156136d6565b604052919050565b6000602080838503121561373057600080fd5b823567ffffffffffffffff8082111561374857600080fd5b818501915085601f83011261375c57600080fd5b81358181111561376e5761376e6136d6565b8060051b915061377f8483016136ec565b818152918301840191848101908884111561379957600080fd5b938501935b838510156137b75784358252938501939085019061379e565b98975050505050505050565b6000602082840312156137d557600080fd5b5035919050565b6001600160a01b0381168114610caa57600080fd5b8035613698816137dc565b6000806040838503121561380f57600080fd5b8235915060208301356136cb816137dc565b60006020828403121561383357600080fd5b813561184f816137dc565b60008083601f84011261385057600080fd5b50813567ffffffffffffffff81111561386857600080fd5b6020830191508360208260051b850101111561227457600080fd5b60008060008060008060008060a0898b03121561389f57600080fd5b883567ffffffffffffffff808211156138b757600080fd5b6138c38c838d0161383e565b909a50985060208b01359150808211156138dc57600080fd5b818b0191508b601f8301126138f057600080fd5b8135818111156138ff57600080fd5b8c602082850101111561391157600080fd5b6020830198508097505060408b0135955060608b013591508082111561393657600080fd5b506139438b828c0161383e565b9094509250613956905060808a0161368d565b90509295985092959890939650565b6000806040838503121561397857600080fd5b8235613983816137dc565b915060208381013567ffffffffffffffff808211156139a157600080fd5b818601915086601f8301126139b557600080fd5b8135818111156139c7576139c76136d6565b6139d9601f8201601f191685016136ec565b915080825287848285010111156139ef57600080fd5b80848401858401376000848284010152508093505050509250929050565b600060208284031215613a1f57600080fd5b813561184f8161367f565b60008060008060008060c08789031215613a4357600080fd5b8635613a4e816137dc565b9860208801359850604088013597606081013597506080810135965060a00135945092505050565b60008060208385031215613a8957600080fd5b823567ffffffffffffffff811115613aa057600080fd5b613aac8582860161383e565b90969095509350505050565b602080825282518282018190526000919060409081850190868401855b82811015613b045781518051855286810151878601528501518585015260609093019290850190600101613ad5565b5091979650505050505050565b600080600060408486031215613b2657600080fd5b8335613b31816137dc565b9250602084013567ffffffffffffffff811115613b4d57600080fd5b613b598682870161383e565b9497909650939450505050565b60008060408385031215613b7957600080fd5b8235613b848161367f565b946020939093013593505050565b6020808252825182820181905260009190848201906040850190845b81811015613bcc578351151583529284019291840191600101613bae565b50909695505050505050565b60008060408385031215613beb57600080fd5b8235613bf6816137dc565b915060208301356136cb816137dc565b600080600080600080600080600080600060e08c8e031215613c2757600080fd5b67ffffffffffffffff808d351115613c3e57600080fd5b613c4b8e8e358f0161383e565b909c509a5060208d0135811015613c6157600080fd5b613c718e60208f01358f0161383e565b909a50985060408d0135811015613c8757600080fd5b613c978e60408f01358f0161383e565b909850965060608d0135811015613cad57600080fd5b50613cbe8d60608e01358e0161383e565b9095509350613ccf60808d016137f1565b9250613cdd60a08d016137f1565b9150613ceb60c08d016137f1565b90509295989b509295989b9093969950565b60008060008060008060008060006101208a8c031215613d1c57600080fd5b8935613d27816137dc565b985060208a0135613d37816137dc565b975060408a0135613d47816137dc565b965060608a0135613d57816137dc565b955060808a0135613d67816137dc565b945060a08a0135613d77816137dc565b935060c08a0135613d87816137dc565b925060e08a0135613d97816137dc565b91506101008a0135613da8816137dc565b809150509295985092959850929598565b6020808252601f908201527f43616c6c657220646f6573206e6f742068617665207065726d697373696f6e00604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201613e2e57613e2e613e06565b5060010190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b8082018082111561086d5761086d613e06565b600060208284031215613ef257600080fd5b815161184f816137dc565b600060208284031215613f0f57600080fd5b815161184f8161367f565b60008060408385031215613f2d57600080fd5b505080516020909101519092909150565b6001600160a01b0396909616865260208601949094526040850192909252606084015215156080830152151560a082015260c00190565b600060208284031215613f8757600080fd5b5051919050565b6001600160a01b038616815260208101859052608060408201819052810183905260006001600160fb1b03841115613fc557600080fd5b8360051b808660a08501379215156060830152500160a001949350505050565b634e487b7160e01b600052602160045260246000fd5b60005b83811015614016578181015183820152602001613ffe565b50506000910152565b60008251614031818460208701613ffb565b7f2063616e6e6f74207075726368617365206d6f7265207468616e2074686520619201918252506c1b1b1bdd1d1959081b1a5b5a5d609a1b6020820152602d01919050565b6020815260008251806020840152614095816040850160208701613ffb565b601f01601f19169190910160400192915050565b8181038181111561086d5761086d613e06565b808202811582820484141761086d5761086d613e06565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351614156816017850160208801613ffb565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351614187816028840160208801613ffb565b01602801949350505050565b6000816141a2576141a2613e06565b506000190190565b600082516141bc818460208701613ffb565b919091019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b929416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564c2ecce86b9fe22044f8dae8b3b5d38734243cca0d3f91cbe36887c897b04c59fa2646970667358221220217822a143853d2fd76381a5278006935cac2bca927b319803ffc35ba14546ae64736f6c63430008120033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
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.