Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- CWDToken
- Optimization enabled
- true
- Compiler version
- v0.8.28+commit.7893614a
- Optimization runs
- 200
- EVM Version
- shanghai
- Verified at
- 2025-10-13T06:58:24.304067Z
contracts/CWDToken.sol
// SPDX-License-Identifier: MIT pragma solidity 0.8.28; import {ERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; import {ERC20BurnableUpgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol"; import {ERC20PausableUpgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20PausableUpgradeable.sol"; import {AccessControlUpgradeable} from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {ReentrancyGuardUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol"; /// @title CWDToken - Crypto Wars Dollar /// @notice Stablecoin for in-game currency, purchasable with ETH or ERC20 tokens /// @dev Implements UUPS upgradeable pattern with role-based access control contract CWDToken is Initializable, ERC20Upgradeable, ERC20BurnableUpgradeable, ERC20PausableUpgradeable, AccessControlUpgradeable, ReentrancyGuardUpgradeable, UUPSUpgradeable { using SafeERC20 for IERC20; bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); bytes32 public constant UPGRADER_ROLE = keccak256("UPGRADER_ROLE"); bytes32 public constant PRICE_MANAGER_ROLE = keccak256("PRICE_MANAGER_ROLE"); bytes32 public constant FAUCET_MANAGER_ROLE = keccak256("FAUCET_MANAGER_ROLE"); /// @notice Price of 1 CWD in wei (default: 0.0001 ETH = 10^14 wei) uint256 public cwdPriceInWei; /// @notice Mapping of supported payment tokens and their prices /// @dev tokenAddress => price per CWD in token's smallest unit mapping(address => uint256) public paymentTokenPrices; /// @notice Treasury address that receives payment funds address public treasury; /// @notice Escrow contract address for transfer whitelist address public escrowContract; /// @notice Amount of CWD claimable from faucet (default: 500 CWD) uint256 public faucetAmount; /// @notice Cooldown period between faucet claims in seconds (default: 24 hours) uint256 public faucetCooldown; /// @notice Mapping of address to last faucet claim timestamp mapping(address => uint256) public lastFaucetClaim; /// @notice Emitted when CWD is purchased with ETH event CWDPurchasedWithETH(address indexed buyer, uint256 cwdAmount, uint256 ethPaid); /// @notice Emitted when CWD is purchased with an ERC20 token event CWDPurchasedWithToken( address indexed buyer, address indexed token, uint256 cwdAmount, uint256 tokenPaid ); /// @notice Emitted when the CWD price is updated event PriceUpdated(uint256 oldPrice, uint256 newPrice); /// @notice Emitted when a payment token is added or updated event PaymentTokenUpdated(address indexed token, uint256 price); /// @notice Emitted when a payment token is removed event PaymentTokenRemoved(address indexed token); /// @notice Emitted when treasury address is updated event TreasuryUpdated(address indexed oldTreasury, address indexed newTreasury); /// @notice Emitted when a user claims from the faucet event FaucetClaim(address indexed user, uint256 amount, uint256 nextClaimTime); /// @notice Emitted when faucet parameters are updated event FaucetConfigured(uint256 amount, uint256 cooldown); /// @notice Emitted when escrow contract is set event EscrowContractSet(address indexed oldEscrow, address indexed newEscrow); /// @custom:oz-upgrades-unsafe-allow constructor constructor() { _disableInitializers(); } /// @notice Initializes the CWDToken contract /// @param defaultAdmin The address that will be granted admin roles /// @param _treasury The address that will receive payment funds /// @param _cwdPriceInWei Initial price of 1 CWD in wei function initialize(address defaultAdmin, address _treasury, uint256 _cwdPriceInWei) public initializer { if (defaultAdmin == address(0) || _treasury == address(0)) { revert InvalidAddress(); } if (_cwdPriceInWei == 0) { revert InvalidAmount(); } __ERC20_init("Crypto Wars Dollar", "CWD"); __ERC20Burnable_init(); __ERC20Pausable_init(); __AccessControl_init(); __ReentrancyGuard_init(); __UUPSUpgradeable_init(); _grantRole(DEFAULT_ADMIN_ROLE, defaultAdmin); _grantRole(MINTER_ROLE, defaultAdmin); _grantRole(PAUSER_ROLE, defaultAdmin); _grantRole(UPGRADER_ROLE, defaultAdmin); _grantRole(PRICE_MANAGER_ROLE, defaultAdmin); _grantRole(FAUCET_MANAGER_ROLE, defaultAdmin); treasury = _treasury; cwdPriceInWei = _cwdPriceInWei; faucetAmount = 500 * 10 ** 18; faucetCooldown = 24 hours; } /// @notice Purchase CWD with ETH /// @dev Mints CWD based on ETH sent and current price function purchaseWithETH() external payable nonReentrant whenNotPaused { if (msg.value == 0) { revert InvalidAmount(); } uint256 cwdAmount = (msg.value * 1e18) / cwdPriceInWei; if (cwdAmount == 0) { revert InvalidAmount(); } _mint(_msgSender(), cwdAmount); (bool success,) = treasury.call{value: msg.value}(""); if (!success) { revert TransferFailed(); } emit CWDPurchasedWithETH(_msgSender(), cwdAmount, msg.value); } /// @notice Purchase CWD with an ERC20 token /// @param token The ERC20 token to pay with /// @param tokenAmount The amount of tokens to spend function purchaseWithToken(address token, uint256 tokenAmount) external nonReentrant whenNotPaused { if (token == address(0)) { revert InvalidAddress(); } if (tokenAmount == 0) { revert InvalidAmount(); } uint256 tokenPrice = paymentTokenPrices[token]; if (tokenPrice == 0) { revert TokenNotSupported(); } uint256 cwdAmount = (tokenAmount * 1e18) / tokenPrice; if (cwdAmount == 0) { revert InvalidAmount(); } IERC20(token).safeTransferFrom(_msgSender(), treasury, tokenAmount); _mint(_msgSender(), cwdAmount); emit CWDPurchasedWithToken(_msgSender(), token, cwdAmount, tokenAmount); } /// @notice Calculate how much CWD can be purchased with given ETH amount /// @param ethAmount Amount of ETH in wei /// @return Amount of CWD that can be purchased function calculateCWDFromETH(uint256 ethAmount) external view returns (uint256) { return (ethAmount * 1e18) / cwdPriceInWei; } /// @notice Calculate how much ETH is needed to purchase given CWD amount /// @param cwdAmount Amount of CWD desired /// @return Amount of ETH in wei needed function calculateETHFromCWD(uint256 cwdAmount) external view returns (uint256) { return (cwdAmount * cwdPriceInWei) / 1e18; } /// @notice Update the price of CWD in wei /// @param newPrice New price in wei per CWD function updatePrice(uint256 newPrice) external onlyRole(PRICE_MANAGER_ROLE) { if (newPrice == 0) { revert InvalidAmount(); } uint256 oldPrice = cwdPriceInWei; cwdPriceInWei = newPrice; emit PriceUpdated(oldPrice, newPrice); } /// @notice Add or update a supported payment token /// @param token The ERC20 token address /// @param pricePerCWD Price per CWD in token's smallest unit function setPaymentToken(address token, uint256 pricePerCWD) external onlyRole(PRICE_MANAGER_ROLE) { if (token == address(0)) { revert InvalidAddress(); } if (pricePerCWD == 0) { revert InvalidAmount(); } paymentTokenPrices[token] = pricePerCWD; emit PaymentTokenUpdated(token, pricePerCWD); } /// @notice Remove a supported payment token /// @param token The ERC20 token address to remove function removePaymentToken(address token) external onlyRole(PRICE_MANAGER_ROLE) { if (token == address(0)) { revert InvalidAddress(); } delete paymentTokenPrices[token]; emit PaymentTokenRemoved(token); } /// @notice Update the treasury address /// @param newTreasury New treasury address function updateTreasury(address newTreasury) external onlyRole(DEFAULT_ADMIN_ROLE) { if (newTreasury == address(0)) { revert InvalidAddress(); } address oldTreasury = treasury; treasury = newTreasury; emit TreasuryUpdated(oldTreasury, newTreasury); } /// @notice Claim CWD from the faucet /// @dev Users can claim once per cooldown period function claimFaucet() external whenNotPaused nonReentrant { uint256 lastClaim = lastFaucetClaim[_msgSender()]; uint256 timeSinceLastClaim = block.timestamp - lastClaim; if (lastClaim != 0 && timeSinceLastClaim < faucetCooldown) { revert FaucetClaimTooEarly(); } if (faucetAmount == 0) { revert FaucetDisabled(); } lastFaucetClaim[_msgSender()] = block.timestamp; uint256 nextClaimTime = block.timestamp + faucetCooldown; _mint(_msgSender(), faucetAmount); emit FaucetClaim(_msgSender(), faucetAmount, nextClaimTime); } /// @notice Configure faucet parameters /// @param amount Amount of CWD to distribute per claim /// @param cooldown Cooldown period in seconds between claims function configureFaucet(uint256 amount, uint256 cooldown) external onlyRole(FAUCET_MANAGER_ROLE) { if (cooldown == 0) { revert InvalidAmount(); } faucetAmount = amount; faucetCooldown = cooldown; emit FaucetConfigured(amount, cooldown); } /// @notice Set the escrow contract address for transfer whitelist /// @param _escrowContract Address of the escrow contract function setEscrowContract(address _escrowContract) external onlyRole(DEFAULT_ADMIN_ROLE) { if (_escrowContract == address(0)) { revert InvalidAddress(); } address oldEscrow = escrowContract; escrowContract = _escrowContract; emit EscrowContractSet(oldEscrow, _escrowContract); } /// @notice Get time remaining until next faucet claim /// @param user Address to check /// @return timeRemaining Seconds until next claim (0 if can claim now) function getTimeUntilNextClaim(address user) external view returns (uint256 timeRemaining) { uint256 lastClaim = lastFaucetClaim[user]; if (lastClaim == 0) { return 0; } uint256 timeSinceLastClaim = block.timestamp - lastClaim; if (timeSinceLastClaim >= faucetCooldown) { return 0; } return faucetCooldown - timeSinceLastClaim; } /// @notice Check if a user can claim from the faucet /// @param user Address to check /// @return canClaim True if user can claim now function canClaimFaucet(address user) external view returns (bool canClaim) { if (faucetAmount == 0) { return false; } uint256 lastClaim = lastFaucetClaim[user]; if (lastClaim == 0) { return true; } return block.timestamp - lastClaim >= faucetCooldown; } /// @notice Mints new tokens to a specified address /// @dev Only callable by accounts with MINTER_ROLE /// @param to The address that will receive the minted tokens /// @param amount The amount of tokens to mint function mint(address to, uint256 amount) external onlyRole(MINTER_ROLE) { if (to == address(0)) { revert InvalidAddress(); } if (amount == 0) { revert InvalidAmount(); } _mint(to, amount); } /// @notice Pauses all token transfers and purchases function pause() external onlyRole(PAUSER_ROLE) { _pause(); } /// @notice Unpauses all token transfers and purchases function unpause() external onlyRole(PAUSER_ROLE) { _unpause(); } /// @notice Burns tokens from the caller's account /// @param amount The amount of tokens to burn function burn(uint256 amount) public override { if (amount == 0) { revert InvalidAmount(); } super.burn(amount); } /// @notice Burns tokens from a specified account /// @param account The account to burn tokens from /// @param amount The amount of tokens to burn function burnFrom(address account, uint256 amount) public override { if (account == address(0)) { revert InvalidAddress(); } if (amount == 0) { revert InvalidAmount(); } super.burnFrom(account, amount); } /// @notice Hook called before any token transfer /// @dev Enforces transfer restrictions: only allows transfers to/from escrow or minting/burning /// @param from The address sending tokens /// @param to The address receiving tokens /// @param amount The amount of tokens being transferred function _update(address from, address to, uint256 amount) internal override(ERC20Upgradeable, ERC20PausableUpgradeable) { bool isMinting = from == address(0); bool isBurning = to == address(0); if (!isMinting && !isBurning && escrowContract != address(0)) { bool isToEscrow = to == escrowContract; bool isFromEscrow = from == escrowContract; if (!isToEscrow && !isFromEscrow) { revert TransferNotAllowed(); } } super._update(from, to, amount); } /// @notice Authorizes contract upgrades /// @param newImplementation The address of the new implementation contract function _authorizeUpgrade(address newImplementation) internal view override onlyRole(UPGRADER_ROLE) { if (newImplementation == address(0)) { revert InvalidAddress(); } } error InvalidAddress(); error InvalidAmount(); error TransferFailed(); error TokenNotSupported(); error FaucetClaimTooEarly(); error FaucetDisabled(); error TransferNotAllowed(); }
lib/openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import {ContextUpgradeable} from "../../utils/ContextUpgradeable.sol"; import {IERC20Errors} from "@openzeppelin/contracts/interfaces/draft-IERC6093.sol"; import {Initializable} from "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * The default value of {decimals} is 18. To change this, you should override * this function so it returns a different value. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC-20 * applications. */ abstract contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20, IERC20Metadata, IERC20Errors { /// @custom:storage-location erc7201:openzeppelin.storage.ERC20 struct ERC20Storage { mapping(address account => uint256) _balances; mapping(address account => mapping(address spender => uint256)) _allowances; uint256 _totalSupply; string _name; string _symbol; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ERC20")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant ERC20StorageLocation = 0x52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace00; function _getERC20Storage() private pure returns (ERC20Storage storage $) { assembly { $.slot := ERC20StorageLocation } } /** * @dev Sets the values for {name} and {symbol}. * * All two of these values are immutable: they can only be set once during * construction. */ function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing { __ERC20_init_unchained(name_, symbol_); } function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing { ERC20Storage storage $ = _getERC20Storage(); $._name = name_; $._symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { ERC20Storage storage $ = _getERC20Storage(); return $._name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { ERC20Storage storage $ = _getERC20Storage(); return $._symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the default value returned by this function, unless * it's overridden. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual returns (uint256) { ERC20Storage storage $ = _getERC20Storage(); return $._totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual returns (uint256) { ERC20Storage storage $ = _getERC20Storage(); return $._balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `value`. */ function transfer(address to, uint256 value) public virtual returns (bool) { address owner = _msgSender(); _transfer(owner, to, value); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual returns (uint256) { ERC20Storage storage $ = _getERC20Storage(); return $._allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 value) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, value); return true; } /** * @dev See {IERC20-transferFrom}. * * Skips emitting an {Approval} event indicating an allowance update. This is not * required by the ERC. See {xref-ERC20-_approve-address-address-uint256-bool-}[_approve]. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `value`. * - the caller must have allowance for ``from``'s tokens of at least * `value`. */ function transferFrom(address from, address to, uint256 value) public virtual returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, value); _transfer(from, to, value); return true; } /** * @dev Moves a `value` amount of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _transfer(address from, address to, uint256 value) internal { if (from == address(0)) { revert ERC20InvalidSender(address(0)); } if (to == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(from, to, value); } /** * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from` * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding * this function. * * Emits a {Transfer} event. */ function _update(address from, address to, uint256 value) internal virtual { ERC20Storage storage $ = _getERC20Storage(); if (from == address(0)) { // Overflow check required: The rest of the code assumes that totalSupply never overflows $._totalSupply += value; } else { uint256 fromBalance = $._balances[from]; if (fromBalance < value) { revert ERC20InsufficientBalance(from, fromBalance, value); } unchecked { // Overflow not possible: value <= fromBalance <= totalSupply. $._balances[from] = fromBalance - value; } } if (to == address(0)) { unchecked { // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply. $._totalSupply -= value; } } else { unchecked { // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256. $._balances[to] += value; } } emit Transfer(from, to, value); } /** * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0). * Relies on the `_update` mechanism * * Emits a {Transfer} event with `from` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _mint(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(address(0), account, value); } /** * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply. * Relies on the `_update` mechanism. * * Emits a {Transfer} event with `to` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead */ function _burn(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidSender(address(0)); } _update(account, address(0), value); } /** * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. * * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument. */ function _approve(address owner, address spender, uint256 value) internal { _approve(owner, spender, value, true); } /** * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event. * * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any * `Approval` event during `transferFrom` operations. * * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to * true using the following override: * * ```solidity * function _approve(address owner, address spender, uint256 value, bool) internal virtual override { * super._approve(owner, spender, value, true); * } * ``` * * Requirements are the same as {_approve}. */ function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual { ERC20Storage storage $ = _getERC20Storage(); if (owner == address(0)) { revert ERC20InvalidApprover(address(0)); } if (spender == address(0)) { revert ERC20InvalidSpender(address(0)); } $._allowances[owner][spender] = value; if (emitEvent) { emit Approval(owner, spender, value); } } /** * @dev Updates `owner` s allowance for `spender` based on spent `value`. * * Does not update the allowance value in case of infinite allowance. * Revert if not enough allowance is available. * * Does not emit an {Approval} event. */ function _spendAllowance(address owner, address spender, uint256 value) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { if (currentAllowance < value) { revert ERC20InsufficientAllowance(spender, currentAllowance, value); } unchecked { _approve(owner, spender, currentAllowance - value, false); } } } }
lib/openzeppelin-contracts-upgradeable/contracts/access/AccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol) pragma solidity ^0.8.20; import {IAccessControl} from "@openzeppelin/contracts/access/IAccessControl.sol"; import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol"; import {ERC165Upgradeable} from "../utils/introspection/ERC165Upgradeable.sol"; import {Initializable} from "../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, IAccessControl, ERC165Upgradeable { struct RoleData { mapping(address account => bool) hasRole; bytes32 adminRole; } bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /// @custom:storage-location erc7201:openzeppelin.storage.AccessControl struct AccessControlStorage { mapping(bytes32 role => RoleData) _roles; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.AccessControl")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant AccessControlStorageLocation = 0x02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800; function _getAccessControlStorage() private pure returns (AccessControlStorage storage $) { assembly { $.slot := AccessControlStorageLocation } } /** * @dev Modifier that checks that an account has a specific role. Reverts * with an {AccessControlUnauthorizedAccount} error including the required role. */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } function __AccessControl_init() internal onlyInitializing { } function __AccessControl_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual returns (bool) { AccessControlStorage storage $ = _getAccessControlStorage(); return $._roles[role].hasRole[account]; } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()` * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier. */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account` * is missing `role`. */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert AccessControlUnauthorizedAccount(account, role); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) { AccessControlStorage storage $ = _getAccessControlStorage(); return $._roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `callerConfirmation`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address callerConfirmation) public virtual { if (callerConfirmation != _msgSender()) { revert AccessControlBadConfirmation(); } _revokeRole(role, callerConfirmation); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { AccessControlStorage storage $ = _getAccessControlStorage(); bytes32 previousAdminRole = getRoleAdmin(role); $._roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual returns (bool) { AccessControlStorage storage $ = _getAccessControlStorage(); if (!hasRole(role, account)) { $._roles[role].hasRole[account] = true; emit RoleGranted(role, account, _msgSender()); return true; } else { return false; } } /** * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual returns (bool) { AccessControlStorage storage $ = _getAccessControlStorage(); if (hasRole(role, account)) { $._roles[role].hasRole[account] = false; emit RoleRevoked(role, account, _msgSender()); return true; } else { return false; } } }
lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.20; /** * @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 Storage of the initializable contract. * * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions * when using with upgradeable contracts. * * @custom:storage-location erc7201:openzeppelin.storage.Initializable */ struct InitializableStorage { /** * @dev Indicates that the contract has been initialized. */ uint64 _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool _initializing; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00; /** * @dev The contract is already initialized. */ error InvalidInitialization(); /** * @dev The contract is not initializing. */ error NotInitializing(); /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint64 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 in the context of a constructor an `initializer` may be invoked any * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in * production. * * Emits an {Initialized} event. */ modifier initializer() { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); // Cache values to avoid duplicated sloads bool isTopLevelCall = !$._initializing; uint64 initialized = $._initialized; // Allowed calls: // - initialSetup: the contract is not in the initializing state and no previous version was // initialized // - construction: the contract is initialized at version 1 (no reininitialization) and the // current contract is just being deployed bool initialSetup = initialized == 0 && isTopLevelCall; bool construction = initialized == 1 && address(this).code.length == 0; if (!initialSetup && !construction) { revert InvalidInitialization(); } $._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 2**64 - 1 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint64 version) { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing || $._initialized >= version) { revert InvalidInitialization(); } $._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() { _checkInitializing(); _; } /** * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}. */ function _checkInitializing() internal view virtual { if (!_isInitializing()) { revert NotInitializing(); } } /** * @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 { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing) { revert InvalidInitialization(); } if ($._initialized != type(uint64).max) { $._initialized = type(uint64).max; emit Initialized(type(uint64).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint64) { return _getInitializableStorage()._initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _getInitializableStorage()._initializing; } /** * @dev Returns a pointer to the storage namespace. */ // solhint-disable-next-line var-name-mixedcase function _getInitializableStorage() private pure returns (InitializableStorage storage $) { assembly { $.slot := INITIALIZABLE_STORAGE } } }
lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/UUPSUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (proxy/utils/UUPSUpgradeable.sol) pragma solidity ^0.8.20; import {IERC1822Proxiable} from "@openzeppelin/contracts/interfaces/draft-IERC1822.sol"; import {ERC1967Utils} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol"; import {Initializable} from "./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. */ abstract contract UUPSUpgradeable is Initializable, IERC1822Proxiable { /// @custom:oz-upgrades-unsafe-allow state-variable-immutable address private immutable __self = address(this); /** * @dev The version of the upgrade interface of the contract. If this getter is missing, both `upgradeTo(address)` * and `upgradeToAndCall(address,bytes)` are present, and `upgradeTo` must be used if no function should be called, * while `upgradeToAndCall` will invoke the `receive` function if the second argument is the empty byte string. * If the getter returns `"5.0.0"`, only `upgradeToAndCall(address,bytes)` is present, and the second argument must * be the empty byte string if no function should be called, making it impossible to invoke the `receive` function * during an upgrade. */ string public constant UPGRADE_INTERFACE_VERSION = "5.0.0"; /** * @dev The call is from an unauthorized context. */ error UUPSUnauthorizedCallContext(); /** * @dev The storage `slot` is unsupported as a UUID. */ error UUPSUnsupportedProxiableUUID(bytes32 slot); /** * @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 ERC-1967) 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 ERC-1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to * fail. */ modifier onlyProxy() { _checkProxy(); _; } /** * @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() { _checkNotDelegated(); _; } function __UUPSUpgradeable_init() internal onlyInitializing { } function __UUPSUpgradeable_init_unchained() internal onlyInitializing { } /** * @dev Implementation of the ERC-1822 {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 notDelegated returns (bytes32) { return ERC1967Utils.IMPLEMENTATION_SLOT; } /** * @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); } /** * @dev Reverts if the execution is not performed via delegatecall or the execution * context is not of a proxy with an ERC-1967 compliant implementation pointing to self. * See {_onlyProxy}. */ function _checkProxy() internal view virtual { if ( address(this) == __self || // Must be called through delegatecall ERC1967Utils.getImplementation() != __self // Must be called through an active proxy ) { revert UUPSUnauthorizedCallContext(); } } /** * @dev Reverts if the execution is performed via delegatecall. * See {notDelegated}. */ function _checkNotDelegated() internal view virtual { if (address(this) != __self) { // Must not be called through delegatecall revert UUPSUnauthorizedCallContext(); } } /** * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by * {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal onlyOwner {} * ``` */ function _authorizeUpgrade(address newImplementation) internal virtual; /** * @dev Performs an implementation upgrade with a security check for UUPS proxies, and additional setup call. * * As a security check, {proxiableUUID} is invoked in the new implementation, and the return value * is expected to be the implementation slot in ERC-1967. * * Emits an {IERC1967-Upgraded} event. */ function _upgradeToAndCallUUPS(address newImplementation, bytes memory data) private { try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) { if (slot != ERC1967Utils.IMPLEMENTATION_SLOT) { revert UUPSUnsupportedProxiableUUID(slot); } ERC1967Utils.upgradeToAndCall(newImplementation, data); } catch { // The implementation is not UUPS revert ERC1967Utils.ERC1967InvalidImplementation(newImplementation); } } }
lib/openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/ERC20BurnableUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/ERC20Burnable.sol) pragma solidity ^0.8.20; import {ERC20Upgradeable} from "../ERC20Upgradeable.sol"; import {ContextUpgradeable} from "../../../utils/ContextUpgradeable.sol"; import {Initializable} from "../../../proxy/utils/Initializable.sol"; /** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */ abstract contract ERC20BurnableUpgradeable is Initializable, ContextUpgradeable, ERC20Upgradeable { function __ERC20Burnable_init() internal onlyInitializing { } function __ERC20Burnable_init_unchained() internal onlyInitializing { } /** * @dev Destroys a `value` amount of tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 value) public virtual { _burn(_msgSender(), value); } /** * @dev Destroys a `value` amount of tokens from `account`, deducting from * the caller's allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `value`. */ function burnFrom(address account, uint256 value) public virtual { _spendAllowance(account, _msgSender(), value); _burn(account, value); } }
lib/openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/ERC20PausableUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/extensions/ERC20Pausable.sol) pragma solidity ^0.8.20; import {ERC20Upgradeable} from "../ERC20Upgradeable.sol"; import {PausableUpgradeable} from "../../../utils/PausableUpgradeable.sol"; import {Initializable} from "../../../proxy/utils/Initializable.sol"; /** * @dev ERC-20 token with pausable token transfers, minting and burning. * * Useful for scenarios such as preventing trades until the end of an evaluation * period, or having an emergency switch for freezing all token transfers in the * event of a large bug. * * IMPORTANT: This contract does not include public pause and unpause functions. In * addition to inheriting this contract, you must define both functions, invoking the * {Pausable-_pause} and {Pausable-_unpause} internal functions, with appropriate * access control, e.g. using {AccessControl} or {Ownable}. Not doing so will * make the contract pause mechanism of the contract unreachable, and thus unusable. */ abstract contract ERC20PausableUpgradeable is Initializable, ERC20Upgradeable, PausableUpgradeable { function __ERC20Pausable_init() internal onlyInitializing { __Pausable_init_unchained(); } function __ERC20Pausable_init_unchained() internal onlyInitializing { } /** * @dev See {ERC20-_update}. * * Requirements: * * - the contract must not be paused. */ function _update(address from, address to, uint256 value) internal virtual override whenNotPaused { super._update(from, to, value); } }
lib/openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; import {Initializable} from "../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; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
lib/openzeppelin-contracts-upgradeable/contracts/utils/PausableUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol) pragma solidity ^0.8.20; import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol"; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract PausableUpgradeable is Initializable, ContextUpgradeable { /// @custom:storage-location erc7201:openzeppelin.storage.Pausable struct PausableStorage { bool _paused; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Pausable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant PausableStorageLocation = 0xcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300; function _getPausableStorage() private pure returns (PausableStorage storage $) { assembly { $.slot := PausableStorageLocation } } /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); /** * @dev The operation failed because the contract is paused. */ error EnforcedPause(); /** * @dev The operation failed because the contract is not paused. */ error ExpectedPause(); /** * @dev Initializes the contract in unpaused state. */ function __Pausable_init() internal onlyInitializing { __Pausable_init_unchained(); } function __Pausable_init_unchained() internal onlyInitializing { PausableStorage storage $ = _getPausableStorage(); $._paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { PausableStorage storage $ = _getPausableStorage(); return $._paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { if (paused()) { revert EnforcedPause(); } } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { if (!paused()) { revert ExpectedPause(); } } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { PausableStorage storage $ = _getPausableStorage(); $._paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { PausableStorage storage $ = _getPausableStorage(); $._paused = false; emit Unpaused(_msgSender()); } }
lib/openzeppelin-contracts-upgradeable/contracts/utils/ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/ReentrancyGuard.sol) pragma solidity ^0.8.20; import {Initializable} from "../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 EIP-1153 (transient storage) is available on the chain you're deploying at, * consider using {ReentrancyGuardTransient} instead. * * 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; /// @custom:storage-location erc7201:openzeppelin.storage.ReentrancyGuard struct ReentrancyGuardStorage { uint256 _status; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ReentrancyGuard")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant ReentrancyGuardStorageLocation = 0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00; function _getReentrancyGuardStorage() private pure returns (ReentrancyGuardStorage storage $) { assembly { $.slot := ReentrancyGuardStorageLocation } } /** * @dev Unauthorized reentrant call. */ error ReentrancyGuardReentrantCall(); function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); $._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 { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); // On the first call to nonReentrant, _status will be NOT_ENTERED if ($._status == ENTERED) { revert ReentrancyGuardReentrantCall(); } // Any calls to nonReentrant after this point will fail $._status = ENTERED; } function _nonReentrantAfter() private { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); // 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) { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); return $._status == ENTERED; } }
lib/openzeppelin-contracts-upgradeable/contracts/utils/introspection/ERC165Upgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/ERC165.sol) pragma solidity ^0.8.20; import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol"; import {Initializable} from "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC-165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` */ abstract contract ERC165Upgradeable is Initializable, IERC165 { function __ERC165_init() internal onlyInitializing { } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
lib/openzeppelin-contracts/contracts/access/IAccessControl.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (access/IAccessControl.sol) pragma solidity ^0.8.20; /** * @dev External interface of AccessControl declared to support ERC-165 detection. */ interface IAccessControl { /** * @dev The `account` is missing a role. */ error AccessControlUnauthorizedAccount(address account, bytes32 neededRole); /** * @dev The caller of a function is not the expected one. * * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}. */ error AccessControlBadConfirmation(); /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call. This account bears the admin role (for the granted role). * Expected in cases where the role was granted using the internal {AccessControl-_grantRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `callerConfirmation`. */ function renounceRole(bytes32 role, address callerConfirmation) external; }
lib/openzeppelin-contracts/contracts/interfaces/IERC1363.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363.sol) pragma solidity ^0.8.20; import {IERC20} from "./IERC20.sol"; import {IERC165} from "./IERC165.sol"; /** * @title IERC1363 * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363]. * * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction. */ interface IERC1363 is IERC20, IERC165 { /* * Note: the ERC-165 identifier for this interface is 0xb0202a11. * 0xb0202a11 === * bytes4(keccak256('transferAndCall(address,uint256)')) ^ * bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^ * bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^ * bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^ * bytes4(keccak256('approveAndCall(address,uint256)')) ^ * bytes4(keccak256('approveAndCall(address,uint256,bytes)')) */ /** * @dev Moves a `value` amount of tokens from the caller's account to `to` * and then calls {IERC1363Receiver-onTransferReceived} on `to`. * @param to The address which you want to transfer to. * @param value The amount of tokens to be transferred. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function transferAndCall(address to, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from the caller's account to `to` * and then calls {IERC1363Receiver-onTransferReceived} on `to`. * @param to The address which you want to transfer to. * @param value The amount of tokens to be transferred. * @param data Additional data with no specified format, sent in call to `to`. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism * and then calls {IERC1363Receiver-onTransferReceived} on `to`. * @param from The address which you want to send tokens from. * @param to The address which you want to transfer to. * @param value The amount of tokens to be transferred. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function transferFromAndCall(address from, address to, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism * and then calls {IERC1363Receiver-onTransferReceived} on `to`. * @param from The address which you want to send tokens from. * @param to The address which you want to transfer to. * @param value The amount of tokens to be transferred. * @param data Additional data with no specified format, sent in call to `to`. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`. * @param spender The address which will spend the funds. * @param value The amount of tokens to be spent. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function approveAndCall(address spender, uint256 value) external returns (bool); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`. * @param spender The address which will spend the funds. * @param value The amount of tokens to be spent. * @param data Additional data with no specified format, sent in call to `spender`. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool); }
lib/openzeppelin-contracts/contracts/interfaces/IERC165.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol) pragma solidity ^0.8.20; import {IERC165} from "../utils/introspection/IERC165.sol";
lib/openzeppelin-contracts/contracts/interfaces/IERC1967.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC1967.sol) pragma solidity ^0.8.20; /** * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC. */ interface IERC1967 { /** * @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); }
lib/openzeppelin-contracts/contracts/interfaces/IERC20.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../token/ERC20/IERC20.sol";
lib/openzeppelin-contracts/contracts/interfaces/draft-IERC1822.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (interfaces/draft-IERC1822.sol) pragma solidity ^0.8.20; /** * @dev ERC-1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified * proxy whose upgrades are fully controlled by the current implementation. */ interface IERC1822Proxiable { /** * @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); }
lib/openzeppelin-contracts/contracts/interfaces/draft-IERC6093.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (interfaces/draft-IERC6093.sol) pragma solidity ^0.8.20; /** * @dev Standard ERC-20 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens. */ interface IERC20Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC20InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC20InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers. * @param spender Address that may be allowed to operate on tokens without being their owner. * @param allowance Amount of tokens a `spender` is allowed to operate with. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC20InvalidApprover(address approver); /** * @dev Indicates a failure with the `spender` to be approved. Used in approvals. * @param spender Address that may be allowed to operate on tokens without being their owner. */ error ERC20InvalidSpender(address spender); } /** * @dev Standard ERC-721 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens. */ interface IERC721Errors { /** * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-20. * Used in balance queries. * @param owner Address of the current owner of a token. */ error ERC721InvalidOwner(address owner); /** * @dev Indicates a `tokenId` whose `owner` is the zero address. * @param tokenId Identifier number of a token. */ error ERC721NonexistentToken(uint256 tokenId); /** * @dev Indicates an error related to the ownership over a particular token. Used in transfers. * @param sender Address whose tokens are being transferred. * @param tokenId Identifier number of a token. * @param owner Address of the current owner of a token. */ error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC721InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC721InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param tokenId Identifier number of a token. */ error ERC721InsufficientApproval(address operator, uint256 tokenId); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC721InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC721InvalidOperator(address operator); } /** * @dev Standard ERC-1155 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens. */ interface IERC1155Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. * @param tokenId Identifier number of a token. */ error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC1155InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC1155InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param owner Address of the current owner of a token. */ error ERC1155MissingApprovalForAll(address operator, address owner); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC1155InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC1155InvalidOperator(address operator); /** * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation. * Used in batch transfers. * @param idsLength Length of the array of token identifiers * @param valuesLength Length of the array of token amounts */ error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength); }
lib/openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Utils.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (proxy/ERC1967/ERC1967Utils.sol) pragma solidity ^0.8.21; import {IBeacon} from "../beacon/IBeacon.sol"; import {IERC1967} from "../../interfaces/IERC1967.sol"; import {Address} from "../../utils/Address.sol"; import {StorageSlot} from "../../utils/StorageSlot.sol"; /** * @dev This library provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[ERC-1967] slots. */ library ERC1967Utils { /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1. */ // solhint-disable-next-line private-vars-leading-underscore bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev The `implementation` of the proxy is invalid. */ error ERC1967InvalidImplementation(address implementation); /** * @dev The `admin` of the proxy is invalid. */ error ERC1967InvalidAdmin(address admin); /** * @dev The `beacon` of the proxy is invalid. */ error ERC1967InvalidBeacon(address beacon); /** * @dev An upgrade function sees `msg.value > 0` that may be lost. */ error ERC1967NonPayable(); /** * @dev Returns the current implementation address. */ function getImplementation() internal view returns (address) { return StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the ERC-1967 implementation slot. */ function _setImplementation(address newImplementation) private { if (newImplementation.code.length == 0) { revert ERC1967InvalidImplementation(newImplementation); } StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Performs implementation upgrade with additional setup call if data is nonempty. * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected * to avoid stuck value in the contract. * * Emits an {IERC1967-Upgraded} event. */ function upgradeToAndCall(address newImplementation, bytes memory data) internal { _setImplementation(newImplementation); emit IERC1967.Upgraded(newImplementation); if (data.length > 0) { Address.functionDelegateCall(newImplementation, data); } else { _checkNonPayable(); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1. */ // solhint-disable-next-line private-vars-leading-underscore bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Returns the current admin. * * TIP: To get this value clients can read directly from the storage slot shown below (specified by ERC-1967) using * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103` */ function getAdmin() internal view returns (address) { return StorageSlot.getAddressSlot(ADMIN_SLOT).value; } /** * @dev Stores a new address in the ERC-1967 admin slot. */ function _setAdmin(address newAdmin) private { if (newAdmin == address(0)) { revert ERC1967InvalidAdmin(address(0)); } StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {IERC1967-AdminChanged} event. */ function changeAdmin(address newAdmin) internal { emit IERC1967.AdminChanged(getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is the keccak-256 hash of "eip1967.proxy.beacon" subtracted by 1. */ // solhint-disable-next-line private-vars-leading-underscore bytes32 internal constant BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Returns the current beacon. */ function getBeacon() internal view returns (address) { return StorageSlot.getAddressSlot(BEACON_SLOT).value; } /** * @dev Stores a new beacon in the ERC-1967 beacon slot. */ function _setBeacon(address newBeacon) private { if (newBeacon.code.length == 0) { revert ERC1967InvalidBeacon(newBeacon); } StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon; address beaconImplementation = IBeacon(newBeacon).implementation(); if (beaconImplementation.code.length == 0) { revert ERC1967InvalidImplementation(beaconImplementation); } } /** * @dev Change the beacon and trigger a setup call if data is nonempty. * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected * to avoid stuck value in the contract. * * Emits an {IERC1967-BeaconUpgraded} event. * * CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since * it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for * efficiency. */ function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal { _setBeacon(newBeacon); emit IERC1967.BeaconUpgraded(newBeacon); if (data.length > 0) { Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data); } else { _checkNonPayable(); } } /** * @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract * if an upgrade doesn't perform an initialization call. */ function _checkNonPayable() private { if (msg.value > 0) { revert ERC1967NonPayable(); } } }
lib/openzeppelin-contracts/contracts/proxy/beacon/IBeacon.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.20; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeacon { /** * @dev Must return an address that can be used as a delegate call target. * * {UpgradeableBeacon} will check that this address is a contract. */ function implementation() external view returns (address); }
lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC-20 standard as defined in the ERC. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 value) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external returns (bool); }
lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC-20 standard. */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; import {IERC1363} from "../../../interfaces/IERC1363.sol"; import {Address} from "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC-20 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 SafeERC20 { /** * @dev An operation with an ERC-20 token failed. */ error SafeERC20FailedOperation(address token); /** * @dev Indicates a failed `decreaseAllowance` request. */ error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease); /** * @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(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transfer, (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(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, 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. * * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client" * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); forceApprove(token, spender, oldAllowance + value); } /** * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no * value, non-reverting calls are assumed to be successful. * * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client" * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal { unchecked { uint256 currentAllowance = token.allowance(address(this), spender); if (currentAllowance < requestedDecrease) { revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease); } forceApprove(token, spender, currentAllowance - requestedDecrease); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. * * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function * only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being * set here. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value)); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0))); _callOptionalReturn(token, approvalCall); } } /** * @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when * targeting contracts. * * Reverts if the returned value is other than `true`. */ function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal { if (to.code.length == 0) { safeTransfer(token, to, value); } else if (!token.transferAndCall(to, value, data)) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target * has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when * targeting contracts. * * Reverts if the returned value is other than `true`. */ function transferFromAndCallRelaxed( IERC1363 token, address from, address to, uint256 value, bytes memory data ) internal { if (to.code.length == 0) { safeTransferFrom(token, from, to, value); } else if (!token.transferFromAndCall(from, to, value, data)) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when * targeting contracts. * * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}. * Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall} * once without retrying, and relies on the returned value to be true. * * Reverts if the returned value is other than `true`. */ function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal { if (to.code.length == 0) { forceApprove(token, to, value); } else if (!token.approveAndCall(to, value, data)) { revert SafeERC20FailedOperation(address(token)); } } /** * @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 {_callOptionalReturnBool} that reverts if call fails to meet the requirements. */ function _callOptionalReturn(IERC20 token, bytes memory data) private { uint256 returnSize; uint256 returnValue; assembly ("memory-safe") { let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20) // bubble errors if iszero(success) { let ptr := mload(0x40) returndatacopy(ptr, 0, returndatasize()) revert(ptr, returndatasize()) } returnSize := returndatasize() returnValue := mload(0) } if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) { revert SafeERC20FailedOperation(address(token)); } } /** * @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 silently catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { bool success; uint256 returnSize; uint256 returnValue; assembly ("memory-safe") { success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20) returnSize := returndatasize() returnValue := mload(0) } return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1); } }
lib/openzeppelin-contracts/contracts/utils/Address.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/Address.sol) pragma solidity ^0.8.20; import {Errors} from "./Errors.sol"; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @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.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert Errors.InsufficientBalance(address(this).balance, amount); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert Errors.FailedCall(); } } /** * @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 or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {Errors.FailedCall} error. * * 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. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @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`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert Errors.InsufficientBalance(address(this).balance, value); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {Errors.FailedCall}) in case * of an unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {Errors.FailedCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {Errors.FailedCall}. */ function _revert(bytes memory returndata) 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 assembly ("memory-safe") { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert Errors.FailedCall(); } } }
lib/openzeppelin-contracts/contracts/utils/Errors.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/Errors.sol) pragma solidity ^0.8.20; /** * @dev Collection of common custom errors used in multiple contracts * * IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library. * It is recommended to avoid relying on the error API for critical functionality. * * _Available since v5.1._ */ library Errors { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error InsufficientBalance(uint256 balance, uint256 needed); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedCall(); /** * @dev The deployment failed. */ error FailedDeployment(); /** * @dev A necessary precompile is missing. */ error MissingPrecompile(address); }
lib/openzeppelin-contracts/contracts/utils/StorageSlot.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/StorageSlot.sol) // This file was procedurally generated from scripts/generate/templates/StorageSlot.js. pragma solidity ^0.8.20; /** * @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 ERC-1967 implementation slot: * ```solidity * contract ERC1967 { * // Define the slot. Alternatively, use the SlotDerivation library to derive the slot. * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(newImplementation.code.length > 0); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * TIP: Consider using this library along with {SlotDerivation}. */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } struct Int256Slot { int256 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) { assembly ("memory-safe") { r.slot := slot } } /** * @dev Returns a `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { assembly ("memory-safe") { r.slot := slot } } /** * @dev Returns a `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { assembly ("memory-safe") { r.slot := slot } } /** * @dev Returns a `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { assembly ("memory-safe") { r.slot := slot } } /** * @dev Returns a `Int256Slot` with member `value` located at `slot`. */ function getInt256Slot(bytes32 slot) internal pure returns (Int256Slot storage r) { assembly ("memory-safe") { r.slot := slot } } /** * @dev Returns a `StringSlot` with member `value` located at `slot`. */ function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) { assembly ("memory-safe") { 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) { assembly ("memory-safe") { r.slot := store.slot } } /** * @dev Returns a `BytesSlot` with member `value` located at `slot`. */ function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) { assembly ("memory-safe") { 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) { assembly ("memory-safe") { r.slot := store.slot } } }
lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC-165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[ERC]. * * 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[ERC 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); }
Compiler Settings
{"viaIR":false,"remappings":["@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/","@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/","forge-std/=lib/forge-std/src/","ds-test/=lib/forge-std/lib/ds-test/src/","erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/","halmos-cheatcodes/=lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/","openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/","openzeppelin-contracts/=lib/openzeppelin-contracts/"],"outputSelection":{"*":{"*":["*"],"":["*"]}},"optimizer":{"runs":200,"enabled":true},"metadata":{"useLiteralContent":false,"bytecodeHash":"ipfs","appendCBOR":true},"libraries":{},"evmVersion":"shanghai"}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[]},{"type":"error","name":"AccessControlBadConfirmation","inputs":[]},{"type":"error","name":"AccessControlUnauthorizedAccount","inputs":[{"type":"address","name":"account","internalType":"address"},{"type":"bytes32","name":"neededRole","internalType":"bytes32"}]},{"type":"error","name":"AddressEmptyCode","inputs":[{"type":"address","name":"target","internalType":"address"}]},{"type":"error","name":"ERC1967InvalidImplementation","inputs":[{"type":"address","name":"implementation","internalType":"address"}]},{"type":"error","name":"ERC1967NonPayable","inputs":[]},{"type":"error","name":"ERC20InsufficientAllowance","inputs":[{"type":"address","name":"spender","internalType":"address"},{"type":"uint256","name":"allowance","internalType":"uint256"},{"type":"uint256","name":"needed","internalType":"uint256"}]},{"type":"error","name":"ERC20InsufficientBalance","inputs":[{"type":"address","name":"sender","internalType":"address"},{"type":"uint256","name":"balance","internalType":"uint256"},{"type":"uint256","name":"needed","internalType":"uint256"}]},{"type":"error","name":"ERC20InvalidApprover","inputs":[{"type":"address","name":"approver","internalType":"address"}]},{"type":"error","name":"ERC20InvalidReceiver","inputs":[{"type":"address","name":"receiver","internalType":"address"}]},{"type":"error","name":"ERC20InvalidSender","inputs":[{"type":"address","name":"sender","internalType":"address"}]},{"type":"error","name":"ERC20InvalidSpender","inputs":[{"type":"address","name":"spender","internalType":"address"}]},{"type":"error","name":"EnforcedPause","inputs":[]},{"type":"error","name":"ExpectedPause","inputs":[]},{"type":"error","name":"FailedCall","inputs":[]},{"type":"error","name":"FaucetClaimTooEarly","inputs":[]},{"type":"error","name":"FaucetDisabled","inputs":[]},{"type":"error","name":"InvalidAddress","inputs":[]},{"type":"error","name":"InvalidAmount","inputs":[]},{"type":"error","name":"InvalidInitialization","inputs":[]},{"type":"error","name":"NotInitializing","inputs":[]},{"type":"error","name":"ReentrancyGuardReentrantCall","inputs":[]},{"type":"error","name":"SafeERC20FailedOperation","inputs":[{"type":"address","name":"token","internalType":"address"}]},{"type":"error","name":"TokenNotSupported","inputs":[]},{"type":"error","name":"TransferFailed","inputs":[]},{"type":"error","name":"TransferNotAllowed","inputs":[]},{"type":"error","name":"UUPSUnauthorizedCallContext","inputs":[]},{"type":"error","name":"UUPSUnsupportedProxiableUUID","inputs":[{"type":"bytes32","name":"slot","internalType":"bytes32"}]},{"type":"event","name":"Approval","inputs":[{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"address","name":"spender","internalType":"address","indexed":true},{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"CWDPurchasedWithETH","inputs":[{"type":"address","name":"buyer","internalType":"address","indexed":true},{"type":"uint256","name":"cwdAmount","internalType":"uint256","indexed":false},{"type":"uint256","name":"ethPaid","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"CWDPurchasedWithToken","inputs":[{"type":"address","name":"buyer","internalType":"address","indexed":true},{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"uint256","name":"cwdAmount","internalType":"uint256","indexed":false},{"type":"uint256","name":"tokenPaid","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"EscrowContractSet","inputs":[{"type":"address","name":"oldEscrow","internalType":"address","indexed":true},{"type":"address","name":"newEscrow","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"FaucetClaim","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"uint256","name":"nextClaimTime","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"FaucetConfigured","inputs":[{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"uint256","name":"cooldown","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Initialized","inputs":[{"type":"uint64","name":"version","internalType":"uint64","indexed":false}],"anonymous":false},{"type":"event","name":"Paused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"PaymentTokenRemoved","inputs":[{"type":"address","name":"token","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"PaymentTokenUpdated","inputs":[{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"uint256","name":"price","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"PriceUpdated","inputs":[{"type":"uint256","name":"oldPrice","internalType":"uint256","indexed":false},{"type":"uint256","name":"newPrice","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"RoleAdminChanged","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"previousAdminRole","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"newAdminRole","internalType":"bytes32","indexed":true}],"anonymous":false},{"type":"event","name":"RoleGranted","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"sender","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"RoleRevoked","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"sender","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Transfer","inputs":[{"type":"address","name":"from","internalType":"address","indexed":true},{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"TreasuryUpdated","inputs":[{"type":"address","name":"oldTreasury","internalType":"address","indexed":true},{"type":"address","name":"newTreasury","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Unpaused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"Upgraded","inputs":[{"type":"address","name":"implementation","internalType":"address","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"DEFAULT_ADMIN_ROLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"FAUCET_MANAGER_ROLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"MINTER_ROLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"PAUSER_ROLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"PRICE_MANAGER_ROLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"UPGRADER_ROLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"UPGRADE_INTERFACE_VERSION","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"allowance","inputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"address","name":"spender","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"approve","inputs":[{"type":"address","name":"spender","internalType":"address"},{"type":"uint256","name":"value","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"balanceOf","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"burn","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"burnFrom","inputs":[{"type":"address","name":"account","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"calculateCWDFromETH","inputs":[{"type":"uint256","name":"ethAmount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"calculateETHFromCWD","inputs":[{"type":"uint256","name":"cwdAmount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"canClaim","internalType":"bool"}],"name":"canClaimFaucet","inputs":[{"type":"address","name":"user","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"claimFaucet","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"configureFaucet","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"uint256","name":"cooldown","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"cwdPriceInWei","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint8","name":"","internalType":"uint8"}],"name":"decimals","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"escrowContract","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"faucetAmount","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"faucetCooldown","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"getRoleAdmin","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"timeRemaining","internalType":"uint256"}],"name":"getTimeUntilNextClaim","inputs":[{"type":"address","name":"user","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"grantRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"hasRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"address","name":"defaultAdmin","internalType":"address"},{"type":"address","name":"_treasury","internalType":"address"},{"type":"uint256","name":"_cwdPriceInWei","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"lastFaucetClaim","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"mint","inputs":[{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"name","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"pause","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"paused","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"paymentTokenPrices","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"proxiableUUID","inputs":[]},{"type":"function","stateMutability":"payable","outputs":[],"name":"purchaseWithETH","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"purchaseWithToken","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"tokenAmount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removePaymentToken","inputs":[{"type":"address","name":"token","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"callerConfirmation","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"revokeRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setEscrowContract","inputs":[{"type":"address","name":"_escrowContract","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setPaymentToken","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"pricePerCWD","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"supportsInterface","inputs":[{"type":"bytes4","name":"interfaceId","internalType":"bytes4"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"symbol","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalSupply","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"transfer","inputs":[{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"value","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"transferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"value","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"treasury","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unpause","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updatePrice","inputs":[{"type":"uint256","name":"newPrice","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateTreasury","inputs":[{"type":"address","name":"newTreasury","internalType":"address"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"upgradeToAndCall","inputs":[{"type":"address","name":"newImplementation","internalType":"address"},{"type":"bytes","name":"data","internalType":"bytes"}]}]
Contract Creation Code
0x60a060405230608052348015610013575f5ffd5b5061001c610021565b6100d3565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000900460ff16156100715760405163f92ee8a960e01b815260040160405180910390fd5b80546001600160401b03908116146100d05780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b6080516129836100f95f395f8181611b8b01528181611bb40152611d3c01526129835ff3fe6080604052600436106102d9575f3560e01c806370a0823111610189578063a138c07e116100d8578063d547741f11610092578063e63ab1e91161006d578063e63ab1e9146108cf578063f42375b5146108ef578063f56cc6651461090e578063f72c0d8b1461092d575f5ffd5b8063d547741f14610872578063dd62ed3e14610891578063e42a96e7146108b0575f5ffd5b8063a138c07e146107aa578063a217fddf146107be578063a5125421146107d1578063a9059cbb146107f0578063ad3cb1cc1461080f578063d53913931461083f575f5ffd5b80638a8772051161014357806395d89b411161011e57806395d89b411461075a57806399acf7ad1461076e5780639c281430146107765780639ed6f9081461078b575f5ffd5b80638a877205146106f15780638d6cc56d1461071c57806391d148541461073b575f5ffd5b806370a082311461062b57806373cf558c1461066b57806379cc67901461068a5780637e36320b146106a95780637f51bb1f146106be5780638456cb59146106dd575f5ffd5b8063313ce567116102455780634f1ef286116101ff5780635c975abb116101da5780635c975abb1461058757806361d027b3146105aa5780636d07b7e5146105e15780636daa915b14610600575f5ffd5b80634f1ef2861461054c5780634fe153351461055f57806352d1902d14610573575f5ffd5b8063313ce567146104a057806331aab759146104bb57806336568abe146104db5780633f4ba83a146104fa57806340c10f191461050e57806342966c681461052d575f5ffd5b8063129af6fe11610296578063129af6fe146103d05780631794bb3c146103f157806318160ddd1461041057806323b872dd14610443578063248a9ca3146104625780632f2ff15d14610481575f5ffd5b806301d8a296146102dd57806301ffc9a71461031157806306fdde0314610330578063095ea7b314610351578063095f05e4146103705780630f4d741a1461039d575b5f5ffd5b3480156102e8575f5ffd5b506102fc6102f736600461243d565b610960565b60405190151581526020015b60405180910390f35b34801561031c575f5ffd5b506102fc61032b366004612456565b6109b0565b34801561033b575f5ffd5b506103446109e6565b604051610308919061249f565b34801561035c575f5ffd5b506102fc61036b3660046124d1565b610aa6565b34801561037b575f5ffd5b5061038f61038a3660046124f9565b610abd565b604051908152602001610308565b3480156103a8575f5ffd5b5061038f7f5ff8452a567af8e692d0608c7a8816f746446b757de3aecfd791fd4a19d2cd3581565b3480156103db575f5ffd5b506103ef6103ea3660046124d1565b610adc565b005b3480156103fc575f5ffd5b506103ef61040b366004612510565b610c34565b34801561041b575f5ffd5b507f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace025461038f565b34801561044e575f5ffd5b506102fc61045d366004612510565b610efc565b34801561046d575f5ffd5b5061038f61047c3660046124f9565b610f21565b34801561048c575f5ffd5b506103ef61049b36600461254a565b610f41565b3480156104ab575f5ffd5b5060405160128152602001610308565b3480156104c6575f5ffd5b5061038f5f51602061286e5f395f51905f5281565b3480156104e6575f5ffd5b506103ef6104f536600461254a565b610f63565b348015610505575f5ffd5b506103ef610f9b565b348015610519575f5ffd5b506103ef6105283660046124d1565b610fbd565b348015610538575f5ffd5b506103ef6105473660046124f9565b611038565b6103ef61055a366004612588565b611061565b34801561056a575f5ffd5b506103ef61107c565b34801561057e575f5ffd5b5061038f61117e565b348015610592575f5ffd5b505f51602061290e5f395f51905f525460ff166102fc565b3480156105b5575f5ffd5b506002546105c9906001600160a01b031681565b6040516001600160a01b039091168152602001610308565b3480156105ec575f5ffd5b5061038f6105fb36600461243d565b611199565b34801561060b575f5ffd5b5061038f61061a36600461243d565b60016020525f908152604090205481565b348015610636575f5ffd5b5061038f61064536600461243d565b6001600160a01b03165f9081525f51602061288e5f395f51905f52602052604090205490565b348015610676575f5ffd5b5061038f6106853660046124f9565b6111f5565b348015610695575f5ffd5b506103ef6106a43660046124d1565b61120c565b3480156106b4575f5ffd5b5061038f60055481565b3480156106c9575f5ffd5b506103ef6106d836600461243d565b61125d565b3480156106e8575f5ffd5b506103ef6112e0565b3480156106fc575f5ffd5b5061038f61070b36600461243d565b60066020525f908152604090205481565b348015610727575f5ffd5b506103ef6107363660046124f9565b6112ff565b348015610746575f5ffd5b506102fc61075536600461254a565b61137c565b348015610765575f5ffd5b506103446113b2565b6103ef6113f0565b348015610781575f5ffd5b5061038f60045481565b348015610796575f5ffd5b506103ef6107a536600461264c565b61152d565b3480156107b5575f5ffd5b5061038f5f5481565b3480156107c9575f5ffd5b5061038f5f81565b3480156107dc575f5ffd5b506103ef6107eb36600461243d565b6115b7565b3480156107fb575f5ffd5b506102fc61080a3660046124d1565b611639565b34801561081a575f5ffd5b50610344604051806040016040528060058152602001640352e302e360dc1b81525081565b34801561084a575f5ffd5b5061038f7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b34801561087d575f5ffd5b506103ef61088c36600461254a565b611646565b34801561089c575f5ffd5b5061038f6108ab36600461266c565b611662565b3480156108bb575f5ffd5b506003546105c9906001600160a01b031681565b3480156108da575f5ffd5b5061038f5f5160206128ce5f395f51905f5281565b3480156108fa575f5ffd5b506103ef61090936600461243d565b6116ab565b348015610919575f5ffd5b506103ef6109283660046124d1565b61172e565b348015610938575f5ffd5b5061038f7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e381565b5f6004545f0361097157505f919050565b6001600160a01b0382165f908152600660205260408120549081900361099a5750600192915050565b6005546109a782426126a8565b10159392505050565b5f6001600160e01b03198216637965db0b60e01b14806109e057506301ffc9a760e01b6001600160e01b03198316145b92915050565b7f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace0380546060915f51602061288e5f395f51905f5291610a24906126bb565b80601f0160208091040260200160405190810160405280929190818152602001828054610a50906126bb565b8015610a9b5780601f10610a7257610100808354040283529160200191610a9b565b820191905f5260205f20905b815481529060010190602001808311610a7e57829003601f168201915b505050505091505090565b5f33610ab38185856117e5565b5060019392505050565b5f8054610ad283670de0b6b3a76400006126f3565b6109e0919061270a565b610ae46117f2565b610aec611829565b6001600160a01b038216610b135760405163e6c4247b60e01b815260040160405180910390fd5b805f03610b335760405163162908e360e11b815260040160405180910390fd5b6001600160a01b0382165f9081526001602052604081205490819003610b6c57604051633dd1b30560e01b815260040160405180910390fd5b5f81610b8084670de0b6b3a76400006126f3565b610b8a919061270a565b9050805f03610bac5760405163162908e360e11b815260040160405180910390fd5b610bc7336002546001600160a01b0387811692911686611859565b610bd2335b826118b3565b60408051828152602081018590526001600160a01b0386169133917fb1bcc2292b71039693073f0742935db77a770dde7d4ea5caeab0255929b1f015910160405180910390a35050610c3060015f51602061292e5f395f51905f5255565b5050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff165f81158015610c795750825b90505f8267ffffffffffffffff166001148015610c955750303b155b905081158015610ca3575080155b15610cc15760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff191660011785558315610ceb57845460ff60401b1916600160401b1785555b6001600160a01b0388161580610d0857506001600160a01b038716155b15610d265760405163e6c4247b60e01b815260040160405180910390fd5b855f03610d465760405163162908e360e11b815260040160405180910390fd5b610d956040518060400160405280601281526020017121b93cb83a37902bb0b939902237b63630b960711b8152506040518060400160405280600381526020016210d5d160ea1b8152506118ff565b610d9d611911565b610da5611919565b610dad611911565b610db5611929565b610dbd611911565b610dc75f89611939565b50610df27f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a689611939565b50610e0a5f5160206128ce5f395f51905f5289611939565b50610e357f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e389611939565b50610e4d5f51602061286e5f395f51905f5289611939565b50610e787f5ff8452a567af8e692d0608c7a8816f746446b757de3aecfd791fd4a19d2cd3589611939565b50600280546001600160a01b0319166001600160a01b0389161790555f869055681b1ae4d6e2ef500000600455620151806005558315610ef257845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b5050505050505050565b5f33610f098582856119da565b610f14858585611a37565b60019150505b9392505050565b5f9081525f5160206128ee5f395f51905f52602052604090206001015490565b610f4a82610f21565b610f5381611a94565b610f5d8383611939565b50505050565b6001600160a01b0381163314610f8c5760405163334bd91960e11b815260040160405180910390fd5b610f968282611a9e565b505050565b5f5160206128ce5f395f51905f52610fb281611a94565b610fba611b17565b50565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6610fe781611a94565b6001600160a01b03831661100e5760405163e6c4247b60e01b815260040160405180910390fd5b815f0361102e5760405163162908e360e11b815260040160405180910390fd5b610f9683836118b3565b805f036110585760405163162908e360e11b815260040160405180910390fd5b610fba81611b76565b611069611b80565b61107282611c24565b610c308282611c75565b611084611829565b61108c6117f2565b335f90815260066020526040812054906110a682426126a8565b905081158015906110b8575060055481105b156110d65760405163cb095fcb60e01b815260040160405180910390fd5b6004545f036110f85760405163e87ab86760e01b815260040160405180910390fd5b335f908152600660205260408120429081905560055461111791612729565b9050611125336004546118b3565b600454604080519182526020820183905233917fe9c10f7331c8975614110129840773f57e5264acb38dab2e34506fe212fd9bf9910160405180910390a250505061117c60015f51602061292e5f395f51905f5255565b565b5f611187611d31565b505f5160206128ae5f395f51905f5290565b6001600160a01b0381165f908152600660205260408120548082036111c057505f92915050565b5f6111cb82426126a8565b905060055481106111df57505f9392505050565b806005546111ed91906126a8565b949350505050565b5f670de0b6b3a76400005f5483610ad291906126f3565b6001600160a01b0382166112335760405163e6c4247b60e01b815260040160405180910390fd5b805f036112535760405163162908e360e11b815260040160405180910390fd5b610c308282611d7a565b5f61126781611a94565b6001600160a01b03821661128e5760405163e6c4247b60e01b815260040160405180910390fd5b600280546001600160a01b038481166001600160a01b0319831681179093556040519116919082907f4ab5be82436d353e61ca18726e984e561f5c1cc7c6d38b29d2553c790434705a905f90a3505050565b5f5160206128ce5f395f51905f526112f781611a94565b610fba611d8f565b5f51602061286e5f395f51905f5261131681611a94565b815f036113365760405163162908e360e11b815260040160405180910390fd5b5f80549083905560408051828152602081018590527f945c1c4e99aa89f648fbfe3df471b916f719e16d960fcec0737d4d56bd69683891015b60405180910390a1505050565b5f9182525f5160206128ee5f395f51905f52602090815260408084206001600160a01b0393909316845291905290205460ff1690565b7f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace0480546060915f51602061288e5f395f51905f5291610a24906126bb565b6113f86117f2565b611400611829565b345f036114205760405163162908e360e11b815260040160405180910390fd5b5f805461143534670de0b6b3a76400006126f3565b61143f919061270a565b9050805f036114615760405163162908e360e11b815260040160405180910390fd5b61146a33610bcc565b6002546040515f916001600160a01b03169034908381818185875af1925050503d805f81146114b4576040519150601f19603f3d011682016040523d82523d5f602084013e6114b9565b606091505b50509050806114db576040516312171d8360e31b815260040160405180910390fd5b6040805183815234602082015233917f67f4d59762fb021ace4a0270ff935a6ae29594408facee34826c0b26bf65c052910160405180910390a2505061117c60015f51602061292e5f395f51905f5255565b7f5ff8452a567af8e692d0608c7a8816f746446b757de3aecfd791fd4a19d2cd3561155781611a94565b815f036115775760405163162908e360e11b815260040160405180910390fd5b6004839055600582905560408051848152602081018490527fc9a69a6e431cd49f27195267dcc0ac3476dd7cee36bbb4788e976c63d893e751910161136f565b5f51602061286e5f395f51905f526115ce81611a94565b6001600160a01b0382166115f55760405163e6c4247b60e01b815260040160405180910390fd5b6001600160a01b0382165f81815260016020526040808220829055517f85a3e72f8dd6db3794f93109c3c5f5b79d6112f6979431c45f98b26134b42af29190a25050565b5f33610ab3818585611a37565b61164f82610f21565b61165881611a94565b610f5d8383611a9e565b6001600160a01b039182165f9081527f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace016020908152604080832093909416825291909152205490565b5f6116b581611a94565b6001600160a01b0382166116dc5760405163e6c4247b60e01b815260040160405180910390fd5b600380546001600160a01b038481166001600160a01b0319831681179093556040519116919082907f7c271882dbf21ed4dd5184d3ec9d20012db645ce0f5669dc040cefedbd556748905f90a3505050565b5f51602061286e5f395f51905f5261174581611a94565b6001600160a01b03831661176c5760405163e6c4247b60e01b815260040160405180910390fd5b815f0361178c5760405163162908e360e11b815260040160405180910390fd5b6001600160a01b0383165f8181526001602052604090819020849055517f1cef96c693692f4beb6c09bfe69ff50bd430608c0ab5507c9979fac0f8c365bd906117d89085815260200190565b60405180910390a2505050565b610f968383836001611dd7565b5f51602061292e5f395f51905f5280546001190161182357604051633ee5aeb560e01b815260040160405180910390fd5b60029055565b5f51602061290e5f395f51905f525460ff161561117c5760405163d93c066560e01b815260040160405180910390fd5b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610f5d908590611ebb565b6001600160a01b0382166118e15760405163ec442f0560e01b81525f60048201526024015b60405180910390fd5b610c305f8383611f27565b60015f51602061292e5f395f51905f5255565b611907611fab565b610c308282611ff4565b61117c611fab565b611921611fab565b61117c612044565b611931611fab565b61117c612064565b5f5f5160206128ee5f395f51905f52611952848461137c565b6119d1575f848152602082815260408083206001600160a01b03871684529091529020805460ff191660011790556119873390565b6001600160a01b0316836001600160a01b0316857f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a460019150506109e0565b5f9150506109e0565b5f6119e58484611662565b90505f198114610f5d5781811015611a2957604051637dc7a0d960e11b81526001600160a01b038416600482015260248101829052604481018390526064016118d8565b610f5d84848484035f611dd7565b6001600160a01b038316611a6057604051634b637e8f60e11b81525f60048201526024016118d8565b6001600160a01b038216611a895760405163ec442f0560e01b81525f60048201526024016118d8565b610f96838383611f27565b610fba813361206c565b5f5f5160206128ee5f395f51905f52611ab7848461137c565b156119d1575f848152602082815260408083206001600160a01b0387168085529252808320805460ff1916905551339287917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a460019150506109e0565b611b1f6120a5565b5f51602061290e5f395f51905f52805460ff191681557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a150565b610fba33826120d4565b306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161480611c0657507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611bfa5f5160206128ae5f395f51905f52546001600160a01b031690565b6001600160a01b031614155b1561117c5760405163703e46dd60e11b815260040160405180910390fd5b7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e3611c4e81611a94565b6001600160a01b038216610c305760405163e6c4247b60e01b815260040160405180910390fd5b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015611ccf575060408051601f3d908101601f19168201909252611ccc9181019061273c565b60015b611cf757604051634c9c8ce360e01b81526001600160a01b03831660048201526024016118d8565b5f5160206128ae5f395f51905f528114611d2757604051632a87526960e21b8152600481018290526024016118d8565b610f968383612108565b306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461117c5760405163703e46dd60e11b815260040160405180910390fd5b611d858233836119da565b610c3082826120d4565b611d97611829565b5f51602061290e5f395f51905f52805460ff191660011781557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25833611b58565b5f51602061288e5f395f51905f526001600160a01b038516611e0e5760405163e602df0560e01b81525f60048201526024016118d8565b6001600160a01b038416611e3757604051634a1406b160e11b81525f60048201526024016118d8565b6001600160a01b038086165f90815260018301602090815260408083209388168352929052208390558115611eb457836001600160a01b0316856001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92585604051611eab91815260200190565b60405180910390a35b5050505050565b5f5f60205f8451602086015f885af180611eda576040513d5f823e3d81fd5b50505f513d91508115611ef1578060011415611efe565b6001600160a01b0384163b155b15610f5d57604051635274afe760e01b81526001600160a01b03851660048201526024016118d8565b6001600160a01b038381161590831615811582611f42575080155b8015611f5857506003546001600160a01b031615155b15611fa0576003546001600160a01b03908116858216811491871614811582611f7f575080155b15611f9d57604051638cd22d1960e01b815260040160405180910390fd5b50505b611eb485858561215d565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff1661117c57604051631afcd79f60e31b815260040160405180910390fd5b611ffc611fab565b5f51602061288e5f395f51905f527f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace036120358482612797565b5060048101610f5d8382612797565b61204c611fab565b5f51602061290e5f395f51905f52805460ff19169055565b6118ec611fab565b612076828261137c565b610c305760405163e2517d3f60e01b81526001600160a01b0382166004820152602481018390526044016118d8565b5f51602061290e5f395f51905f525460ff1661117c57604051638dfc202b60e01b815260040160405180910390fd5b6001600160a01b0382166120fd57604051634b637e8f60e11b81525f60048201526024016118d8565b610c30825f83611f27565b61211182612170565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a280511561215557610f9682826121d3565b610c30612245565b612165611829565b610f96838383612264565b806001600160a01b03163b5f036121a557604051634c9c8ce360e01b81526001600160a01b03821660048201526024016118d8565b5f5160206128ae5f395f51905f5280546001600160a01b0319166001600160a01b0392909216919091179055565b60605f5f846001600160a01b0316846040516121ef9190612852565b5f60405180830381855af49150503d805f8114612227576040519150601f19603f3d011682016040523d82523d5f602084013e61222c565b606091505b509150915061223c85838361239d565b95945050505050565b341561117c5760405163b398979f60e01b815260040160405180910390fd5b5f51602061288e5f395f51905f526001600160a01b03841661229e5781816002015f8282546122939190612729565b9091555061230e9050565b6001600160a01b0384165f90815260208290526040902054828110156122f05760405163391434e360e21b81526001600160a01b038616600482015260248101829052604481018490526064016118d8565b6001600160a01b0385165f9081526020839052604090209083900390555b6001600160a01b03831661232c57600281018054839003905561234a565b6001600160a01b0383165f9081526020829052604090208054830190555b826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161238f91815260200190565b60405180910390a350505050565b6060826123b2576123ad826123f9565b610f1a565b81511580156123c957506001600160a01b0384163b155b156123f257604051639996b31560e01b81526001600160a01b03851660048201526024016118d8565b5080610f1a565b8051156124095780518082602001fd5b60405163d6bda27560e01b815260040160405180910390fd5b80356001600160a01b0381168114612438575f5ffd5b919050565b5f6020828403121561244d575f5ffd5b610f1a82612422565b5f60208284031215612466575f5ffd5b81356001600160e01b031981168114610f1a575f5ffd5b5f5b8381101561249757818101518382015260200161247f565b50505f910152565b602081525f82518060208401526124bd81604085016020870161247d565b601f01601f19169190910160400192915050565b5f5f604083850312156124e2575f5ffd5b6124eb83612422565b946020939093013593505050565b5f60208284031215612509575f5ffd5b5035919050565b5f5f5f60608486031215612522575f5ffd5b61252b84612422565b925061253960208501612422565b929592945050506040919091013590565b5f5f6040838503121561255b575f5ffd5b8235915061256b60208401612422565b90509250929050565b634e487b7160e01b5f52604160045260245ffd5b5f5f60408385031215612599575f5ffd5b6125a283612422565b9150602083013567ffffffffffffffff8111156125bd575f5ffd5b8301601f810185136125cd575f5ffd5b803567ffffffffffffffff8111156125e7576125e7612574565b604051601f8201601f19908116603f0116810167ffffffffffffffff8111828210171561261657612616612574565b60405281815282820160200187101561262d575f5ffd5b816020840160208301375f602083830101528093505050509250929050565b5f5f6040838503121561265d575f5ffd5b50508035926020909101359150565b5f5f6040838503121561267d575f5ffd5b61268683612422565b915061256b60208401612422565b634e487b7160e01b5f52601160045260245ffd5b818103818111156109e0576109e0612694565b600181811c908216806126cf57607f821691505b6020821081036126ed57634e487b7160e01b5f52602260045260245ffd5b50919050565b80820281158282048414176109e0576109e0612694565b5f8261272457634e487b7160e01b5f52601260045260245ffd5b500490565b808201808211156109e0576109e0612694565b5f6020828403121561274c575f5ffd5b5051919050565b601f821115610f9657805f5260205f20601f840160051c810160208510156127785750805b601f840160051c820191505b81811015611eb4575f8155600101612784565b815167ffffffffffffffff8111156127b1576127b1612574565b6127c5816127bf84546126bb565b84612753565b6020601f8211600181146127f7575f83156127e05750848201515b5f19600385901b1c1916600184901b178455611eb4565b5f84815260208120601f198516915b828110156128265787850151825560209485019460019092019101612806565b508482101561284357868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b5f825161286381846020870161247d565b919091019291505056fe3515f38d031dcbca5f1dac4c5afc1efca2020e42efdd9c5806ae7e963d18435a52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace00360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800cd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f033009b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00a264697066735822122011cd953d85cdba16ae19efa1764eabae28ddf0b5b5753c444590bc00ff29168064736f6c634300081c0033
Deployed ByteCode
0x6080604052600436106102d9575f3560e01c806370a0823111610189578063a138c07e116100d8578063d547741f11610092578063e63ab1e91161006d578063e63ab1e9146108cf578063f42375b5146108ef578063f56cc6651461090e578063f72c0d8b1461092d575f5ffd5b8063d547741f14610872578063dd62ed3e14610891578063e42a96e7146108b0575f5ffd5b8063a138c07e146107aa578063a217fddf146107be578063a5125421146107d1578063a9059cbb146107f0578063ad3cb1cc1461080f578063d53913931461083f575f5ffd5b80638a8772051161014357806395d89b411161011e57806395d89b411461075a57806399acf7ad1461076e5780639c281430146107765780639ed6f9081461078b575f5ffd5b80638a877205146106f15780638d6cc56d1461071c57806391d148541461073b575f5ffd5b806370a082311461062b57806373cf558c1461066b57806379cc67901461068a5780637e36320b146106a95780637f51bb1f146106be5780638456cb59146106dd575f5ffd5b8063313ce567116102455780634f1ef286116101ff5780635c975abb116101da5780635c975abb1461058757806361d027b3146105aa5780636d07b7e5146105e15780636daa915b14610600575f5ffd5b80634f1ef2861461054c5780634fe153351461055f57806352d1902d14610573575f5ffd5b8063313ce567146104a057806331aab759146104bb57806336568abe146104db5780633f4ba83a146104fa57806340c10f191461050e57806342966c681461052d575f5ffd5b8063129af6fe11610296578063129af6fe146103d05780631794bb3c146103f157806318160ddd1461041057806323b872dd14610443578063248a9ca3146104625780632f2ff15d14610481575f5ffd5b806301d8a296146102dd57806301ffc9a71461031157806306fdde0314610330578063095ea7b314610351578063095f05e4146103705780630f4d741a1461039d575b5f5ffd5b3480156102e8575f5ffd5b506102fc6102f736600461243d565b610960565b60405190151581526020015b60405180910390f35b34801561031c575f5ffd5b506102fc61032b366004612456565b6109b0565b34801561033b575f5ffd5b506103446109e6565b604051610308919061249f565b34801561035c575f5ffd5b506102fc61036b3660046124d1565b610aa6565b34801561037b575f5ffd5b5061038f61038a3660046124f9565b610abd565b604051908152602001610308565b3480156103a8575f5ffd5b5061038f7f5ff8452a567af8e692d0608c7a8816f746446b757de3aecfd791fd4a19d2cd3581565b3480156103db575f5ffd5b506103ef6103ea3660046124d1565b610adc565b005b3480156103fc575f5ffd5b506103ef61040b366004612510565b610c34565b34801561041b575f5ffd5b507f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace025461038f565b34801561044e575f5ffd5b506102fc61045d366004612510565b610efc565b34801561046d575f5ffd5b5061038f61047c3660046124f9565b610f21565b34801561048c575f5ffd5b506103ef61049b36600461254a565b610f41565b3480156104ab575f5ffd5b5060405160128152602001610308565b3480156104c6575f5ffd5b5061038f5f51602061286e5f395f51905f5281565b3480156104e6575f5ffd5b506103ef6104f536600461254a565b610f63565b348015610505575f5ffd5b506103ef610f9b565b348015610519575f5ffd5b506103ef6105283660046124d1565b610fbd565b348015610538575f5ffd5b506103ef6105473660046124f9565b611038565b6103ef61055a366004612588565b611061565b34801561056a575f5ffd5b506103ef61107c565b34801561057e575f5ffd5b5061038f61117e565b348015610592575f5ffd5b505f51602061290e5f395f51905f525460ff166102fc565b3480156105b5575f5ffd5b506002546105c9906001600160a01b031681565b6040516001600160a01b039091168152602001610308565b3480156105ec575f5ffd5b5061038f6105fb36600461243d565b611199565b34801561060b575f5ffd5b5061038f61061a36600461243d565b60016020525f908152604090205481565b348015610636575f5ffd5b5061038f61064536600461243d565b6001600160a01b03165f9081525f51602061288e5f395f51905f52602052604090205490565b348015610676575f5ffd5b5061038f6106853660046124f9565b6111f5565b348015610695575f5ffd5b506103ef6106a43660046124d1565b61120c565b3480156106b4575f5ffd5b5061038f60055481565b3480156106c9575f5ffd5b506103ef6106d836600461243d565b61125d565b3480156106e8575f5ffd5b506103ef6112e0565b3480156106fc575f5ffd5b5061038f61070b36600461243d565b60066020525f908152604090205481565b348015610727575f5ffd5b506103ef6107363660046124f9565b6112ff565b348015610746575f5ffd5b506102fc61075536600461254a565b61137c565b348015610765575f5ffd5b506103446113b2565b6103ef6113f0565b348015610781575f5ffd5b5061038f60045481565b348015610796575f5ffd5b506103ef6107a536600461264c565b61152d565b3480156107b5575f5ffd5b5061038f5f5481565b3480156107c9575f5ffd5b5061038f5f81565b3480156107dc575f5ffd5b506103ef6107eb36600461243d565b6115b7565b3480156107fb575f5ffd5b506102fc61080a3660046124d1565b611639565b34801561081a575f5ffd5b50610344604051806040016040528060058152602001640352e302e360dc1b81525081565b34801561084a575f5ffd5b5061038f7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b34801561087d575f5ffd5b506103ef61088c36600461254a565b611646565b34801561089c575f5ffd5b5061038f6108ab36600461266c565b611662565b3480156108bb575f5ffd5b506003546105c9906001600160a01b031681565b3480156108da575f5ffd5b5061038f5f5160206128ce5f395f51905f5281565b3480156108fa575f5ffd5b506103ef61090936600461243d565b6116ab565b348015610919575f5ffd5b506103ef6109283660046124d1565b61172e565b348015610938575f5ffd5b5061038f7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e381565b5f6004545f0361097157505f919050565b6001600160a01b0382165f908152600660205260408120549081900361099a5750600192915050565b6005546109a782426126a8565b10159392505050565b5f6001600160e01b03198216637965db0b60e01b14806109e057506301ffc9a760e01b6001600160e01b03198316145b92915050565b7f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace0380546060915f51602061288e5f395f51905f5291610a24906126bb565b80601f0160208091040260200160405190810160405280929190818152602001828054610a50906126bb565b8015610a9b5780601f10610a7257610100808354040283529160200191610a9b565b820191905f5260205f20905b815481529060010190602001808311610a7e57829003601f168201915b505050505091505090565b5f33610ab38185856117e5565b5060019392505050565b5f8054610ad283670de0b6b3a76400006126f3565b6109e0919061270a565b610ae46117f2565b610aec611829565b6001600160a01b038216610b135760405163e6c4247b60e01b815260040160405180910390fd5b805f03610b335760405163162908e360e11b815260040160405180910390fd5b6001600160a01b0382165f9081526001602052604081205490819003610b6c57604051633dd1b30560e01b815260040160405180910390fd5b5f81610b8084670de0b6b3a76400006126f3565b610b8a919061270a565b9050805f03610bac5760405163162908e360e11b815260040160405180910390fd5b610bc7336002546001600160a01b0387811692911686611859565b610bd2335b826118b3565b60408051828152602081018590526001600160a01b0386169133917fb1bcc2292b71039693073f0742935db77a770dde7d4ea5caeab0255929b1f015910160405180910390a35050610c3060015f51602061292e5f395f51905f5255565b5050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff165f81158015610c795750825b90505f8267ffffffffffffffff166001148015610c955750303b155b905081158015610ca3575080155b15610cc15760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff191660011785558315610ceb57845460ff60401b1916600160401b1785555b6001600160a01b0388161580610d0857506001600160a01b038716155b15610d265760405163e6c4247b60e01b815260040160405180910390fd5b855f03610d465760405163162908e360e11b815260040160405180910390fd5b610d956040518060400160405280601281526020017121b93cb83a37902bb0b939902237b63630b960711b8152506040518060400160405280600381526020016210d5d160ea1b8152506118ff565b610d9d611911565b610da5611919565b610dad611911565b610db5611929565b610dbd611911565b610dc75f89611939565b50610df27f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a689611939565b50610e0a5f5160206128ce5f395f51905f5289611939565b50610e357f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e389611939565b50610e4d5f51602061286e5f395f51905f5289611939565b50610e787f5ff8452a567af8e692d0608c7a8816f746446b757de3aecfd791fd4a19d2cd3589611939565b50600280546001600160a01b0319166001600160a01b0389161790555f869055681b1ae4d6e2ef500000600455620151806005558315610ef257845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b5050505050505050565b5f33610f098582856119da565b610f14858585611a37565b60019150505b9392505050565b5f9081525f5160206128ee5f395f51905f52602052604090206001015490565b610f4a82610f21565b610f5381611a94565b610f5d8383611939565b50505050565b6001600160a01b0381163314610f8c5760405163334bd91960e11b815260040160405180910390fd5b610f968282611a9e565b505050565b5f5160206128ce5f395f51905f52610fb281611a94565b610fba611b17565b50565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6610fe781611a94565b6001600160a01b03831661100e5760405163e6c4247b60e01b815260040160405180910390fd5b815f0361102e5760405163162908e360e11b815260040160405180910390fd5b610f9683836118b3565b805f036110585760405163162908e360e11b815260040160405180910390fd5b610fba81611b76565b611069611b80565b61107282611c24565b610c308282611c75565b611084611829565b61108c6117f2565b335f90815260066020526040812054906110a682426126a8565b905081158015906110b8575060055481105b156110d65760405163cb095fcb60e01b815260040160405180910390fd5b6004545f036110f85760405163e87ab86760e01b815260040160405180910390fd5b335f908152600660205260408120429081905560055461111791612729565b9050611125336004546118b3565b600454604080519182526020820183905233917fe9c10f7331c8975614110129840773f57e5264acb38dab2e34506fe212fd9bf9910160405180910390a250505061117c60015f51602061292e5f395f51905f5255565b565b5f611187611d31565b505f5160206128ae5f395f51905f5290565b6001600160a01b0381165f908152600660205260408120548082036111c057505f92915050565b5f6111cb82426126a8565b905060055481106111df57505f9392505050565b806005546111ed91906126a8565b949350505050565b5f670de0b6b3a76400005f5483610ad291906126f3565b6001600160a01b0382166112335760405163e6c4247b60e01b815260040160405180910390fd5b805f036112535760405163162908e360e11b815260040160405180910390fd5b610c308282611d7a565b5f61126781611a94565b6001600160a01b03821661128e5760405163e6c4247b60e01b815260040160405180910390fd5b600280546001600160a01b038481166001600160a01b0319831681179093556040519116919082907f4ab5be82436d353e61ca18726e984e561f5c1cc7c6d38b29d2553c790434705a905f90a3505050565b5f5160206128ce5f395f51905f526112f781611a94565b610fba611d8f565b5f51602061286e5f395f51905f5261131681611a94565b815f036113365760405163162908e360e11b815260040160405180910390fd5b5f80549083905560408051828152602081018590527f945c1c4e99aa89f648fbfe3df471b916f719e16d960fcec0737d4d56bd69683891015b60405180910390a1505050565b5f9182525f5160206128ee5f395f51905f52602090815260408084206001600160a01b0393909316845291905290205460ff1690565b7f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace0480546060915f51602061288e5f395f51905f5291610a24906126bb565b6113f86117f2565b611400611829565b345f036114205760405163162908e360e11b815260040160405180910390fd5b5f805461143534670de0b6b3a76400006126f3565b61143f919061270a565b9050805f036114615760405163162908e360e11b815260040160405180910390fd5b61146a33610bcc565b6002546040515f916001600160a01b03169034908381818185875af1925050503d805f81146114b4576040519150601f19603f3d011682016040523d82523d5f602084013e6114b9565b606091505b50509050806114db576040516312171d8360e31b815260040160405180910390fd5b6040805183815234602082015233917f67f4d59762fb021ace4a0270ff935a6ae29594408facee34826c0b26bf65c052910160405180910390a2505061117c60015f51602061292e5f395f51905f5255565b7f5ff8452a567af8e692d0608c7a8816f746446b757de3aecfd791fd4a19d2cd3561155781611a94565b815f036115775760405163162908e360e11b815260040160405180910390fd5b6004839055600582905560408051848152602081018490527fc9a69a6e431cd49f27195267dcc0ac3476dd7cee36bbb4788e976c63d893e751910161136f565b5f51602061286e5f395f51905f526115ce81611a94565b6001600160a01b0382166115f55760405163e6c4247b60e01b815260040160405180910390fd5b6001600160a01b0382165f81815260016020526040808220829055517f85a3e72f8dd6db3794f93109c3c5f5b79d6112f6979431c45f98b26134b42af29190a25050565b5f33610ab3818585611a37565b61164f82610f21565b61165881611a94565b610f5d8383611a9e565b6001600160a01b039182165f9081527f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace016020908152604080832093909416825291909152205490565b5f6116b581611a94565b6001600160a01b0382166116dc5760405163e6c4247b60e01b815260040160405180910390fd5b600380546001600160a01b038481166001600160a01b0319831681179093556040519116919082907f7c271882dbf21ed4dd5184d3ec9d20012db645ce0f5669dc040cefedbd556748905f90a3505050565b5f51602061286e5f395f51905f5261174581611a94565b6001600160a01b03831661176c5760405163e6c4247b60e01b815260040160405180910390fd5b815f0361178c5760405163162908e360e11b815260040160405180910390fd5b6001600160a01b0383165f8181526001602052604090819020849055517f1cef96c693692f4beb6c09bfe69ff50bd430608c0ab5507c9979fac0f8c365bd906117d89085815260200190565b60405180910390a2505050565b610f968383836001611dd7565b5f51602061292e5f395f51905f5280546001190161182357604051633ee5aeb560e01b815260040160405180910390fd5b60029055565b5f51602061290e5f395f51905f525460ff161561117c5760405163d93c066560e01b815260040160405180910390fd5b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610f5d908590611ebb565b6001600160a01b0382166118e15760405163ec442f0560e01b81525f60048201526024015b60405180910390fd5b610c305f8383611f27565b60015f51602061292e5f395f51905f5255565b611907611fab565b610c308282611ff4565b61117c611fab565b611921611fab565b61117c612044565b611931611fab565b61117c612064565b5f5f5160206128ee5f395f51905f52611952848461137c565b6119d1575f848152602082815260408083206001600160a01b03871684529091529020805460ff191660011790556119873390565b6001600160a01b0316836001600160a01b0316857f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a460019150506109e0565b5f9150506109e0565b5f6119e58484611662565b90505f198114610f5d5781811015611a2957604051637dc7a0d960e11b81526001600160a01b038416600482015260248101829052604481018390526064016118d8565b610f5d84848484035f611dd7565b6001600160a01b038316611a6057604051634b637e8f60e11b81525f60048201526024016118d8565b6001600160a01b038216611a895760405163ec442f0560e01b81525f60048201526024016118d8565b610f96838383611f27565b610fba813361206c565b5f5f5160206128ee5f395f51905f52611ab7848461137c565b156119d1575f848152602082815260408083206001600160a01b0387168085529252808320805460ff1916905551339287917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a460019150506109e0565b611b1f6120a5565b5f51602061290e5f395f51905f52805460ff191681557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a150565b610fba33826120d4565b306001600160a01b037f0000000000000000000000006024e9da10a0b1982727b2920433119233d737c9161480611c0657507f0000000000000000000000006024e9da10a0b1982727b2920433119233d737c96001600160a01b0316611bfa5f5160206128ae5f395f51905f52546001600160a01b031690565b6001600160a01b031614155b1561117c5760405163703e46dd60e11b815260040160405180910390fd5b7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e3611c4e81611a94565b6001600160a01b038216610c305760405163e6c4247b60e01b815260040160405180910390fd5b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015611ccf575060408051601f3d908101601f19168201909252611ccc9181019061273c565b60015b611cf757604051634c9c8ce360e01b81526001600160a01b03831660048201526024016118d8565b5f5160206128ae5f395f51905f528114611d2757604051632a87526960e21b8152600481018290526024016118d8565b610f968383612108565b306001600160a01b037f0000000000000000000000006024e9da10a0b1982727b2920433119233d737c9161461117c5760405163703e46dd60e11b815260040160405180910390fd5b611d858233836119da565b610c3082826120d4565b611d97611829565b5f51602061290e5f395f51905f52805460ff191660011781557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25833611b58565b5f51602061288e5f395f51905f526001600160a01b038516611e0e5760405163e602df0560e01b81525f60048201526024016118d8565b6001600160a01b038416611e3757604051634a1406b160e11b81525f60048201526024016118d8565b6001600160a01b038086165f90815260018301602090815260408083209388168352929052208390558115611eb457836001600160a01b0316856001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92585604051611eab91815260200190565b60405180910390a35b5050505050565b5f5f60205f8451602086015f885af180611eda576040513d5f823e3d81fd5b50505f513d91508115611ef1578060011415611efe565b6001600160a01b0384163b155b15610f5d57604051635274afe760e01b81526001600160a01b03851660048201526024016118d8565b6001600160a01b038381161590831615811582611f42575080155b8015611f5857506003546001600160a01b031615155b15611fa0576003546001600160a01b03908116858216811491871614811582611f7f575080155b15611f9d57604051638cd22d1960e01b815260040160405180910390fd5b50505b611eb485858561215d565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff1661117c57604051631afcd79f60e31b815260040160405180910390fd5b611ffc611fab565b5f51602061288e5f395f51905f527f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace036120358482612797565b5060048101610f5d8382612797565b61204c611fab565b5f51602061290e5f395f51905f52805460ff19169055565b6118ec611fab565b612076828261137c565b610c305760405163e2517d3f60e01b81526001600160a01b0382166004820152602481018390526044016118d8565b5f51602061290e5f395f51905f525460ff1661117c57604051638dfc202b60e01b815260040160405180910390fd5b6001600160a01b0382166120fd57604051634b637e8f60e11b81525f60048201526024016118d8565b610c30825f83611f27565b61211182612170565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a280511561215557610f9682826121d3565b610c30612245565b612165611829565b610f96838383612264565b806001600160a01b03163b5f036121a557604051634c9c8ce360e01b81526001600160a01b03821660048201526024016118d8565b5f5160206128ae5f395f51905f5280546001600160a01b0319166001600160a01b0392909216919091179055565b60605f5f846001600160a01b0316846040516121ef9190612852565b5f60405180830381855af49150503d805f8114612227576040519150601f19603f3d011682016040523d82523d5f602084013e61222c565b606091505b509150915061223c85838361239d565b95945050505050565b341561117c5760405163b398979f60e01b815260040160405180910390fd5b5f51602061288e5f395f51905f526001600160a01b03841661229e5781816002015f8282546122939190612729565b9091555061230e9050565b6001600160a01b0384165f90815260208290526040902054828110156122f05760405163391434e360e21b81526001600160a01b038616600482015260248101829052604481018490526064016118d8565b6001600160a01b0385165f9081526020839052604090209083900390555b6001600160a01b03831661232c57600281018054839003905561234a565b6001600160a01b0383165f9081526020829052604090208054830190555b826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161238f91815260200190565b60405180910390a350505050565b6060826123b2576123ad826123f9565b610f1a565b81511580156123c957506001600160a01b0384163b155b156123f257604051639996b31560e01b81526001600160a01b03851660048201526024016118d8565b5080610f1a565b8051156124095780518082602001fd5b60405163d6bda27560e01b815260040160405180910390fd5b80356001600160a01b0381168114612438575f5ffd5b919050565b5f6020828403121561244d575f5ffd5b610f1a82612422565b5f60208284031215612466575f5ffd5b81356001600160e01b031981168114610f1a575f5ffd5b5f5b8381101561249757818101518382015260200161247f565b50505f910152565b602081525f82518060208401526124bd81604085016020870161247d565b601f01601f19169190910160400192915050565b5f5f604083850312156124e2575f5ffd5b6124eb83612422565b946020939093013593505050565b5f60208284031215612509575f5ffd5b5035919050565b5f5f5f60608486031215612522575f5ffd5b61252b84612422565b925061253960208501612422565b929592945050506040919091013590565b5f5f6040838503121561255b575f5ffd5b8235915061256b60208401612422565b90509250929050565b634e487b7160e01b5f52604160045260245ffd5b5f5f60408385031215612599575f5ffd5b6125a283612422565b9150602083013567ffffffffffffffff8111156125bd575f5ffd5b8301601f810185136125cd575f5ffd5b803567ffffffffffffffff8111156125e7576125e7612574565b604051601f8201601f19908116603f0116810167ffffffffffffffff8111828210171561261657612616612574565b60405281815282820160200187101561262d575f5ffd5b816020840160208301375f602083830101528093505050509250929050565b5f5f6040838503121561265d575f5ffd5b50508035926020909101359150565b5f5f6040838503121561267d575f5ffd5b61268683612422565b915061256b60208401612422565b634e487b7160e01b5f52601160045260245ffd5b818103818111156109e0576109e0612694565b600181811c908216806126cf57607f821691505b6020821081036126ed57634e487b7160e01b5f52602260045260245ffd5b50919050565b80820281158282048414176109e0576109e0612694565b5f8261272457634e487b7160e01b5f52601260045260245ffd5b500490565b808201808211156109e0576109e0612694565b5f6020828403121561274c575f5ffd5b5051919050565b601f821115610f9657805f5260205f20601f840160051c810160208510156127785750805b601f840160051c820191505b81811015611eb4575f8155600101612784565b815167ffffffffffffffff8111156127b1576127b1612574565b6127c5816127bf84546126bb565b84612753565b6020601f8211600181146127f7575f83156127e05750848201515b5f19600385901b1c1916600184901b178455611eb4565b5f84815260208120601f198516915b828110156128265787850151825560209485019460019092019101612806565b508482101561284357868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b5f825161286381846020870161247d565b919091019291505056fe3515f38d031dcbca5f1dac4c5afc1efca2020e42efdd9c5806ae7e963d18435a52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace00360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800cd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f033009b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00a264697066735822122011cd953d85cdba16ae19efa1764eabae28ddf0b5b5753c444590bc00ff29168064736f6c634300081c0033