ETH Price: $3,435.51 (-1.46%)

Contract

0x25f3ADB0f0Cc60947eB29B2EdDfe51713934DffB
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Staking

Compiler Version
v0.8.18+commit.87f61d96

Optimization Enabled:
Yes with 100 runs

Other Settings:
default evmVersion
File 1 of 12 : Staking.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";

/**
 * @title Staking contract
 * @dev This contract allows users to stake ERC20 tokens and ERC721 NFTs.
 * The contract calculates points based on the amount of ERC20 tokens staked and
 * the number of specific ERC721 NFTs (sheriff and pioneer) staked.
 * Users can unstake their assets after a cooldown period.
 */
contract Staking is Initializable, OwnableUpgradeable, ReentrancyGuardUpgradeable {
	using SafeERC20 for IERC20;

	/// @dev The cooldown period for unstaking assets
	uint256 public cooldownPeriod;

	// ERC20 staking
	/// @dev The ERC20 token accepted for staking
	IERC20 public acceptedToken;

	/// @dev Mapping of user addresses to their staked ERC20 token balance
	mapping(address => uint256) public staking;

	/// @dev Mapping of user addresses to their pending ERC20 token withdrawals
	mapping(address => PendingERC20Withdrawal) public pendingERC20Withdrawals;

	// ERC721 staking
	/// @dev The ERC721 sheriff NFT contract
	IERC721 public sheriffNft;

	/// @dev The ERC721 pioneer NFT contract
	IERC721 public pioneerNft;

	/// @dev The maximum number of NFTs a user can stake
	uint256 public maxNftStaking;

	/// @dev Mapping from number of pioneers => number of sheriff => multiplier
	mapping(uint256 => mapping(uint256 => Multiplier)) public multiplierMatrix;

	/// @dev Mapping of user addresses to the NFT contract and the token IDs they have staked
	mapping(address => mapping(IERC721 => uint256[])) public erc721Stakings;

	/// @dev Mapping of user addresses to the NFT contract and their pending NFT withdrawals
	mapping(address => mapping(IERC721 => PendingERC721Withdrawal[]))
		public pendingERC721Withdrawals;

	// Events
	/// @dev Emitted when a user stakes ERC20 tokens
	event StakedERC20(address indexed who, uint indexed amount, uint when);

	/// @dev Emitted when a user unstakes ERC20 tokens
	event UnstakedERC20(address indexed who, uint indexed amount, uint when);

	/// @dev Emitted when a user withdraws ERC20 tokens
	event WithdrawalERC20(address indexed who, uint indexed amount, uint when);

	/// @dev Emitted when a user stakes an ERC721 NFT
	event StakedERC721(
		address indexed who,
		address indexed token,
		uint256 indexed tokenId,
		uint when
	);

	/// @dev Emitted when a user unstakes an ERC721 NFT
	event UnstakedERC721(
		address indexed who,
		address indexed token,
		uint256 indexed tokenId,
		uint when
	);

	/// @dev Emitted when a user withdraws an ERC721 NFT
	event WithdrawalERC721(
		address indexed who,
		address indexed token,
		uint256 indexed tokenId,
		uint when
	);

	// Structs
	/// @dev Represents a multiplier with a numerator and denominator
	struct Multiplier {
		uint128 numerator;
		uint128 denominator;
	}

	/// @dev Represents a pending ERC20 token withdrawal
	struct PendingERC20Withdrawal {
		uint256 amount;
		uint128 applicableAt;
	}

	/// @dev Represents a pending ERC721 NFT withdrawal
	struct PendingERC721Withdrawal {
		uint256 tokenId;
		uint128 applicableAt;
	}

	/**
	 * @dev Initializes the contract with the specified sheriff NFT, pioneer NFT, and accepted ERC20 token.
	 * @param _sheriff The address of the sheriff NFT contract
	 * @param _pioneer The address of the pioneer NFT contract
	 * @param _acceptedToken The address of the ERC20 token accepted for staking
	 */
	function initialize(
		IERC721 _sheriff,
		IERC721 _pioneer,
		IERC20 _acceptedToken
	) public initializer {
		__Ownable_init();
		__ReentrancyGuard_init();

		sheriffNft = _sheriff;
		pioneerNft = _pioneer;
		acceptedToken = _acceptedToken;

		cooldownPeriod = 30 days;
		maxNftStaking = 3;

		multiplierMatrix[0][0] = Multiplier(1, 1);
		multiplierMatrix[0][1] = Multiplier(1250, 1000);
		multiplierMatrix[0][2] = Multiplier(1650, 1000);
		multiplierMatrix[0][3] = Multiplier(2250, 1000);
		multiplierMatrix[1][0] = Multiplier(1025, 1000);
		multiplierMatrix[1][1] = Multiplier(1300, 1000);
		multiplierMatrix[1][2] = Multiplier(1690, 1000);
		multiplierMatrix[1][3] = Multiplier(2350, 1000);
		multiplierMatrix[2][0] = Multiplier(1050, 1000);
		multiplierMatrix[2][1] = Multiplier(1400, 1000);
		multiplierMatrix[2][2] = Multiplier(1750, 1000);
		multiplierMatrix[2][3] = Multiplier(2500, 1000);
		multiplierMatrix[3][0] = Multiplier(1100, 1000);
		multiplierMatrix[3][1] = Multiplier(1500, 1000);
		multiplierMatrix[3][2] = Multiplier(1825, 1000);
		multiplierMatrix[3][3] = Multiplier(2750, 1000);
	}

	/**
	 * @dev Sets the cooldown period for unstaking assets.
	 * @param _cooldownPeriod The cooldown period in seconds
	 */
	function setCooldownPeriod(uint256 _cooldownPeriod) external onlyOwner {
		cooldownPeriod = _cooldownPeriod;
	}

	/**
	 * @dev Sets the maximum number of NFTs a user can stake.
	 * @param _maxNftStaking The maximum number of NFTs
	 */
	function setMaxNftStaking(uint256 _maxNftStaking) external onlyOwner {
		maxNftStaking = _maxNftStaking;
	}

	/**
	 * @dev Sets the multiplier matrix for calculating points based on the number of staked NFTs.
	 * @param numerator The array of numerators for each multiplier
	 * @param denominator The array of denominators for each multiplier
	 */
	function setMultiplier(
		uint128[] memory numerator,
		uint128[] memory denominator
	) external onlyOwner {
		require(numerator.length == denominator.length, "Staking: Invalid input");

		uint256 rowCount = maxNftStaking + 1;
		require(numerator.length == rowCount * rowCount, "Staking: Invalid input");

		for (uint256 i = 0; i < numerator.length; i++) {
			multiplierMatrix[i / rowCount][i % rowCount] = Multiplier(numerator[i], denominator[i]);
		}
	}

	/**
	 * @dev Stakes the specified amount of ERC20 tokens.
	 * @param _amount The amount of tokens to stake
	 */
	function stakeERC20(uint256 _amount) external nonReentrant {
		require(_amount > 0, "Staking: Amount must be greater than 0");
		acceptedToken.safeTransferFrom(msg.sender, address(this), _amount);
		staking[msg.sender] += _amount;
		emit StakedERC20(msg.sender, _amount, block.timestamp);
	}

	/**
	 * @dev Unstakes the specified amount of ERC20 tokens.
	 * @param _amount The amount of tokens to unstake
	 */
	function unstakeERC20(uint256 _amount) external nonReentrant {
		require(_amount > 0, "Staking: Amount must be greater than 0");
		require(staking[msg.sender] >= _amount, "Staking: Not enough staked amount");
		staking[msg.sender] -= _amount;
		PendingERC20Withdrawal storage pending = pendingERC20Withdrawals[msg.sender];
		pending.amount += _amount;
		pending.applicableAt = uint128(block.timestamp + cooldownPeriod);
		emit UnstakedERC20(msg.sender, _amount, block.timestamp);
	}

	/**
	 * @dev Withdraws the pending ERC20 tokens after the cooldown period.
	 */
	function withdrawERC20() external nonReentrant {
		PendingERC20Withdrawal storage pending = pendingERC20Withdrawals[msg.sender];
		require(pending.amount > 0, "Staking: No pending withdrawal for this address");
		require(pending.applicableAt <= block.timestamp, "Staking: Withdrawal not applicable yet");
		uint256 amount = pending.amount;
		pending.amount = 0;
		pending.applicableAt = 0;
		acceptedToken.safeTransfer(msg.sender, amount);
		emit WithdrawalERC20(msg.sender, amount, block.timestamp);
	}

	/**
	 * @dev Stakes the specified ERC721 NFT.
	 * @param _nft The address of the NFT contract
	 * @param _tokenId The token ID of the NFT to stake
	 */
	function stakeERC721(IERC721 _nft, uint256 _tokenId) public nonReentrant {
		require(_nft == sheriffNft || _nft == pioneerNft, "Staking: NFT not supported");
		require(_nft.ownerOf(_tokenId) == msg.sender, "Staking: Not owner of NFT");
		uint256[] storage staked = erc721Stakings[msg.sender][_nft];
		require(staked.length < maxNftStaking, "Staking: Max NFT staking reached");
		_nft.safeTransferFrom(msg.sender, address(this), _tokenId);
		staked.push(_tokenId);
		emit StakedERC721(msg.sender, address(_nft), _tokenId, block.timestamp);
	}

	/**
	 * @dev Stakes multiple ERC721 NFTs.
	 * @param _nft The address of the NFT contract
	 * @param _tokenIds The array of token IDs of the NFTs to stake
	 */
	function stakeMultipleERC721(IERC721 _nft, uint256[] memory _tokenIds) public nonReentrant {
		require(_nft == sheriffNft || _nft == pioneerNft, "Staking: NFT not supported");

		uint256[] storage staked = erc721Stakings[msg.sender][_nft];
		require(
			staked.length + _tokenIds.length <= maxNftStaking,
			"Staking: Max NFT staking reached"
		);

		for (uint256 i = 0; i < _tokenIds.length; i++) {
			uint256 _tokenId = _tokenIds[i];
			require(_nft.ownerOf(_tokenId) == msg.sender, "Staking: Not owner of NFT");
			_nft.safeTransferFrom(msg.sender, address(this), _tokenId);
			staked.push(_tokenId);
			emit StakedERC721(msg.sender, address(_nft), _tokenId, block.timestamp);
		}
	}

	/**
	 * @dev Unstakes the specified ERC721 NFT.
	 * @param _nft The address of the NFT contract
	 * @param _tokenId The token ID of the NFT to unstake
	 */
	function unstakeERC721(IERC721 _nft, uint256 _tokenId) public nonReentrant {
		require(_nft == sheriffNft || _nft == pioneerNft, "Staking: NFT not supported");
		require(erc721Stakings[msg.sender][_nft].length > 0, "Staking: No NFT staked");
		uint256[] storage staked = erc721Stakings[msg.sender][_nft];

		uint256 idx = _indexOf(staked, _tokenId);
		require(idx != staked.length, "Staking: NFT not staked");
		_remove(staked, idx);
		PendingERC721Withdrawal[] storage pending = pendingERC721Withdrawals[msg.sender][_nft];
		pending.push(PendingERC721Withdrawal(_tokenId, uint128(block.timestamp + cooldownPeriod)));
		emit UnstakedERC721(msg.sender, address(_nft), _tokenId, block.timestamp);
	}

	/**
	 * @dev Unstakes multiple ERC721 NFTs.
	 * @param _nft The address of the NFT contract
	 * @param _tokenIds The array of token IDs of the NFTs to unstake
	 */
	function unstakeMultipleERC721(IERC721 _nft, uint256[] memory _tokenIds) public nonReentrant {
		require(_nft == sheriffNft || _nft == pioneerNft, "Staking: NFT not supported");
		require(erc721Stakings[msg.sender][_nft].length > 0, "Staking: No NFT staked");

		uint256[] storage staked = erc721Stakings[msg.sender][_nft];

		for (uint256 i = 0; i < _tokenIds.length; i++) {
			uint256 _tokenId = _tokenIds[i];

			uint256 idx = _indexOf(staked, _tokenId);
			require(idx != staked.length, "Staking: NFT not staked");

			_remove(staked, idx);
			PendingERC721Withdrawal[] storage pending = pendingERC721Withdrawals[msg.sender][_nft];
			pending.push(
				PendingERC721Withdrawal(_tokenId, uint128(block.timestamp + cooldownPeriod))
			);
			emit UnstakedERC721(msg.sender, address(_nft), _tokenId, block.timestamp);
		}
	}

	/**
	 * @dev Withdraws the specified pending ERC721 NFT after the cooldown period.
	 * @param _nft The address of the NFT contract
	 * @param _tokenId The token ID of the NFT to withdraw
	 */
	function withdrawERC721(IERC721 _nft, uint256 _tokenId) public nonReentrant {
		require(_nft == sheriffNft || _nft == pioneerNft, "Staking: NFT not supported");

		PendingERC721Withdrawal[] storage pending = pendingERC721Withdrawals[msg.sender][_nft];
		require(pending.length > 0, "Staking: No pending withdrawal for this address");

		uint256 idx = pending.length;
		for (uint256 i = 0; i < pending.length; i++) {
			if (pending[i].tokenId == _tokenId) {
				idx = i;
				break;
			}
		}
		require(idx != pending.length, "Staking: NFT not pending withdrawal");
		require(
			pending[idx].applicableAt <= block.timestamp,
			"Staking: Withdrawal not applicable yet"
		);
		pending[idx] = pending[pending.length - 1];
		pending.pop();
		_nft.safeTransferFrom(address(this), msg.sender, _tokenId);
		emit WithdrawalERC721(msg.sender, address(_nft), _tokenId, block.timestamp);
	}

	/**
	 * @dev Withdraws multiple pending ERC721 NFTs after the cooldown period.
	 * @param _nft The address of the NFT contract
	 * @param _tokenIds The array of token IDs of the NFTs to withdraw
	 */
	function withdrawMultipleERC721(IERC721 _nft, uint256[] memory _tokenIds) public nonReentrant {
		require(_nft == sheriffNft || _nft == pioneerNft, "Staking: NFT not supported");
		PendingERC721Withdrawal[] storage pending = pendingERC721Withdrawals[msg.sender][_nft];
		require(pending.length > 0, "Staking: No pending withdrawal for this address");

		for (uint256 i = 0; i < _tokenIds.length; i++) {
			uint256 _tokenId = _tokenIds[i];
			uint256 idx = pending.length;
			for (uint256 j = 0; j < pending.length; j++) {
				if (pending[j].tokenId == _tokenId) {
					idx = j;
					break;
				}
			}
			require(idx != pending.length, "Staking: NFT not pending withdrawal");
			require(
				pending[idx].applicableAt <= block.timestamp,
				"Staking: Withdrawal not applicable yet"
			);
			pending[idx] = pending[pending.length - 1];
			pending.pop();
			_nft.safeTransferFrom(address(this), msg.sender, _tokenId);
			emit WithdrawalERC721(msg.sender, address(_nft), _tokenId, block.timestamp);
		}
	}

	/**
	 * @dev Calculates the total points for a user based on their staked ERC20 tokens and NFTs.
	 * @param _who The address of the user
	 * @return The total points for the user
	 */
	function getTotalPoints(address _who) public view returns (uint256) {
		uint256 totalPoints = staking[_who];
		Multiplier memory multiplier = getMultiplier(_who);
		return (totalPoints * multiplier.numerator) / multiplier.denominator;
	}

	/**
	 * @dev Returns the staked ERC721 NFTs for a user.
	 * @param _who The address of the user
	 * @param _nft The address of the NFT contract
	 * @return The array of token IDs of the staked NFTs
	 */
	function getERC721Stakings(address _who, IERC721 _nft) public view returns (uint256[] memory) {
		return erc721Stakings[_who][_nft];
	}

	/**
	 * @dev Returns the pending ERC721 NFT withdrawals for a user.
	 * @param _who The address of the user
	 * @param _nft The address of the NFT contract
	 * @return The array of pending NFT withdrawals
	 */
	function getPendingERC721Withdrawals(
		address _who,
		IERC721 _nft
	) public view returns (PendingERC721Withdrawal[] memory) {
		return pendingERC721Withdrawals[_who][_nft];
	}

	/**
	 * @dev Returns the multiplier for a user based on the number of staked pioneer and sheriff NFTs.
	 * @param _who The address of the user
	 * @return The multiplier struct containing the numerator and denominator
	 */
	function getMultiplier(address _who) public view returns (Multiplier memory) {
		uint256[] memory pioneerStaked = erc721Stakings[_who][pioneerNft];
		uint256[] memory sheriffStaked = erc721Stakings[_who][sheriffNft];

		Multiplier memory multiplier = multiplierMatrix[pioneerStaked.length][sheriffStaked.length];

		if (multiplier.denominator == 0) {
			return Multiplier(1, 1);
		}

		return multiplier;
	}

	/**
	 * @dev Handles the receipt of an ERC721 NFT.
	 * @return The selector of the `onERC721Received` function
	 */
	function onERC721Received(
		address,
		address,
		uint256,
		bytes calldata
	) external pure returns (bytes4) {
		return bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"));
	}

	/**
	 * @dev Returns the index of a value in a uint256 array.
	 * @param arr The array to search
	 * @param val The value to find
	 * @return The index of the value in the array, or the array length if not found
	 */
	function _indexOf(uint256[] storage arr, uint256 val) internal view returns (uint256) {
		for (uint256 i = 0; i < arr.length; i++) {
			if (arr[i] == val) {
				return i;
			}
		}
		return arr.length;
	}

	/**
	 * @dev Removes an element from a uint256 array at the specified index.
	 * @param arr The array to modify
	 * @param idx The index of the element to remove
	 */
	function _remove(uint256[] storage arr, uint256 idx) internal {
		arr[idx] = arr[arr.length - 1];
		arr.pop();
	}
}

File 2 of 12 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init() internal onlyInitializing {
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal onlyInitializing {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 3 of 12 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
     * constructor.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: setting the version to 255 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized < type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint8) {
        return _initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _initializing;
    }
}

File 4 of 12 : ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuardUpgradeable is Initializable {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    function __ReentrancyGuard_init() internal onlyInitializing {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 5 of 12 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/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.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

File 6 of 12 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 7 of 12 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 8 of 12 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) external returns (bool);
}

File 9 of 12 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 10 of 12 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) external;

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);
}

File 11 of 12 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/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.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

File 12 of 12 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 100
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"who","type":"address"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"when","type":"uint256"}],"name":"StakedERC20","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"who","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"when","type":"uint256"}],"name":"StakedERC721","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"who","type":"address"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"when","type":"uint256"}],"name":"UnstakedERC20","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"who","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"when","type":"uint256"}],"name":"UnstakedERC721","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"who","type":"address"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"when","type":"uint256"}],"name":"WithdrawalERC20","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"who","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"when","type":"uint256"}],"name":"WithdrawalERC721","type":"event"},{"inputs":[],"name":"acceptedToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cooldownPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"contract IERC721","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"erc721Stakings","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_who","type":"address"},{"internalType":"contract IERC721","name":"_nft","type":"address"}],"name":"getERC721Stakings","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_who","type":"address"}],"name":"getMultiplier","outputs":[{"components":[{"internalType":"uint128","name":"numerator","type":"uint128"},{"internalType":"uint128","name":"denominator","type":"uint128"}],"internalType":"struct Staking.Multiplier","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_who","type":"address"},{"internalType":"contract IERC721","name":"_nft","type":"address"}],"name":"getPendingERC721Withdrawals","outputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint128","name":"applicableAt","type":"uint128"}],"internalType":"struct Staking.PendingERC721Withdrawal[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_who","type":"address"}],"name":"getTotalPoints","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_sheriff","type":"address"},{"internalType":"contract IERC721","name":"_pioneer","type":"address"},{"internalType":"contract IERC20","name":"_acceptedToken","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"maxNftStaking","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"multiplierMatrix","outputs":[{"internalType":"uint128","name":"numerator","type":"uint128"},{"internalType":"uint128","name":"denominator","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"pendingERC20Withdrawals","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint128","name":"applicableAt","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"contract IERC721","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"pendingERC721Withdrawals","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint128","name":"applicableAt","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pioneerNft","outputs":[{"internalType":"contract IERC721","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_cooldownPeriod","type":"uint256"}],"name":"setCooldownPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxNftStaking","type":"uint256"}],"name":"setMaxNftStaking","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint128[]","name":"numerator","type":"uint128[]"},{"internalType":"uint128[]","name":"denominator","type":"uint128[]"}],"name":"setMultiplier","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sheriffNft","outputs":[{"internalType":"contract IERC721","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"stakeERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_nft","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"stakeERC721","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_nft","type":"address"},{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"}],"name":"stakeMultipleERC721","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"staking","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"unstakeERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_nft","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"unstakeERC721","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_nft","type":"address"},{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"}],"name":"unstakeMultipleERC721","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_nft","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"withdrawERC721","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_nft","type":"address"},{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"}],"name":"withdrawMultipleERC721","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50612f59806100206000396000f3fe608060405234801561001057600080fd5b50600436106101a55760003560e01c806380ea3de1116100ef578063cc7ef50911610092578063cc7ef50914610465578063d764b78f14610478578063d80e129214610498578063de8ffad3146104ab578063f2fde38b146104be578063f3005884146104d1578063f3e414f8146104e4578063ffce1133146104f757600080fd5b806380ea3de11461032557806385e5c262146103385780638da5cb5b14610397578063a67ed4ee146103a8578063a7262aac146103d8578063a9c9cddb146103f8578063a9d637e114610418578063c0c53b8b1461045257600080fd5b80633881f1b6116101575780633881f1b61461026d578063451c3d80146102985780634c23648d146102ab578063524b28f9146102be57806356dd2a0f146102d1578063715018a614610301578063750b5e1d146103095780637dfae3341461031257600080fd5b806303abf022146101aa57806304646a49146101d057806307506ec3146101d9578063075b52c6146101ee5780631088ce9014610201578063150b7a02146102145780632ed6d5e814610265575b600080fd5b6101bd6101b836600461265d565b61050a565b6040519081526020015b60405180910390f35b6101bd60975481565b6101ec6101e7366004612709565b610548565b005b6101ec6101fc3660046127b4565b610859565b6101bd61020f3660046127e0565b610a1d565b61024c610222366004612804565b7f150b7a023d4804d13e8c85fb27262cb750cf6ba9f9dd3bb30d90f482ceeb4b1f95945050505050565b6040516001600160e01b031990911681526020016101c7565b6101ec610a7b565b609c54610280906001600160a01b031681565b6040516001600160a01b0390911681526020016101c7565b609854610280906001600160a01b031681565b6101ec6102b93660046127b4565b610b53565b6101ec6102cc36600461291f565b610d41565b6102e46102df36600461265d565b610e80565b604080519283526001600160801b039091166020830152016101c7565b6101ec610ed3565b6101bd609d5481565b6101ec610320366004612983565b610ee5565b6101ec610333366004612983565b611036565b61037761034636600461299c565b609e6020908152600092835260408084209091529082529020546001600160801b0380821691600160801b90041682565b604080516001600160801b039384168152929091166020830152016101c7565b6033546001600160a01b0316610280565b6102e46103b63660046127e0565b609a60205260009081526040902080546001909101546001600160801b031682565b6103eb6103e63660046129be565b611043565b6040516101c791906129f7565b61040b6104063660046129be565b6110bd565b6040516101c79190612a3b565b61042b6104263660046127e0565b611155565b6040805182516001600160801b0390811682526020938401511692810192909252016101c7565b6101ec610460366004612a93565b6112b8565b6101ec610473366004612983565b611927565b6101bd6104863660046127e0565b60996020526000908152604090205481565b6101ec6104a6366004612983565b6119cc565b6101ec6104b9366004612709565b6119d9565b6101ec6104cc3660046127e0565b611c14565b6101ec6104df366004612709565b611c8a565b6101ec6104f23660046127b4565b611e81565b609b54610280906001600160a01b031681565b609f602052826000526040600020602052816000526040600020818154811061053257600080fd5b9060005260206000200160009250925050505481565b610550612142565b609b546001600160a01b03838116911614806105795750609c546001600160a01b038381169116145b61059e5760405162461bcd60e51b815260040161059590612ade565b60405180910390fd5b33600090815260a0602090815260408083206001600160a01b0386168452909152902080546105df5760405162461bcd60e51b815260040161059590612b15565b60005b82518110156108495760008382815181106105ff576105ff612b64565b6020908102919091010151835490915060005b845481101561065f578285828154811061062e5761062e612b64565b9060005260206000209060020201600001540361064d5780915061065f565b8061065781612b90565b915050610612565b50835481036106805760405162461bcd60e51b815260040161059590612ba9565b4284828154811061069357610693612b64565b60009182526020909120600160029092020101546001600160801b031611156106ce5760405162461bcd60e51b815260040161059590612bec565b835484906106de90600190612c32565b815481106106ee576106ee612b64565b906000526020600020906002020184828154811061070e5761070e612b64565b600091825260209091208254600290920201908155600191820154910180546001600160801b0319166001600160801b03909216919091179055835484908061075957610759612c45565b60008281526020812060026000199093019283020190815560010180546001600160801b03191690559055604051632142170760e11b81526001600160a01b038716906342842e0e906107b490309033908790600401612c5b565b600060405180830381600087803b1580156107ce57600080fd5b505af11580156107e2573d6000803e3d6000fd5b5050505081866001600160a01b0316336001600160a01b03167f6e00704bd932b4c7e1820fda45944eb9ed72ddb39f306f30286238c6c347d88a4260405161082c91815260200190565b60405180910390a45050808061084190612b90565b9150506105e2565b50506108556001606555565b5050565b610861612142565b609b546001600160a01b038381169116148061088a5750609c546001600160a01b038381169116145b6108a65760405162461bcd60e51b815260040161059590612ade565b336000908152609f602090815260408083206001600160a01b03861684529091529020546108e65760405162461bcd60e51b815260040161059590612c7f565b336000908152609f602090815260408083206001600160a01b038616845290915281209061091482846121a2565b825490915081036109375760405162461bcd60e51b815260040161059590612caf565b61094182826121f4565b33600090815260a0602090815260408083206001600160a01b03881684528252918290208251808401909352858352609754909283929091908201906109879042612ce0565b6001600160801b039081169091528254600180820185556000948552602094859020845160029093020191825592840151920180546001600160801b0319169290911691909117905560405142815285916001600160a01b0388169133917f9b2808c2ec20946484be77abd405156d10d1cd4562da47ca81030727a1335660910160405180910390a45050506108556001606555565b6001600160a01b03811660009081526099602052604081205481610a4084611155565b905080602001516001600160801b031681600001516001600160801b031683610a699190612cf3565b610a739190612d20565b949350505050565b610a83612142565b336000908152609a602052604090208054610ab05760405162461bcd60e51b815260040161059590612b15565b6001810154426001600160801b039091161115610adf5760405162461bcd60e51b815260040161059590612bec565b8054600082556001820180546001600160801b0319169055609854610b0e906001600160a01b03163383612269565b604051428152819033907fb82679db786bc7cea52df97d5b9dc387dcdbe8f089884740eae34cce025289689060200160405180910390a35050610b516001606555565b565b610b5b612142565b609b546001600160a01b0383811691161480610b845750609c546001600160a01b038381169116145b610ba05760405162461bcd60e51b815260040161059590612ade565b6040516331a9108f60e11b81526004810182905233906001600160a01b03841690636352211e90602401602060405180830381865afa158015610be7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0b9190612d34565b6001600160a01b031614610c315760405162461bcd60e51b815260040161059590612d51565b336000908152609f602090815260408083206001600160a01b03861684529091529020609d54815410610c765760405162461bcd60e51b815260040161059590612d84565b604051632142170760e11b81526001600160a01b038416906342842e0e90610ca690339030908790600401612c5b565b600060405180830381600087803b158015610cc057600080fd5b505af1158015610cd4573d6000803e3d6000fd5b5050825460018101845560008481526020902001849055505060405182906001600160a01b0385169033907f85f412ca9b21ff8d020280b7801d0a5a64907f4c89ef211d2317060fb81076a290610d2e9042815260200190565b60405180910390a4506108556001606555565b610d496122d1565b8051825114610d6a5760405162461bcd60e51b815260040161059590612db9565b6000609d546001610d7b9190612ce0565b9050610d878180612cf3565b835114610da65760405162461bcd60e51b815260040161059590612db9565b60005b8351811015610e7a576040518060400160405280858381518110610dcf57610dcf612b64565b60200260200101516001600160801b03168152602001848381518110610df757610df7612b64565b60200260200101516001600160801b0316815250609e60008484610e1b9190612d20565b815260200190815260200160002060008484610e379190612de9565b8152602080820192909252604001600020825192909101516001600160801b03908116600160801b02921691909117905580610e7281612b90565b915050610da9565b50505050565b60a06020528260005260406000206020528160005260406000208181548110610ea857600080fd5b6000918252602090912060029091020180546001909101549093506001600160801b03169150839050565b610edb6122d1565b610b51600061232b565b610eed612142565b60008111610f0d5760405162461bcd60e51b815260040161059590612dfd565b33600090815260996020526040902054811115610f765760405162461bcd60e51b815260206004820152602160248201527f5374616b696e673a204e6f7420656e6f756768207374616b656420616d6f756e6044820152601d60fa1b6064820152608401610595565b3360009081526099602052604081208054839290610f95908490612c32565b9091555050336000908152609a60205260408120805490918391839190610fbd908490612ce0565b9091555050609754610fcf9042612ce0565b6001820180546001600160801b0319166001600160801b0392909216919091179055604051428152829033907f2d3c1b4f1ae0379749f6d9a4517c14c0a9797e168c129d9d215fa95390e0bd389060200160405180910390a3506110336001606555565b50565b61103e6122d1565b609755565b6001600160a01b038083166000908152609f602090815260408083209385168352928152908290208054835181840281018401909452808452606093928301828280156110af57602002820191906000526020600020905b81548152602001906001019080831161109b575b505050505090505b92915050565b6001600160a01b03808316600090815260a0602090815260408083209385168352928152828220805484518184028101840190955280855260609493919290919084015b828210156111495760008481526020908190206040805180820190915260028502909101805482526001908101546001600160801b0316828401529083529092019101611101565b50505050905092915050565b604080518082018252600080825260208083018290526001600160a01b038581168352609f8252848320609c549091168352815283822080548551818402810184019096528086529394929390918301828280156111d257602002820191906000526020600020905b8154815260200190600101908083116111be575b5050506001600160a01b038087166000908152609f60209081526040808320609b5490941683529281528282208054845181840281018401909552808552969750919592945090925083018282801561124a57602002820191906000526020600020905b815481526020019060010190808311611236575b505085516000908152609e602090815260408083208751845282528083208151808301909252546001600160801b038082168352600160801b9091041691810182905295965090039250610a7391505057505060408051808201909152600180825260208201529392505050565b600054610100900460ff16158080156112d85750600054600160ff909116105b806112f25750303b1580156112f2575060005460ff166001145b6113555760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610595565b6000805460ff191660011790558015611378576000805461ff0019166101001790555b61138061237d565b6113886123ac565b609b80546001600160a01b038087166001600160a01b031992831617909255609c8054868416908316179055609880549285169290911691909117905562278d006097556003609d8190556040805180820182526001808252602080830182815260008080527fedae58bba15aea52a58242ef195db2cc4de2b75de265dbb0d58482df22a95978808452945191516001600160801b03908116600160801b908102938216939093177f7d7a175df483167c80bba5e6d0c836f5771ce84be3e8557e91645693c148fea455865180880188526104e281526103e88186018181528785528887529151915183168502918316919091177f98ce384a1287733b51727408be14b14629222f2332e0048c94d118245c5982795587518089018952610672815280860182815260028086528988529151905184168602908416177ffea39fe51ba6d58abe2c1f6ae5866ea3cdba2cb47f82d8a2d17495908e412e08558851808a018a526108ca81528087018381528b865298875251975183168502978316979097177fd85fa7741a5e38cc155ba9d96efafd110f288f6c4046172f4e8a27916db2e3d9558751808901895261040181528086018281528480527f9f327656ac6adb1f47e9c0fa361c6ac2a34ea4898beba4721854970b7061b16d8088529151905184168602908416177ff92fdce9ef8d9c541808facc8f707bbd99709c79fa2b3b0eb7f85651fdf278f7558851808a018a5261051481528087018381528886528288529051905184168602908416177f0531584b6dbf949f27f4b7c0ebc3839354efabf5b9975dc522ef477c50777522558851808a018a5261069a81528087018381528986528288529051905184168602908416177fd34ec963d0bef948f111465abb7109f5bf655b7ac446c8e84ff12893f6bd73f8558851808a018a5261092e81528087018381528b865291875251905183168502908316177f562f29cd849e1c0543b9a80dfe319dfd25ce61a2b278416cdc3c8fab67e33fa4558751808901895261041a81528086018281528480527fc4886b5ff611eeec2a2cedbef891edcb89b8166c281260bad3c8900b769602098088529151905184168602908416177f4db622fbb5cb663a6a6d315440ec35d50985760a7dcc7df50fcffcff469e7364558851808a018a5261057881528087018381528886528288529051905184168602908416177f273e70835d4d522fc3bd057cbe59353d7fab5883833c4e163b3e5db375db3cb7558851808a018a526106d681528087018381528986528288529051905184168602908416177fe99bdda3241471781156b5269dd8ad0713f451d40b89cacc7d77952c25b08222558851808a018a526109c481528087018381528b865291875251905183168502908316177fd3db4b55eb9d85c83d51f46a183c73f78a8addf02bfc9e5b04458843e6f0ece4558751808901895261044c81528086018281528480527ff0819ec676ed334280900d7051e8a9c5f9668eaf8366830d9ff1e8e86848cf348088529151905184168602908416177fdb9e80a3e4cb140aa8e0944533b8cf8ece7a65ff9806883270deeedc0861fc2d558851808a018a526105dc815280870183815297855281875251965183168502968316969096177faf9705fdcc2e59e4ffab18d1363266c28f12864c13f73e1d54844d2af02201935587518089018952610721815280860182815297845286865251965182168402968216969096177fec8ebdfae5679a32ce877dca0b2f6c5b531cb634f3705e842911da33f754229b558651808801909752610abe87528684019586529690529190529151905183169091029116177f6686a5090d8179e75ec02ea3d8d2f50abb92d9197473ba51491e8bb5c39edb5c558015610e7a576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150505050565b61192f612142565b6000811161194f5760405162461bcd60e51b815260040161059590612dfd565b609854611967906001600160a01b03163330846123db565b3360009081526099602052604081208054839290611986908490612ce0565b9091555050604051428152819033907fe3195b580a0bdc31012b3e254b857d5ceb206202d4c9ed113cd8b982b62e36f59060200160405180910390a36110336001606555565b6119d46122d1565b609d55565b6119e1612142565b609b546001600160a01b0383811691161480611a0a5750609c546001600160a01b038381169116145b611a265760405162461bcd60e51b815260040161059590612ade565b336000908152609f602090815260408083206001600160a01b03861684529091529020609d5482518254611a5a9190612ce0565b1115611a785760405162461bcd60e51b815260040161059590612d84565b60005b8251811015610849576000838281518110611a9857611a98612b64565b60200260200101519050336001600160a01b0316856001600160a01b0316636352211e836040518263ffffffff1660e01b8152600401611ada91815260200190565b602060405180830381865afa158015611af7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b1b9190612d34565b6001600160a01b031614611b415760405162461bcd60e51b815260040161059590612d51565b604051632142170760e11b81526001600160a01b038616906342842e0e90611b7190339030908690600401612c5b565b600060405180830381600087803b158015611b8b57600080fd5b505af1158015611b9f573d6000803e3d6000fd5b5050845460018101865560008681526020902001839055505060405181906001600160a01b0387169033907f85f412ca9b21ff8d020280b7801d0a5a64907f4c89ef211d2317060fb81076a290611bf99042815260200190565b60405180910390a45080611c0c81612b90565b915050611a7b565b611c1c6122d1565b6001600160a01b038116611c815760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610595565b6110338161232b565b611c92612142565b609b546001600160a01b0383811691161480611cbb5750609c546001600160a01b038381169116145b611cd75760405162461bcd60e51b815260040161059590612ade565b336000908152609f602090815260408083206001600160a01b0386168452909152902054611d175760405162461bcd60e51b815260040161059590612c7f565b336000908152609f602090815260408083206001600160a01b03861684529091528120905b8251811015610849576000838281518110611d5957611d59612b64565b602002602001015190506000611d6f84836121a2565b84549091508103611d925760405162461bcd60e51b815260040161059590612caf565b611d9c84826121f4565b33600090815260a0602090815260408083206001600160a01b038a168452825291829020825180840190935284835260975490928392909190820190611de29042612ce0565b6001600160801b039081169091528254600180820185556000948552602094859020845160029093020191825592840151920180546001600160801b0319169290911691909117905560405142815284916001600160a01b038a169133917f9b2808c2ec20946484be77abd405156d10d1cd4562da47ca81030727a1335660910160405180910390a45050508080611e7990612b90565b915050611d3c565b611e89612142565b609b546001600160a01b0383811691161480611eb25750609c546001600160a01b038381169116145b611ece5760405162461bcd60e51b815260040161059590612ade565b33600090815260a0602090815260408083206001600160a01b038616845290915290208054611f0f5760405162461bcd60e51b815260040161059590612b15565b805460005b8254811015611f615783838281548110611f3057611f30612b64565b90600052602060002090600202016000015403611f4f57809150611f61565b80611f5981612b90565b915050611f14565b5081548103611f825760405162461bcd60e51b815260040161059590612ba9565b42828281548110611f9557611f95612b64565b60009182526020909120600160029092020101546001600160801b03161115611fd05760405162461bcd60e51b815260040161059590612bec565b81548290611fe090600190612c32565b81548110611ff057611ff0612b64565b906000526020600020906002020182828154811061201057612010612b64565b600091825260209091208254600290920201908155600191820154910180546001600160801b0319166001600160801b03909216919091179055815482908061205b5761205b612c45565b60008281526020812060026000199093019283020190815560010180546001600160801b03191690559055604051632142170760e11b81526001600160a01b038516906342842e0e906120b690309033908890600401612c5b565b600060405180830381600087803b1580156120d057600080fd5b505af11580156120e4573d6000803e3d6000fd5b5050505082846001600160a01b0316336001600160a01b03167f6e00704bd932b4c7e1820fda45944eb9ed72ddb39f306f30286238c6c347d88a4260405161212e91815260200190565b60405180910390a450506108556001606555565b6002606554036121945760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610595565b6002606555565b6001606555565b6000805b83548110156121eb57828482815481106121c2576121c2612b64565b9060005260206000200154036121d95790506110b7565b806121e381612b90565b9150506121a6565b50509054919050565b8154829061220490600190612c32565b8154811061221457612214612b64565b906000526020600020015482828154811061223157612231612b64565b90600052602060002001819055508180548061224f5761224f612c45565b600190038181906000526020600020016000905590555050565b6040516001600160a01b0383166024820152604481018290526122cc90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526123fc565b505050565b6033546001600160a01b03163314610b515760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610595565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166123a45760405162461bcd60e51b815260040161059590612e43565b610b516124ce565b600054610100900460ff166123d35760405162461bcd60e51b815260040161059590612e43565b610b516124fe565b610e7a846323b872dd60e01b85858560405160240161229593929190612c5b565b6000612451826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166125259092919063ffffffff16565b8051909150156122cc578080602001905181019061246f9190612e8e565b6122cc5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610595565b600054610100900460ff166124f55760405162461bcd60e51b815260040161059590612e43565b610b513361232b565b600054610100900460ff1661219b5760405162461bcd60e51b815260040161059590612e43565b6060610a73848460008585600080866001600160a01b0316858760405161254c9190612ed4565b60006040518083038185875af1925050503d8060008114612589576040519150601f19603f3d011682016040523d82523d6000602084013e61258e565b606091505b509150915061259f878383876125aa565b979650505050505050565b60608315612619578251600003612612576001600160a01b0385163b6126125760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610595565b5081610a73565b610a73838381511561262e5781518083602001fd5b8060405162461bcd60e51b81526004016105959190612ef0565b6001600160a01b038116811461103357600080fd5b60008060006060848603121561267257600080fd5b833561267d81612648565b9250602084013561268d81612648565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156126dd576126dd61269e565b604052919050565b600067ffffffffffffffff8211156126ff576126ff61269e565b5060051b60200190565b6000806040838503121561271c57600080fd5b823561272781612648565b915060208381013567ffffffffffffffff81111561274457600080fd5b8401601f8101861361275557600080fd5b8035612768612763826126e5565b6126b4565b81815260059190911b8201830190838101908883111561278757600080fd5b928401925b828410156127a55783358252928401929084019061278c565b80955050505050509250929050565b600080604083850312156127c757600080fd5b82356127d281612648565b946020939093013593505050565b6000602082840312156127f257600080fd5b81356127fd81612648565b9392505050565b60008060008060006080868803121561281c57600080fd5b853561282781612648565b9450602086013561283781612648565b935060408601359250606086013567ffffffffffffffff8082111561285b57600080fd5b818801915088601f83011261286f57600080fd5b81358181111561287e57600080fd5b89602082850101111561289057600080fd5b9699959850939650602001949392505050565b600082601f8301126128b457600080fd5b813560206128c4612763836126e5565b82815260059290921b840181019181810190868411156128e357600080fd5b8286015b848110156129145780356001600160801b03811681146129075760008081fd5b83529183019183016128e7565b509695505050505050565b6000806040838503121561293257600080fd5b823567ffffffffffffffff8082111561294a57600080fd5b612956868387016128a3565b9350602085013591508082111561296c57600080fd5b50612979858286016128a3565b9150509250929050565b60006020828403121561299557600080fd5b5035919050565b600080604083850312156129af57600080fd5b50508035926020909101359150565b600080604083850312156129d157600080fd5b82356129dc81612648565b915060208301356129ec81612648565b809150509250929050565b6020808252825182820181905260009190848201906040850190845b81811015612a2f57835183529284019291840191600101612a13565b50909695505050505050565b602080825282518282018190526000919060409081850190868401855b82811015612a86578151805185528601516001600160801b0316868501529284019290850190600101612a58565b5091979650505050505050565b600080600060608486031215612aa857600080fd5b8335612ab381612648565b92506020840135612ac381612648565b91506040840135612ad381612648565b809150509250925092565b6020808252601a908201527f5374616b696e673a204e4654206e6f7420737570706f72746564000000000000604082015260600190565b6020808252602f908201527f5374616b696e673a204e6f2070656e64696e67207769746864726177616c206660408201526e6f722074686973206164647265737360881b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201612ba257612ba2612b7a565b5060010190565b60208082526023908201527f5374616b696e673a204e4654206e6f742070656e64696e6720776974686472616040820152621dd85b60ea1b606082015260800190565b60208082526026908201527f5374616b696e673a205769746864726177616c206e6f74206170706c696361626040820152651b19481e595d60d21b606082015260800190565b818103818111156110b7576110b7612b7a565b634e487b7160e01b600052603160045260246000fd5b6001600160a01b039384168152919092166020820152604081019190915260600190565b60208082526016908201527514dd185ada5b99ce88139bc8139195081cdd185ad95960521b604082015260600190565b60208082526017908201527614dd185ada5b99ce88139195081b9bdd081cdd185ad959604a1b604082015260600190565b808201808211156110b7576110b7612b7a565b80820281158282048414176110b7576110b7612b7a565b634e487b7160e01b600052601260045260246000fd5b600082612d2f57612d2f612d0a565b500490565b600060208284031215612d4657600080fd5b81516127fd81612648565b60208082526019908201527814dd185ada5b99ce88139bdd081bdddb995c881bd988139195603a1b604082015260600190565b6020808252818101527f5374616b696e673a204d6178204e4654207374616b696e672072656163686564604082015260600190565b60208082526016908201527514dd185ada5b99ce88125b9d985b1a59081a5b9c1d5d60521b604082015260600190565b600082612df857612df8612d0a565b500690565b60208082526026908201527f5374616b696e673a20416d6f756e74206d75737420626520677265617465722060408201526507468616e20360d41b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b600060208284031215612ea057600080fd5b815180151581146127fd57600080fd5b60005b83811015612ecb578181015183820152602001612eb3565b50506000910152565b60008251612ee6818460208701612eb0565b9190910192915050565b6020815260008251806020840152612f0f816040850160208701612eb0565b601f01601f1916919091016040019291505056fea2646970667358221220ed335032b8d20630dd719a46de71a1181f8f58ff3f82adc06dd6a4733e0c84e264736f6c63430008120033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101a55760003560e01c806380ea3de1116100ef578063cc7ef50911610092578063cc7ef50914610465578063d764b78f14610478578063d80e129214610498578063de8ffad3146104ab578063f2fde38b146104be578063f3005884146104d1578063f3e414f8146104e4578063ffce1133146104f757600080fd5b806380ea3de11461032557806385e5c262146103385780638da5cb5b14610397578063a67ed4ee146103a8578063a7262aac146103d8578063a9c9cddb146103f8578063a9d637e114610418578063c0c53b8b1461045257600080fd5b80633881f1b6116101575780633881f1b61461026d578063451c3d80146102985780634c23648d146102ab578063524b28f9146102be57806356dd2a0f146102d1578063715018a614610301578063750b5e1d146103095780637dfae3341461031257600080fd5b806303abf022146101aa57806304646a49146101d057806307506ec3146101d9578063075b52c6146101ee5780631088ce9014610201578063150b7a02146102145780632ed6d5e814610265575b600080fd5b6101bd6101b836600461265d565b61050a565b6040519081526020015b60405180910390f35b6101bd60975481565b6101ec6101e7366004612709565b610548565b005b6101ec6101fc3660046127b4565b610859565b6101bd61020f3660046127e0565b610a1d565b61024c610222366004612804565b7f150b7a023d4804d13e8c85fb27262cb750cf6ba9f9dd3bb30d90f482ceeb4b1f95945050505050565b6040516001600160e01b031990911681526020016101c7565b6101ec610a7b565b609c54610280906001600160a01b031681565b6040516001600160a01b0390911681526020016101c7565b609854610280906001600160a01b031681565b6101ec6102b93660046127b4565b610b53565b6101ec6102cc36600461291f565b610d41565b6102e46102df36600461265d565b610e80565b604080519283526001600160801b039091166020830152016101c7565b6101ec610ed3565b6101bd609d5481565b6101ec610320366004612983565b610ee5565b6101ec610333366004612983565b611036565b61037761034636600461299c565b609e6020908152600092835260408084209091529082529020546001600160801b0380821691600160801b90041682565b604080516001600160801b039384168152929091166020830152016101c7565b6033546001600160a01b0316610280565b6102e46103b63660046127e0565b609a60205260009081526040902080546001909101546001600160801b031682565b6103eb6103e63660046129be565b611043565b6040516101c791906129f7565b61040b6104063660046129be565b6110bd565b6040516101c79190612a3b565b61042b6104263660046127e0565b611155565b6040805182516001600160801b0390811682526020938401511692810192909252016101c7565b6101ec610460366004612a93565b6112b8565b6101ec610473366004612983565b611927565b6101bd6104863660046127e0565b60996020526000908152604090205481565b6101ec6104a6366004612983565b6119cc565b6101ec6104b9366004612709565b6119d9565b6101ec6104cc3660046127e0565b611c14565b6101ec6104df366004612709565b611c8a565b6101ec6104f23660046127b4565b611e81565b609b54610280906001600160a01b031681565b609f602052826000526040600020602052816000526040600020818154811061053257600080fd5b9060005260206000200160009250925050505481565b610550612142565b609b546001600160a01b03838116911614806105795750609c546001600160a01b038381169116145b61059e5760405162461bcd60e51b815260040161059590612ade565b60405180910390fd5b33600090815260a0602090815260408083206001600160a01b0386168452909152902080546105df5760405162461bcd60e51b815260040161059590612b15565b60005b82518110156108495760008382815181106105ff576105ff612b64565b6020908102919091010151835490915060005b845481101561065f578285828154811061062e5761062e612b64565b9060005260206000209060020201600001540361064d5780915061065f565b8061065781612b90565b915050610612565b50835481036106805760405162461bcd60e51b815260040161059590612ba9565b4284828154811061069357610693612b64565b60009182526020909120600160029092020101546001600160801b031611156106ce5760405162461bcd60e51b815260040161059590612bec565b835484906106de90600190612c32565b815481106106ee576106ee612b64565b906000526020600020906002020184828154811061070e5761070e612b64565b600091825260209091208254600290920201908155600191820154910180546001600160801b0319166001600160801b03909216919091179055835484908061075957610759612c45565b60008281526020812060026000199093019283020190815560010180546001600160801b03191690559055604051632142170760e11b81526001600160a01b038716906342842e0e906107b490309033908790600401612c5b565b600060405180830381600087803b1580156107ce57600080fd5b505af11580156107e2573d6000803e3d6000fd5b5050505081866001600160a01b0316336001600160a01b03167f6e00704bd932b4c7e1820fda45944eb9ed72ddb39f306f30286238c6c347d88a4260405161082c91815260200190565b60405180910390a45050808061084190612b90565b9150506105e2565b50506108556001606555565b5050565b610861612142565b609b546001600160a01b038381169116148061088a5750609c546001600160a01b038381169116145b6108a65760405162461bcd60e51b815260040161059590612ade565b336000908152609f602090815260408083206001600160a01b03861684529091529020546108e65760405162461bcd60e51b815260040161059590612c7f565b336000908152609f602090815260408083206001600160a01b038616845290915281209061091482846121a2565b825490915081036109375760405162461bcd60e51b815260040161059590612caf565b61094182826121f4565b33600090815260a0602090815260408083206001600160a01b03881684528252918290208251808401909352858352609754909283929091908201906109879042612ce0565b6001600160801b039081169091528254600180820185556000948552602094859020845160029093020191825592840151920180546001600160801b0319169290911691909117905560405142815285916001600160a01b0388169133917f9b2808c2ec20946484be77abd405156d10d1cd4562da47ca81030727a1335660910160405180910390a45050506108556001606555565b6001600160a01b03811660009081526099602052604081205481610a4084611155565b905080602001516001600160801b031681600001516001600160801b031683610a699190612cf3565b610a739190612d20565b949350505050565b610a83612142565b336000908152609a602052604090208054610ab05760405162461bcd60e51b815260040161059590612b15565b6001810154426001600160801b039091161115610adf5760405162461bcd60e51b815260040161059590612bec565b8054600082556001820180546001600160801b0319169055609854610b0e906001600160a01b03163383612269565b604051428152819033907fb82679db786bc7cea52df97d5b9dc387dcdbe8f089884740eae34cce025289689060200160405180910390a35050610b516001606555565b565b610b5b612142565b609b546001600160a01b0383811691161480610b845750609c546001600160a01b038381169116145b610ba05760405162461bcd60e51b815260040161059590612ade565b6040516331a9108f60e11b81526004810182905233906001600160a01b03841690636352211e90602401602060405180830381865afa158015610be7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0b9190612d34565b6001600160a01b031614610c315760405162461bcd60e51b815260040161059590612d51565b336000908152609f602090815260408083206001600160a01b03861684529091529020609d54815410610c765760405162461bcd60e51b815260040161059590612d84565b604051632142170760e11b81526001600160a01b038416906342842e0e90610ca690339030908790600401612c5b565b600060405180830381600087803b158015610cc057600080fd5b505af1158015610cd4573d6000803e3d6000fd5b5050825460018101845560008481526020902001849055505060405182906001600160a01b0385169033907f85f412ca9b21ff8d020280b7801d0a5a64907f4c89ef211d2317060fb81076a290610d2e9042815260200190565b60405180910390a4506108556001606555565b610d496122d1565b8051825114610d6a5760405162461bcd60e51b815260040161059590612db9565b6000609d546001610d7b9190612ce0565b9050610d878180612cf3565b835114610da65760405162461bcd60e51b815260040161059590612db9565b60005b8351811015610e7a576040518060400160405280858381518110610dcf57610dcf612b64565b60200260200101516001600160801b03168152602001848381518110610df757610df7612b64565b60200260200101516001600160801b0316815250609e60008484610e1b9190612d20565b815260200190815260200160002060008484610e379190612de9565b8152602080820192909252604001600020825192909101516001600160801b03908116600160801b02921691909117905580610e7281612b90565b915050610da9565b50505050565b60a06020528260005260406000206020528160005260406000208181548110610ea857600080fd5b6000918252602090912060029091020180546001909101549093506001600160801b03169150839050565b610edb6122d1565b610b51600061232b565b610eed612142565b60008111610f0d5760405162461bcd60e51b815260040161059590612dfd565b33600090815260996020526040902054811115610f765760405162461bcd60e51b815260206004820152602160248201527f5374616b696e673a204e6f7420656e6f756768207374616b656420616d6f756e6044820152601d60fa1b6064820152608401610595565b3360009081526099602052604081208054839290610f95908490612c32565b9091555050336000908152609a60205260408120805490918391839190610fbd908490612ce0565b9091555050609754610fcf9042612ce0565b6001820180546001600160801b0319166001600160801b0392909216919091179055604051428152829033907f2d3c1b4f1ae0379749f6d9a4517c14c0a9797e168c129d9d215fa95390e0bd389060200160405180910390a3506110336001606555565b50565b61103e6122d1565b609755565b6001600160a01b038083166000908152609f602090815260408083209385168352928152908290208054835181840281018401909452808452606093928301828280156110af57602002820191906000526020600020905b81548152602001906001019080831161109b575b505050505090505b92915050565b6001600160a01b03808316600090815260a0602090815260408083209385168352928152828220805484518184028101840190955280855260609493919290919084015b828210156111495760008481526020908190206040805180820190915260028502909101805482526001908101546001600160801b0316828401529083529092019101611101565b50505050905092915050565b604080518082018252600080825260208083018290526001600160a01b038581168352609f8252848320609c549091168352815283822080548551818402810184019096528086529394929390918301828280156111d257602002820191906000526020600020905b8154815260200190600101908083116111be575b5050506001600160a01b038087166000908152609f60209081526040808320609b5490941683529281528282208054845181840281018401909552808552969750919592945090925083018282801561124a57602002820191906000526020600020905b815481526020019060010190808311611236575b505085516000908152609e602090815260408083208751845282528083208151808301909252546001600160801b038082168352600160801b9091041691810182905295965090039250610a7391505057505060408051808201909152600180825260208201529392505050565b600054610100900460ff16158080156112d85750600054600160ff909116105b806112f25750303b1580156112f2575060005460ff166001145b6113555760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610595565b6000805460ff191660011790558015611378576000805461ff0019166101001790555b61138061237d565b6113886123ac565b609b80546001600160a01b038087166001600160a01b031992831617909255609c8054868416908316179055609880549285169290911691909117905562278d006097556003609d8190556040805180820182526001808252602080830182815260008080527fedae58bba15aea52a58242ef195db2cc4de2b75de265dbb0d58482df22a95978808452945191516001600160801b03908116600160801b908102938216939093177f7d7a175df483167c80bba5e6d0c836f5771ce84be3e8557e91645693c148fea455865180880188526104e281526103e88186018181528785528887529151915183168502918316919091177f98ce384a1287733b51727408be14b14629222f2332e0048c94d118245c5982795587518089018952610672815280860182815260028086528988529151905184168602908416177ffea39fe51ba6d58abe2c1f6ae5866ea3cdba2cb47f82d8a2d17495908e412e08558851808a018a526108ca81528087018381528b865298875251975183168502978316979097177fd85fa7741a5e38cc155ba9d96efafd110f288f6c4046172f4e8a27916db2e3d9558751808901895261040181528086018281528480527f9f327656ac6adb1f47e9c0fa361c6ac2a34ea4898beba4721854970b7061b16d8088529151905184168602908416177ff92fdce9ef8d9c541808facc8f707bbd99709c79fa2b3b0eb7f85651fdf278f7558851808a018a5261051481528087018381528886528288529051905184168602908416177f0531584b6dbf949f27f4b7c0ebc3839354efabf5b9975dc522ef477c50777522558851808a018a5261069a81528087018381528986528288529051905184168602908416177fd34ec963d0bef948f111465abb7109f5bf655b7ac446c8e84ff12893f6bd73f8558851808a018a5261092e81528087018381528b865291875251905183168502908316177f562f29cd849e1c0543b9a80dfe319dfd25ce61a2b278416cdc3c8fab67e33fa4558751808901895261041a81528086018281528480527fc4886b5ff611eeec2a2cedbef891edcb89b8166c281260bad3c8900b769602098088529151905184168602908416177f4db622fbb5cb663a6a6d315440ec35d50985760a7dcc7df50fcffcff469e7364558851808a018a5261057881528087018381528886528288529051905184168602908416177f273e70835d4d522fc3bd057cbe59353d7fab5883833c4e163b3e5db375db3cb7558851808a018a526106d681528087018381528986528288529051905184168602908416177fe99bdda3241471781156b5269dd8ad0713f451d40b89cacc7d77952c25b08222558851808a018a526109c481528087018381528b865291875251905183168502908316177fd3db4b55eb9d85c83d51f46a183c73f78a8addf02bfc9e5b04458843e6f0ece4558751808901895261044c81528086018281528480527ff0819ec676ed334280900d7051e8a9c5f9668eaf8366830d9ff1e8e86848cf348088529151905184168602908416177fdb9e80a3e4cb140aa8e0944533b8cf8ece7a65ff9806883270deeedc0861fc2d558851808a018a526105dc815280870183815297855281875251965183168502968316969096177faf9705fdcc2e59e4ffab18d1363266c28f12864c13f73e1d54844d2af02201935587518089018952610721815280860182815297845286865251965182168402968216969096177fec8ebdfae5679a32ce877dca0b2f6c5b531cb634f3705e842911da33f754229b558651808801909752610abe87528684019586529690529190529151905183169091029116177f6686a5090d8179e75ec02ea3d8d2f50abb92d9197473ba51491e8bb5c39edb5c558015610e7a576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150505050565b61192f612142565b6000811161194f5760405162461bcd60e51b815260040161059590612dfd565b609854611967906001600160a01b03163330846123db565b3360009081526099602052604081208054839290611986908490612ce0565b9091555050604051428152819033907fe3195b580a0bdc31012b3e254b857d5ceb206202d4c9ed113cd8b982b62e36f59060200160405180910390a36110336001606555565b6119d46122d1565b609d55565b6119e1612142565b609b546001600160a01b0383811691161480611a0a5750609c546001600160a01b038381169116145b611a265760405162461bcd60e51b815260040161059590612ade565b336000908152609f602090815260408083206001600160a01b03861684529091529020609d5482518254611a5a9190612ce0565b1115611a785760405162461bcd60e51b815260040161059590612d84565b60005b8251811015610849576000838281518110611a9857611a98612b64565b60200260200101519050336001600160a01b0316856001600160a01b0316636352211e836040518263ffffffff1660e01b8152600401611ada91815260200190565b602060405180830381865afa158015611af7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b1b9190612d34565b6001600160a01b031614611b415760405162461bcd60e51b815260040161059590612d51565b604051632142170760e11b81526001600160a01b038616906342842e0e90611b7190339030908690600401612c5b565b600060405180830381600087803b158015611b8b57600080fd5b505af1158015611b9f573d6000803e3d6000fd5b5050845460018101865560008681526020902001839055505060405181906001600160a01b0387169033907f85f412ca9b21ff8d020280b7801d0a5a64907f4c89ef211d2317060fb81076a290611bf99042815260200190565b60405180910390a45080611c0c81612b90565b915050611a7b565b611c1c6122d1565b6001600160a01b038116611c815760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610595565b6110338161232b565b611c92612142565b609b546001600160a01b0383811691161480611cbb5750609c546001600160a01b038381169116145b611cd75760405162461bcd60e51b815260040161059590612ade565b336000908152609f602090815260408083206001600160a01b0386168452909152902054611d175760405162461bcd60e51b815260040161059590612c7f565b336000908152609f602090815260408083206001600160a01b03861684529091528120905b8251811015610849576000838281518110611d5957611d59612b64565b602002602001015190506000611d6f84836121a2565b84549091508103611d925760405162461bcd60e51b815260040161059590612caf565b611d9c84826121f4565b33600090815260a0602090815260408083206001600160a01b038a168452825291829020825180840190935284835260975490928392909190820190611de29042612ce0565b6001600160801b039081169091528254600180820185556000948552602094859020845160029093020191825592840151920180546001600160801b0319169290911691909117905560405142815284916001600160a01b038a169133917f9b2808c2ec20946484be77abd405156d10d1cd4562da47ca81030727a1335660910160405180910390a45050508080611e7990612b90565b915050611d3c565b611e89612142565b609b546001600160a01b0383811691161480611eb25750609c546001600160a01b038381169116145b611ece5760405162461bcd60e51b815260040161059590612ade565b33600090815260a0602090815260408083206001600160a01b038616845290915290208054611f0f5760405162461bcd60e51b815260040161059590612b15565b805460005b8254811015611f615783838281548110611f3057611f30612b64565b90600052602060002090600202016000015403611f4f57809150611f61565b80611f5981612b90565b915050611f14565b5081548103611f825760405162461bcd60e51b815260040161059590612ba9565b42828281548110611f9557611f95612b64565b60009182526020909120600160029092020101546001600160801b03161115611fd05760405162461bcd60e51b815260040161059590612bec565b81548290611fe090600190612c32565b81548110611ff057611ff0612b64565b906000526020600020906002020182828154811061201057612010612b64565b600091825260209091208254600290920201908155600191820154910180546001600160801b0319166001600160801b03909216919091179055815482908061205b5761205b612c45565b60008281526020812060026000199093019283020190815560010180546001600160801b03191690559055604051632142170760e11b81526001600160a01b038516906342842e0e906120b690309033908890600401612c5b565b600060405180830381600087803b1580156120d057600080fd5b505af11580156120e4573d6000803e3d6000fd5b5050505082846001600160a01b0316336001600160a01b03167f6e00704bd932b4c7e1820fda45944eb9ed72ddb39f306f30286238c6c347d88a4260405161212e91815260200190565b60405180910390a450506108556001606555565b6002606554036121945760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610595565b6002606555565b6001606555565b6000805b83548110156121eb57828482815481106121c2576121c2612b64565b9060005260206000200154036121d95790506110b7565b806121e381612b90565b9150506121a6565b50509054919050565b8154829061220490600190612c32565b8154811061221457612214612b64565b906000526020600020015482828154811061223157612231612b64565b90600052602060002001819055508180548061224f5761224f612c45565b600190038181906000526020600020016000905590555050565b6040516001600160a01b0383166024820152604481018290526122cc90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526123fc565b505050565b6033546001600160a01b03163314610b515760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610595565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166123a45760405162461bcd60e51b815260040161059590612e43565b610b516124ce565b600054610100900460ff166123d35760405162461bcd60e51b815260040161059590612e43565b610b516124fe565b610e7a846323b872dd60e01b85858560405160240161229593929190612c5b565b6000612451826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166125259092919063ffffffff16565b8051909150156122cc578080602001905181019061246f9190612e8e565b6122cc5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610595565b600054610100900460ff166124f55760405162461bcd60e51b815260040161059590612e43565b610b513361232b565b600054610100900460ff1661219b5760405162461bcd60e51b815260040161059590612e43565b6060610a73848460008585600080866001600160a01b0316858760405161254c9190612ed4565b60006040518083038185875af1925050503d8060008114612589576040519150601f19603f3d011682016040523d82523d6000602084013e61258e565b606091505b509150915061259f878383876125aa565b979650505050505050565b60608315612619578251600003612612576001600160a01b0385163b6126125760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610595565b5081610a73565b610a73838381511561262e5781518083602001fd5b8060405162461bcd60e51b81526004016105959190612ef0565b6001600160a01b038116811461103357600080fd5b60008060006060848603121561267257600080fd5b833561267d81612648565b9250602084013561268d81612648565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156126dd576126dd61269e565b604052919050565b600067ffffffffffffffff8211156126ff576126ff61269e565b5060051b60200190565b6000806040838503121561271c57600080fd5b823561272781612648565b915060208381013567ffffffffffffffff81111561274457600080fd5b8401601f8101861361275557600080fd5b8035612768612763826126e5565b6126b4565b81815260059190911b8201830190838101908883111561278757600080fd5b928401925b828410156127a55783358252928401929084019061278c565b80955050505050509250929050565b600080604083850312156127c757600080fd5b82356127d281612648565b946020939093013593505050565b6000602082840312156127f257600080fd5b81356127fd81612648565b9392505050565b60008060008060006080868803121561281c57600080fd5b853561282781612648565b9450602086013561283781612648565b935060408601359250606086013567ffffffffffffffff8082111561285b57600080fd5b818801915088601f83011261286f57600080fd5b81358181111561287e57600080fd5b89602082850101111561289057600080fd5b9699959850939650602001949392505050565b600082601f8301126128b457600080fd5b813560206128c4612763836126e5565b82815260059290921b840181019181810190868411156128e357600080fd5b8286015b848110156129145780356001600160801b03811681146129075760008081fd5b83529183019183016128e7565b509695505050505050565b6000806040838503121561293257600080fd5b823567ffffffffffffffff8082111561294a57600080fd5b612956868387016128a3565b9350602085013591508082111561296c57600080fd5b50612979858286016128a3565b9150509250929050565b60006020828403121561299557600080fd5b5035919050565b600080604083850312156129af57600080fd5b50508035926020909101359150565b600080604083850312156129d157600080fd5b82356129dc81612648565b915060208301356129ec81612648565b809150509250929050565b6020808252825182820181905260009190848201906040850190845b81811015612a2f57835183529284019291840191600101612a13565b50909695505050505050565b602080825282518282018190526000919060409081850190868401855b82811015612a86578151805185528601516001600160801b0316868501529284019290850190600101612a58565b5091979650505050505050565b600080600060608486031215612aa857600080fd5b8335612ab381612648565b92506020840135612ac381612648565b91506040840135612ad381612648565b809150509250925092565b6020808252601a908201527f5374616b696e673a204e4654206e6f7420737570706f72746564000000000000604082015260600190565b6020808252602f908201527f5374616b696e673a204e6f2070656e64696e67207769746864726177616c206660408201526e6f722074686973206164647265737360881b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201612ba257612ba2612b7a565b5060010190565b60208082526023908201527f5374616b696e673a204e4654206e6f742070656e64696e6720776974686472616040820152621dd85b60ea1b606082015260800190565b60208082526026908201527f5374616b696e673a205769746864726177616c206e6f74206170706c696361626040820152651b19481e595d60d21b606082015260800190565b818103818111156110b7576110b7612b7a565b634e487b7160e01b600052603160045260246000fd5b6001600160a01b039384168152919092166020820152604081019190915260600190565b60208082526016908201527514dd185ada5b99ce88139bc8139195081cdd185ad95960521b604082015260600190565b60208082526017908201527614dd185ada5b99ce88139195081b9bdd081cdd185ad959604a1b604082015260600190565b808201808211156110b7576110b7612b7a565b80820281158282048414176110b7576110b7612b7a565b634e487b7160e01b600052601260045260246000fd5b600082612d2f57612d2f612d0a565b500490565b600060208284031215612d4657600080fd5b81516127fd81612648565b60208082526019908201527814dd185ada5b99ce88139bdd081bdddb995c881bd988139195603a1b604082015260600190565b6020808252818101527f5374616b696e673a204d6178204e4654207374616b696e672072656163686564604082015260600190565b60208082526016908201527514dd185ada5b99ce88125b9d985b1a59081a5b9c1d5d60521b604082015260600190565b600082612df857612df8612d0a565b500690565b60208082526026908201527f5374616b696e673a20416d6f756e74206d75737420626520677265617465722060408201526507468616e20360d41b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b600060208284031215612ea057600080fd5b815180151581146127fd57600080fd5b60005b83811015612ecb578181015183820152602001612eb3565b50506000910152565b60008251612ee6818460208701612eb0565b9190910192915050565b6020815260008251806020840152612f0f816040850160208701612eb0565b601f01601f1916919091016040019291505056fea2646970667358221220ed335032b8d20630dd719a46de71a1181f8f58ff3f82adc06dd6a4733e0c84e264736f6c63430008120033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.