Contract 0x9b7a4846Cb99319bb998d4C2e53e5DcEA054e13C

Txn Hash Method
Block
From
To
Value [Txn Fee]
0x260509cd24745ab150f21107017249bccffe42c76372da8e03d002d51f0abab80x60a0604058217502022-12-01 22:32:0667 days 22 hrs ago0x6be5e7da4ad8523f9c622544a938f344a1f62cf5 IN  Create: Marketplace0 CRO25.479950
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.

Contract Source Code Verified (Exact Match)

Contract Name:
Marketplace

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 36 : Marketplace.sol
// SPDX-License-Identifier: UNLICENSED
//Copyright Ebisusbay.com 2021
pragma solidity ^0.8.4;

import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PullPaymentUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol";

import "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/interfaces/IERC2981.sol";

import "./SafePct.sol";
import "./IterableMapping.sol";
import "./IMembershipStaker.sol";
import "./conduit/Conduit.sol";
import "./IBundle.sol";

abstract contract OwnableContract {
    function owner() public view virtual returns (address){}
}

contract Marketplace is 
    Initializable, 
    AccessControlUpgradeable, 
    UUPSUpgradeable, 
    PullPaymentUpgradeable,
    ReentrancyGuardUpgradeable, Conduit {

    using SafeMathLite for uint256;
    using SafePct for uint256;
    using CountersUpgradeable for CountersUpgradeable.Counter;
    using AddressUpgradeable for address payable;
    using ERC165Checker for address;
 
    using IterableMapping for IterableMapping.Map;
    using IterableMapping for IterableMapping.Listing;

    bytes32 public constant UPGRADER_ROLE = keccak256("UPGRADER_ROLE");
    bytes32 public constant STAFF_ROLE = keccak256("STAFF_ROLE");
    bytes32 public constant SERVER_ROLE = keccak256("SERVER_ROLE");
    uint16 constant private SCALE = 10000;
    bytes4 public constant IID_IERC1155 = type(IERC1155).interfaceId;
    bytes4 public constant IID_IERC721 = type(IERC721).interfaceId;
    
    struct Royalty {
        address ipHolder;
        uint16 percent;
    }

    event Listed(uint256 indexed listingId);
    event Sold(uint256 indexed listingId);
    event Cancelled(uint256 indexed listingId);
    event FeesUpdate(address indexed updater, uint256 reg, uint256 fm, uint256 admin);
    event AdminWithdraw(address indexed admin, uint256 amount);
    event RoyaltyChanged(address indexed staffMember, address indexed collection, address ipHolder, uint16 fee);
    event RoyaltyRemoved(address indexed staffMember, address indexed collection);
    event StakerUpdated(address indexed admin, address newStaker);

    IERC1155 private memberships;

    uint16 public vipFee;
    uint16 public memberFee;
    uint16 public regFee;

    IterableMapping.Map private activeListings;
    IterableMapping.Map private completeListings;
    IterableMapping.Map private cancelledListings;

    CountersUpgradeable.Counter private listingId;

    mapping(address => Royalty) public royalties;
    IMembershipStaker public membershipStaker;

    bytes4 public constant IID_IERC2981 = type(IERC2981).interfaceId;
    bytes4 public constant IID_BUNDLE = type(IBundle).interfaceId;

    IERC721 ryoshi;
    
    // constructor() initializer {}

    function initialize(IERC1155 _memberships) initializer public {
        __AccessControl_init();
        __UUPSUpgradeable_init();
        __PullPayment_init();
        __ReentrancyGuard_init();

        _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
        _grantRole(UPGRADER_ROLE, msg.sender);
        memberships = _memberships;
        vipFee = 150;
        memberFee = 300;
        regFee = 500;       
    }

    function _authorizeUpgrade(address newImplementation)
        internal
        onlyRole(UPGRADER_ROLE)
        override
    {}

    function totalActive() external view returns (uint256) {
        return activeListings.size();
    }

    function activeListing(uint256 _listingId) external view returns (IterableMapping.Listing memory){
        return activeListings.getById(_listingId);
    } 

    function completeListing(uint256 _listingId) external view returns (IterableMapping.Listing memory){
        return completeListings.getById(_listingId);
    }

    function cancelledListing(uint256 _listingId) external view returns (IterableMapping.Listing memory){
        return cancelledListings.getById(_listingId);
    }

    function pagedActive(uint256 _page, uint16 _pageSize) external view returns ( IterableMapping.Listing[] memory){
        return activeListings.paged(_page, _pageSize);
    }

    function totalComplete() external view returns (uint256){
        return completeListings.size();
    }

    function pagedComplete(uint256 _page, uint16 _pageSize) external view returns ( IterableMapping.Listing[] memory){
        return completeListings.paged(_page, _pageSize);
    }

    function totalCancelled() external view returns (uint256){
        return cancelledListings.size();
    }

    function pagedCancelled(uint256 _page, uint16 _pageSize) external view returns ( IterableMapping.Listing[] memory){
        return cancelledListings.paged(_page, _pageSize);
    }

    function withdrawPayments(address payable payee) public virtual override nonReentrant{
        super.withdrawPayments(payee);
    }

    function makeListing(address _nft, uint256 _id, uint256 _price) public  {
        require(_price > 0, "invalid price");
        bool is1155 = _nft.supportsInterface(IID_IERC1155);
        bool is721 =_nft.supportsInterface(IID_IERC721);
        require(is1155 || is721, "unsupported type");
        if(is721){
            require(IERC721(_nft).ownerOf(_id) == msg.sender, "not owned");
            require(IERC721(_nft).isApprovedForAll(msg.sender, address(this)), "must approve transfer");
        } else {
            require(IERC1155(_nft).balanceOf(msg.sender, _id) > 0, "not owned");
            require(IERC1155(_nft).isApprovedForAll(msg.sender, address(this)), "must approve transfer");
        }

        bytes32 listingHash = keccak256(abi.encode(_nft, msg.sender, _id));

        uint256 royaltyAmount = calculateRoyalty(_nft, _id, _price);

        if(activeListings.contains(listingHash)){
            IterableMapping.Listing storage listing = activeListings.get(listingHash);
            listing.price = _price;
            listing.fee = _price.mulDiv(fee(msg.sender), SCALE);
            listing.royalty = royaltyAmount;
            emit Listed(listing.listingId);
            return;
        }

        IterableMapping.Listing memory newListing;
        newListing.listingId = listingId.current();
        newListing.nftId = _id;
        newListing.seller = msg.sender;
        newListing.nft = address(_nft);
        newListing.price = _price;
        newListing.fee = _price.mulDiv(fee(msg.sender), SCALE);
        newListing.is1155 = is1155;
        newListing.listingTime = block.timestamp;
        newListing.royalty = royaltyAmount;
        activeListings.set(listingHash, newListing);

        listingId.increment();
        emit Listed(newListing.listingId);
    }

    function makeListings(address[] calldata _nfts, uint256[] calldata _ids, uint256[] calldata _prices) external {
        require(_nfts.length == _ids.length && _nfts.length == _prices.length, "missing data");
        for(uint i = 0; i < _nfts.length; i++){
            makeListing(_nfts[i], _ids[i], _prices[i]);
        }
    }

    function _makePurchase(uint256 _id) private {
        require(activeListings.containsId(_id), "invalid id");
        IterableMapping.Listing memory listing = activeListings.getById(_id);
        
        activeListings.remove(activeListings.keyForId(_id));
        listing.purchaser = msg.sender;
        listing.saleTime = block.timestamp;
        completeListings.set(keccak256(abi.encodePacked(_id)), listing);
        
        require(msg.value >= listing.price, "not enough funds");
        if(listing.is1155){
            _transferToken(ConduitItemType.ERC1155, listing.nft, listing.seller, msg.sender, listing.nftId, 1);
        }else {
            _transferToken(ConduitItemType.ERC721, listing.nft, listing.seller, msg.sender, listing.nftId, 1);
        }
        
        if (address(membershipStaker) != address(0)) {
            uint256 stakingFee = listing.fee.mulDiv(1, 2);
            (bool sent, ) = address(membershipStaker).call{value: stakingFee}("");
            require(sent, "transfer fee failed");
        }
      
        if (listing.royalty > 0)  {
            _payRoyalty(listing.nft, listing.nftId, listing.price);
        }
        _asyncTransfer(listing.seller, listing.price - listing.fee - listing.royalty);
       
        emit Sold(_id);
    }

    function makePurchase(uint256 _id) public payable nonReentrant {
        _makePurchase(_id);
    }

    function makePurchases(uint256[] calldata ids) external payable nonReentrant {
        for(uint i = 0; i < ids.length; i++){
            _makePurchase(ids[i]);
        }
    }

    function addToEscrow(address _address) external payable {
        _asyncTransfer(_address, msg.value);
    }

    function cancelListing(uint256 _id) public {
        require(activeListings.containsId(_id), "invalid id");
        IterableMapping.Listing memory listing = activeListings.getById(_id);
        require(listing.seller == msg.sender || hasRole(STAFF_ROLE, msg.sender) || hasRole(SERVER_ROLE, msg.sender), "not lister");
        listing.saleTime = block.timestamp;
        activeListings.remove(activeListings.keyForId(_id));
        cancelledListings.set(keccak256(abi.encodePacked(_id)), listing);
        emit Cancelled(_id);
    }

    function cancelActive(address _nft, uint256 _id, address _seller) external {
        bytes32 listingHash = keccak256(abi.encode(_nft, _seller, _id));
        if(activeListings.contains(listingHash)){
            IterableMapping.Listing storage listing = activeListings.get(listingHash);
            cancelListing(listing.listingId);
        }
    }

    function cancelListings(uint[] calldata _ids) external {
        for(uint i = 0; i < _ids.length; i++){
            cancelListing(_ids[i]);
        }
    }

    /**\
        uint64 public constant FOUNDER = 1;
        uint64 public constant VIP = 2;
        uint64 public constant VVIP = 3;
     */
    function fee(address user) public view returns (uint16 userFee){
        if(memberships.balanceOf(user, 3) > 0){
            userFee = 0;
        } else if(isVIP(user)) {
            userFee = vipFee;
        } else if(isFM(user)){
            userFee = memberFee;
        }else {
            userFee = regFee;
        }
    }

    function isMember(address user) public view returns (bool){
        return isFM(user) || isVIP(user);
    }

    function isFM(address user) public view returns (bool) {
        return memberships.balanceOf(user, 1) > 0;
    }

    function isVIP(address user) public view returns (bool) {
        if(memberships.balanceOf(user, 2) > 0 || ryoshi.balanceOf(user) > 0){
            return true;
        } else if((address(membershipStaker) != address(0) && membershipStaker.amountStaked(user) > 0)){
            return true;
        }
        return false;
    }

    //=====STAFF============

    function registerRoyalty(address _nftContract, address _ipHolder, uint16 _fee) external onlyRole(STAFF_ROLE){
        royalties[_nftContract] = Royalty(_ipHolder, _fee);
        emit RoyaltyChanged(msg.sender, _nftContract, _ipHolder, _fee);
    }

    function removeRoyalty(address _nftContract) external onlyRole(STAFF_ROLE){
        delete royalties[_nftContract];
        emit RoyaltyRemoved(msg.sender, _nftContract);
    }

    function registerRoyaltyAsOwner(address _nftContract, address _paymentAddress, uint16 _fee) external {
        require(!isRoyaltyStandard(_nftContract), "not legacy");
        require(OwnableContract(_nftContract).owner() == msg.sender, "not owner");
        royalties[_nftContract] = Royalty(_paymentAddress, _fee);
        emit RoyaltyChanged(msg.sender, _nftContract, _paymentAddress, _fee);
    }

    //=====ADMIN============ 

    function withdraw() external onlyRole(DEFAULT_ADMIN_ROLE){
        emit AdminWithdraw(msg.sender, address(this).balance);
        payable(msg.sender).sendValue(address(this).balance);
    }

    function updateFees(uint16 _regFee, uint16 _memFee, uint16 _vipFee) external onlyRole(DEFAULT_ADMIN_ROLE){
        regFee = _regFee;
        memberFee = _memFee;
        vipFee = _vipFee;
        emit FeesUpdate(msg.sender, _regFee, _memFee, _vipFee);
    }

    function setMembershipStaker(address _membershipStaker) external onlyRole(DEFAULT_ADMIN_ROLE) {
        membershipStaker = IMembershipStaker(_membershipStaker);
        emit StakerUpdated(msg.sender, _membershipStaker);
    }

    function setRyoshi(address _ryoshi) external onlyRole(DEFAULT_ADMIN_ROLE){
        ryoshi = IERC721(_ryoshi);
    }

    receive() external payable {}

    function bulkTransfer(address[] calldata _tokens, uint256[] calldata _ids, address _to) external{
        require(_tokens.length == _ids.length, "arrays not equal");
        ConduitTransfer[] memory transferInformations = new ConduitTransfer[](_tokens.length);
        for(uint i = 0; i < _tokens.length; i++){
            bool is721 = _tokens[i].supportsInterface(IID_IERC721);
            if(is721){
                transferInformations[i].itemType = ConduitItemType.ERC721;
            } else {
                require(_tokens[i].supportsInterface(IID_IERC1155), "invalid token type");
                transferInformations[i].itemType = ConduitItemType.ERC1155;
            }
            transferInformations[i].token = _tokens[i];
            transferInformations[i].from = msg.sender;
            transferInformations[i].to = _to;
            transferInformations[i].identifier = _ids[i];
            transferInformations[i].amount = 1;
        }
        execute(transferInformations);
    }

    function transferToken(ConduitItemType _type, address _tokenAddress, address _from, address _to, uint256 _identifier, uint256 _amount) public {
        require(hasRole(SERVER_ROLE, msg.sender), "not authorized");
        _transferToken(_type, _tokenAddress, _from, _to, _identifier, _amount);
    }

    function _transferToken(ConduitItemType _type, address _tokenAddress, address _from, address _to, uint256 _identifier, uint256 _amount) private {
        ConduitTransfer memory transferInformation;
        ConduitTransfer[] memory transferInformations = new ConduitTransfer[](1);
        
        transferInformation.itemType = _type;
        transferInformation.token = _tokenAddress;
        transferInformation.from = _from;
        transferInformation.to = _to;
        transferInformation.identifier = _identifier;
        transferInformation.amount = _amount;

        transferInformations[0] = transferInformation;
        execute(transferInformations);
    }
    // ========Royalty============
 
    function getRoyalty(address _contract) external view returns (Royalty memory){
        return royalties[_contract];
    }

    function isRoyaltyStandard(address _contract) public view returns (bool) {
        return _contract.supportsInterface(IID_IERC2981);
    }

    function isBundleContract(address _contract) public view returns (bool) {
        return _contract.supportsInterface(IID_BUNDLE);
    }

    // get Royalty including Bundle
    function calculateRoyalty(address _contract, uint256 _id, uint256 _price) public view returns (uint256) {
        uint256 royaltyAmount;

        if (isBundleContract(_contract)) {
            (address[] memory contracts, uint256[] memory ids) = IBundle(_contract).contents(_id);
            uint len = contracts.length;
            uint256 eachAmount = _price.div(len);
            
            for (uint256 i = 0; i < len;) {
                (, uint256 amount) = getStandardNFTRoyalty(contracts[i], ids[i], eachAmount);
                royaltyAmount += amount;
                unchecked {
                    i++;
                }
            }
        } else {
            (, royaltyAmount) = getStandardNFTRoyalty(_contract, _id, _price);
        }

        return royaltyAmount;
    }

    // get royalty for ERC721 or ERC1155
    function getStandardNFTRoyalty(address _contract, uint256 _id, uint256 _price) public view returns (address ipHolder, uint256 royaltyAmount) {
        require(_contract.supportsInterface(IID_IERC1155) || _contract.supportsInterface(IID_IERC721), "not ERC721 or ERC1155");
        require(!isBundleContract(_contract), "not support bundle");
        
        if (isRoyaltyStandard(_contract)) {
            (ipHolder, royaltyAmount) = IERC2981(_contract).royaltyInfo(_id, _price);
        } else {
            if(royalties[_contract].percent > 0){
                royaltyAmount = _price.mulDiv(royalties[_contract].percent, SCALE);
                ipHolder = royalties[_contract].ipHolder;
            }
        }
    }

    function payRoyalty(address _contract, uint256 _id, uint256 _price) public payable {
        if(msg.value <= 0) return;
        
        uint256 amount =  calculateRoyalty(_contract, _id, _price);
        require(amount == msg.value, "invalid amount");

        _payRoyalty(_contract, _id, _price);
    }

    function _payRoyalty(address _contract, uint256 _id, uint256 _amount) private {
        if (isBundleContract(_contract)) {
            (address[] memory contracts, uint256[] memory ids) = IBundle(_contract).contents(_id);
            uint256 len = contracts.length;
            uint256 eachAmount = _amount.div(len);

            for (uint256 i = 0; i < len;) {
                (address ipHolder, uint256 amount) = getStandardNFTRoyalty(contracts[i], ids[i], eachAmount);
                if(ipHolder == address(0)){
                    continue;
                }
                _asyncTransfer(ipHolder, amount);
                unchecked {
                    i ++;
                }
            }
        } else {
            (address ipHolder, uint256 amount) = getStandardNFTRoyalty(_contract, _id, _amount);
            if(ipHolder == address(0)) return;
             _asyncTransfer(ipHolder, amount);
        }
    }
}

File 2 of 36 : ERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

import "./IERC20Upgradeable.sol";
import "./extensions/IERC20MetadataUpgradeable.sol";
import "../../utils/ContextUpgradeable.sol";
import "../../proxy/utils/Initializable.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    function __ERC20_init(string memory name_, string memory symbol_) internal initializer {
        __Context_init_unchained();
        __ERC20_init_unchained(name_, symbol_);
    }

    function __ERC20_init_unchained(string memory name_, string memory symbol_) internal initializer {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless this function is
     * overridden;
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `recipient` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(_msgSender(), recipient, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * Requirements:
     *
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for ``sender``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);

        uint256 currentAllowance = _allowances[sender][_msgSender()];
        require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
        unchecked {
            _approve(sender, _msgSender(), currentAllowance - amount);
        }

        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        uint256 currentAllowance = _allowances[_msgSender()][spender];
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(_msgSender(), spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `sender` to `recipient`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `sender` cannot be the zero address.
     * - `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     */
    function _transfer(
        address sender,
        address recipient,
        uint256 amount
    ) internal virtual {
        require(sender != address(0), "ERC20: transfer from the zero address");
        require(recipient != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(sender, recipient, amount);

        uint256 senderBalance = _balances[sender];
        require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[sender] = senderBalance - amount;
        }
        _balances[recipient] += amount;

        emit Transfer(sender, recipient, amount);

        _afterTokenTransfer(sender, recipient, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
        }
        _totalSupply -= amount;

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}
    uint256[45] private __gap;
}

File 3 of 36 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (proxy/utils/Initializable.sol)

pragma solidity ^0.8.0;

/**
 * @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 a proxied contract can't have 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.
 *
 * 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 initialize the implementation contract, you can either invoke the
 * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() initializer {}
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

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

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        require(_initializing || !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }
}

File 4 of 36 : AccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "./IAccessControlUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {
    function __AccessControl_init() internal initializer {
        __Context_init_unchained();
        __ERC165_init_unchained();
        __AccessControl_init_unchained();
    }

    function __AccessControl_init_unchained() internal initializer {
    }
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role, _msgSender());
        _;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        StringsUpgradeable.toHexString(uint160(account), 20),
                        " is missing role ",
                        StringsUpgradeable.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
    uint256[49] private __gap;
}

File 5 of 36 : UUPSUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (proxy/utils/UUPSUpgradeable.sol)

pragma solidity ^0.8.0;

import "../ERC1967/ERC1967UpgradeUpgradeable.sol";
import "./Initializable.sol";

/**
 * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an
 * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.
 *
 * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is
 * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing
 * `UUPSUpgradeable` with a custom implementation of upgrades.
 *
 * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.
 *
 * _Available since v4.1._
 */
abstract contract UUPSUpgradeable is Initializable, ERC1967UpgradeUpgradeable {
    function __UUPSUpgradeable_init() internal initializer {
        __ERC1967Upgrade_init_unchained();
        __UUPSUpgradeable_init_unchained();
    }

    function __UUPSUpgradeable_init_unchained() internal initializer {
    }
    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment
    address private immutable __self = address(this);

    /**
     * @dev Check that the execution is being performed through a delegatecall call and that the execution context is
     * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case
     * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a
     * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to
     * fail.
     */
    modifier onlyProxy() {
        require(address(this) != __self, "Function must be called through delegatecall");
        require(_getImplementation() == __self, "Function must be called through active proxy");
        _;
    }

    /**
     * @dev Upgrade the implementation of the proxy to `newImplementation`.
     *
     * Calls {_authorizeUpgrade}.
     *
     * Emits an {Upgraded} event.
     */
    function upgradeTo(address newImplementation) external virtual onlyProxy {
        _authorizeUpgrade(newImplementation);
        _upgradeToAndCallSecure(newImplementation, new bytes(0), false);
    }

    /**
     * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call
     * encoded in `data`.
     *
     * Calls {_authorizeUpgrade}.
     *
     * Emits an {Upgraded} event.
     */
    function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy {
        _authorizeUpgrade(newImplementation);
        _upgradeToAndCallSecure(newImplementation, data, true);
    }

    /**
     * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by
     * {upgradeTo} and {upgradeToAndCall}.
     *
     * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.
     *
     * ```solidity
     * function _authorizeUpgrade(address) internal override onlyOwner {}
     * ```
     */
    function _authorizeUpgrade(address newImplementation) internal virtual;
    uint256[50] private __gap;
}

File 6 of 36 : ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.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 initializer {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal initializer {
        _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() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

        _;

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

File 7 of 36 : PullPaymentUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (security/PullPayment.sol)

pragma solidity ^0.8.0;

import "../utils/escrow/EscrowUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Simple implementation of a
 * https://consensys.github.io/smart-contract-best-practices/recommendations/#favor-pull-over-push-for-external-calls[pull-payment]
 * strategy, where the paying contract doesn't interact directly with the
 * receiver account, which must withdraw its payments itself.
 *
 * Pull-payments are often considered the best practice when it comes to sending
 * Ether, security-wise. It prevents recipients from blocking execution, and
 * eliminates reentrancy concerns.
 *
 * 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].
 *
 * To use, derive from the `PullPayment` contract, and use {_asyncTransfer}
 * instead of Solidity's `transfer` function. Payees can query their due
 * payments with {payments}, and retrieve them with {withdrawPayments}.
 */
abstract contract PullPaymentUpgradeable is Initializable {
    EscrowUpgradeable private _escrow;

    function __PullPayment_init() internal initializer {
        __PullPayment_init_unchained();
    }

    function __PullPayment_init_unchained() internal initializer {
        _escrow = new EscrowUpgradeable();
        _escrow.initialize();
    }

    /**
     * @dev Withdraw accumulated payments, forwarding all gas to the recipient.
     *
     * Note that _any_ account can call this function, not just the `payee`.
     * This means that contracts unaware of the `PullPayment` protocol can still
     * receive funds this way, by having a separate account call
     * {withdrawPayments}.
     *
     * WARNING: Forwarding all gas opens the door to reentrancy vulnerabilities.
     * Make sure you trust the recipient, or are either following the
     * checks-effects-interactions pattern or using {ReentrancyGuard}.
     *
     * @param payee Whose payments will be withdrawn.
     */
    function withdrawPayments(address payable payee) public virtual {
        _escrow.withdraw(payee);
    }

    /**
     * @dev Returns the payments owed to an address.
     * @param dest The creditor's address.
     */
    function payments(address dest) public view returns (uint256) {
        return _escrow.depositsOf(dest);
    }

    /**
     * @dev Called by the payer to store the sent amount as credit to be pulled.
     * Funds sent in this way are stored in an intermediate {Escrow} contract, so
     * there is no danger of them being spent before withdrawal.
     *
     * @param dest The destination address of the funds.
     * @param amount The amount to transfer.
     */
    function _asyncTransfer(address dest, uint256 amount) internal virtual {
        _escrow.deposit{value: amount}(dest);
    }
    uint256[50] private __gap;
}

File 8 of 36 : CountersUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Counters.sol)

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library CountersUpgradeable {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}

File 9 of 36 : ERC165Checker.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.2) (utils/introspection/ERC165Checker.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Library used to query support of an interface declared via {IERC165}.
 *
 * Note that these functions return the actual result of the query: they do not
 * `revert` if an interface is not supported. It is up to the caller to decide
 * what to do in these cases.
 */
library ERC165Checker {
    // As per the EIP-165 spec, no interface should ever match 0xffffffff
    bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;

    /**
     * @dev Returns true if `account` supports the {IERC165} interface,
     */
    function supportsERC165(address account) internal view returns (bool) {
        // Any contract that implements ERC165 must explicitly indicate support of
        // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid
        return
            _supportsERC165Interface(account, type(IERC165).interfaceId) &&
            !_supportsERC165Interface(account, _INTERFACE_ID_INVALID);
    }

    /**
     * @dev Returns true if `account` supports the interface defined by
     * `interfaceId`. Support for {IERC165} itself is queried automatically.
     *
     * See {IERC165-supportsInterface}.
     */
    function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {
        // query support of both ERC165 as per the spec and support of _interfaceId
        return supportsERC165(account) && _supportsERC165Interface(account, interfaceId);
    }

    /**
     * @dev Returns a boolean array where each value corresponds to the
     * interfaces passed in and whether they're supported or not. This allows
     * you to batch check interfaces for a contract where your expectation
     * is that some interfaces may not be supported.
     *
     * See {IERC165-supportsInterface}.
     *
     * _Available since v3.4._
     */
    function getSupportedInterfaces(address account, bytes4[] memory interfaceIds)
        internal
        view
        returns (bool[] memory)
    {
        // an array of booleans corresponding to interfaceIds and whether they're supported or not
        bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length);

        // query support of ERC165 itself
        if (supportsERC165(account)) {
            // query support of each interface in interfaceIds
            for (uint256 i = 0; i < interfaceIds.length; i++) {
                interfaceIdsSupported[i] = _supportsERC165Interface(account, interfaceIds[i]);
            }
        }

        return interfaceIdsSupported;
    }

    /**
     * @dev Returns true if `account` supports all the interfaces defined in
     * `interfaceIds`. Support for {IERC165} itself is queried automatically.
     *
     * Batch-querying can lead to gas savings by skipping repeated checks for
     * {IERC165} support.
     *
     * See {IERC165-supportsInterface}.
     */
    function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) {
        // query support of ERC165 itself
        if (!supportsERC165(account)) {
            return false;
        }

        // query support of each interface in _interfaceIds
        for (uint256 i = 0; i < interfaceIds.length; i++) {
            if (!_supportsERC165Interface(account, interfaceIds[i])) {
                return false;
            }
        }

        // all interfaces supported
        return true;
    }

    /**
     * @notice Query if a contract implements an interface, does not check ERC165 support
     * @param account The address of the contract to query for support of an interface
     * @param interfaceId The interface identifier, as specified in ERC-165
     * @return true if the contract at account indicates support of the interface with
     * identifier interfaceId, false otherwise
     * @dev Assumes that account contains a contract that supports ERC165, otherwise
     * the behavior of this method is undefined. This precondition can be checked
     * with {supportsERC165}.
     * Interface identification is specified in ERC-165.
     */
    function _supportsERC165Interface(address account, bytes4 interfaceId) private view returns (bool) {
        // prepare call
        bytes memory encodedParams = abi.encodeWithSelector(IERC165.supportsInterface.selector, interfaceId);

        // perform static call
        bool success;
        uint256 returnSize;
        uint256 returnValue;
        assembly {
            success := staticcall(30000, account, add(encodedParams, 0x20), mload(encodedParams), 0x00, 0x20)
            returnSize := returndatasize()
            returnValue := mload(0x00)
        }

        return success && returnSize >= 0x20 && returnValue > 0;
    }
}

File 10 of 36 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @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 36 : IERC1155.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155 is IERC165 {
    /**
     * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
     */
    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);

    /**
     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
     * transfers.
     */
    event TransferBatch(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256[] ids,
        uint256[] values
    );

    /**
     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
     * `approved`.
     */
    event ApprovalForAll(address indexed account, address indexed operator, bool approved);

    /**
     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
     *
     * If an {URI} event was emitted for `id`, the standard
     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
     * returned by {IERC1155MetadataURI-uri}.
     */
    event URI(string value, uint256 indexed id);

    /**
     * @dev Returns the amount of tokens of token type `id` owned by `account`.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) external view returns (uint256);

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
        external
        view
        returns (uint256[] memory);

    /**
     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the caller.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address account, address operator) external view returns (bool);

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes calldata data
    ) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes calldata data
    ) external;
}

File 12 of 36 : IERC2981.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Interface for the NFT Royalty Standard.
 *
 * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
 * support for royalty payments across all NFT marketplaces and ecosystem participants.
 *
 * _Available since v4.5._
 */
interface IERC2981 is IERC165 {
    /**
     * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
     * exchange. The royalty amount is denominated and should be paid in that same unit of exchange.
     */
    function royaltyInfo(uint256 tokenId, uint256 salePrice)
        external
        view
        returns (address receiver, uint256 royaltyAmount);
}

File 13 of 36 : SafePct.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;

/**
 * @dev Compute percentages safely without phantom overflows.
 *
 * Intermediate operations can overflow even when the result will always
 * fit into computed type. Developers usually
 * assume that overflows raise errors. `SafePct` restores this intuition by
 * reverting the transaction when such an operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 *
 * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing
 * all math on `uint256` and `int256` and then downcasting.
 */

import "./SafeMathLite.sol";

library SafePct {
    using SafeMathLite for uint256;
    /**
     * Requirements:
     *
     * - intermediate operations must revert on overflow
     */
    function mulDiv(uint256 x, uint256 y, uint256 z) internal pure returns (uint256) {
        require(z > 0, "Division by zero");

        if (x == 0) return 0;
        uint256 xy = x * y;
        if (xy / x == y) { // no overflow happened - same as in SafeMath mul
            return xy / z;
        }

        //slither-disable-next-line divide-before-multiply
        uint256 a = x / z;
        uint256 b = x % z; // x = a * z + b

        //slither-disable-next-line divide-before-multiply
        uint256 c = y / z;
        uint256 d = y % z; // y = c * z + d

        return (a.mul(c).mul(z)).add(a.mul(d)).add(b.mul(c)).add(b.mul(d).div(z));
    }


}

File 14 of 36 : IterableMapping.sol
// SPDX-License-Identifier: UNLICENSED
//Copyright Ebisusbay.com 2021
pragma solidity 0.8.4;

library IterableMapping{

    struct Listing {
        uint256 listingId;
        uint256 nftId;
        address seller;
        address nft;
        uint256 price;
        uint256 fee;
        address purchaser;
        bool is1155;
        uint256 listingTime;
        uint256 saleTime;
        uint256 endingTime;
        uint256 royalty;
    }

    struct Map {
        bytes32[] keys;
        mapping(uint256 => bytes32) idToKey;
        mapping(bytes32 => Listing) values;
        mapping(bytes32 => uint) indexOf;
        mapping(bytes32 => bool) inserted;
    }

    function contains(Map storage map, bytes32 key) internal view returns (bool){
        return map.inserted[key];
    }

    function containsId(Map storage map, uint256 id) internal view returns (bool){
        return map.idToKey[id] != bytes32(0);
    }

    function get(Map storage map, bytes32 key) internal view returns (Listing storage) {
        return map.values[key];
    }

    function getById(Map storage map, uint256 id) internal view returns (Listing storage){
        return get(map, map.idToKey[id]);
    }

    function keyForId(Map storage map, uint256 id) internal view returns (bytes32){
        return map.idToKey[id];
    }

    function size(Map storage map) internal view returns (uint) {
        return map.keys.length;
    }

    function paged(Map storage map, uint256 _page, uint16 _pageSize) internal view returns (Listing[] memory){
        if(size(map) == 0){
            return new Listing[](0);
        }

        Listing[] memory result = new Listing[](_pageSize);
        uint16 returnCounter = 0;
        for(uint i = _pageSize * _page - _pageSize; i < _pageSize * _page; i++ ){
            if(i >= size(map)){
                break;
            }
            result[returnCounter] = get(map, map.keys[i]);
            returnCounter++;
        }
        return result;
    }

    function set(
        Map storage map,
        bytes32 key,
        Listing memory val
    ) internal {
        if (map.inserted[key]) {
            map.values[key] = val;
            map.idToKey[val.listingId] = key;
        } else {
            map.inserted[key] = true;
            map.values[key] = val;
            map.indexOf[key] = map.keys.length;
            map.keys.push(key);
            map.idToKey[val.listingId] = key;
        }
    }

    function remove(Map storage map, bytes32 key) internal {
        if (!map.inserted[key]) {
            return;
        }

        delete map.idToKey[map.values[key].listingId];
        delete map.inserted[key];
        delete map.values[key];

        uint index = map.indexOf[key];
        uint lastIndex = map.keys.length - 1;
        bytes32 lastKey = map.keys[lastIndex];

        map.indexOf[lastKey] = index;
        delete map.indexOf[key];

        map.keys[index] = lastKey;
        map.keys.pop();
    }
}

File 15 of 36 : IMembershipStaker.sol
// SPDX-License-Identifier: Unlicense 
pragma solidity 0.8.4;

import "@openzeppelin/contracts-upgradeable/interfaces/IERC1155ReceiverUpgradeable.sol";

interface IMembershipStaker is IERC1155ReceiverUpgradeable {

    /**
     * @dev Emitted when `staker` adds stakes one or more memberships for a new `totalStaked`
     */
    event MembershipStaked(address indexed staker, uint256 totalStaked);

    /**
     * @dev Emmited when `staker` unstaked for a new `totalStaked`
     */
     event MembershipUnstaked(address indexed staker, uint256 totalStaked);

     function stake(uint256 amount) external;

     function unstake(uint256 amount) external;

     function amountStaked(address staker) external view returns (uint256);

     function totalStaked() external view returns (uint256);

     function currentStaked() external view returns (address[] memory stakers, uint256[] memory amounts);

}

File 16 of 36 : Conduit.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./ConduitLib.sol";

contract Conduit {
    error InvalidERC721TransferAmount();
    error InvalidItemType();
    
    function execute(ConduitTransfer[] memory transfers)
        internal
    {
       
        // Retrieve the total number of transfers and place on the stack.
        uint256 totalStandardTransfers = transfers.length;

        // Iterate over each transfer.
        for (uint256 i = 0; i < totalStandardTransfers; ) {
            // Retrieve the transfer in question.
            ConduitTransfer memory standardTransfer = transfers[i];

            // Perform the transfer.
            _transfer(standardTransfer);

            // Skip overflow check as for loop is indexed starting at zero.
            unchecked {
                ++i;
            }
        }
    }
    function _transfer(ConduitTransfer memory item) private {
        // If the item type indicates Ether or a native token...
        if (item.itemType == ConduitItemType.ERC20) {
            // Transfer ERC20 token.
            IERC20(item.token).transferFrom(item.from, item.to, item.amount);
        } else if (item.itemType == ConduitItemType.ERC721) {
            // Ensure that exactly one 721 item is being transferred.
            if (item.amount != 1) {
                revert InvalidERC721TransferAmount();
            }

            IERC721(item.token).transferFrom(item.from, item.to, item.identifier);

        } else if (item.itemType == ConduitItemType.ERC1155) {
            IERC1155(item.token).safeTransferFrom(item.from, item.to, item.identifier, item.amount, "");
            // Transfer ERC1155 token.
        } else {
            // Throw with an error.
            revert InvalidItemType();
        }
    }
}

File 17 of 36 : IBundle.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

interface IBundle {
    event BundleCreated(uint indexed id, address[] contracts, uint[] ids);
    event BundleDestroyed(uint indexed id) ;
    
    function wrap(address[] calldata _tokens, uint256[] calldata _ids) external;

    function contents(uint256 _id) external view returns (address[] memory, uint[] memory);

    function unwrap(uint _id) external;
}

File 18 of 36 : IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20Upgradeable {
    /**
     * @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 `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, 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 `sender` to `recipient` 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 sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    /**
     * @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);
}

File 19 of 36 : IERC20MetadataUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20Upgradeable.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20MetadataUpgradeable is IERC20Upgradeable {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

File 20 of 36 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (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 initializer {
        __Context_init_unchained();
    }

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

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
    uint256[50] private __gap;
}

File 21 of 36 : IAccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControlUpgradeable {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

File 22 of 36 : StringsUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library StringsUpgradeable {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}

File 23 of 36 : ERC165Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {
    function __ERC165_init() internal initializer {
        __ERC165_init_unchained();
    }

    function __ERC165_init_unchained() internal initializer {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165Upgradeable).interfaceId;
    }
    uint256[50] private __gap;
}

File 24 of 36 : IERC165Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

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

File 25 of 36 : ERC1967UpgradeUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (proxy/ERC1967/ERC1967Upgrade.sol)

pragma solidity ^0.8.2;

import "../beacon/IBeaconUpgradeable.sol";
import "../../utils/AddressUpgradeable.sol";
import "../../utils/StorageSlotUpgradeable.sol";
import "../utils/Initializable.sol";

/**
 * @dev This abstract contract provides getters and event emitting update functions for
 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
 *
 * _Available since v4.1._
 *
 * @custom:oz-upgrades-unsafe-allow delegatecall
 */
abstract contract ERC1967UpgradeUpgradeable is Initializable {
    function __ERC1967Upgrade_init() internal initializer {
        __ERC1967Upgrade_init_unchained();
    }

    function __ERC1967Upgrade_init_unchained() internal initializer {
    }
    // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1
    bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;

    /**
     * @dev Storage slot with the address of the current implementation.
     * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

    /**
     * @dev Emitted when the implementation is upgraded.
     */
    event Upgraded(address indexed implementation);

    /**
     * @dev Returns the current implementation address.
     */
    function _getImplementation() internal view returns (address) {
        return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 implementation slot.
     */
    function _setImplementation(address newImplementation) private {
        require(AddressUpgradeable.isContract(newImplementation), "ERC1967: new implementation is not a contract");
        StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
    }

    /**
     * @dev Perform implementation upgrade
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeTo(address newImplementation) internal {
        _setImplementation(newImplementation);
        emit Upgraded(newImplementation);
    }

    /**
     * @dev Perform implementation upgrade with additional setup call.
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeToAndCall(
        address newImplementation,
        bytes memory data,
        bool forceCall
    ) internal {
        _upgradeTo(newImplementation);
        if (data.length > 0 || forceCall) {
            _functionDelegateCall(newImplementation, data);
        }
    }

    /**
     * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeToAndCallSecure(
        address newImplementation,
        bytes memory data,
        bool forceCall
    ) internal {
        address oldImplementation = _getImplementation();

        // Initial upgrade and setup call
        _setImplementation(newImplementation);
        if (data.length > 0 || forceCall) {
            _functionDelegateCall(newImplementation, data);
        }

        // Perform rollback test if not already in progress
        StorageSlotUpgradeable.BooleanSlot storage rollbackTesting = StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT);
        if (!rollbackTesting.value) {
            // Trigger rollback using upgradeTo from the new implementation
            rollbackTesting.value = true;
            _functionDelegateCall(
                newImplementation,
                abi.encodeWithSignature("upgradeTo(address)", oldImplementation)
            );
            rollbackTesting.value = false;
            // Check rollback was effective
            require(oldImplementation == _getImplementation(), "ERC1967Upgrade: upgrade breaks further upgrades");
            // Finally reset to the new implementation and log the upgrade
            _upgradeTo(newImplementation);
        }
    }

    /**
     * @dev Storage slot with the admin of the contract.
     * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;

    /**
     * @dev Emitted when the admin account has changed.
     */
    event AdminChanged(address previousAdmin, address newAdmin);

    /**
     * @dev Returns the current admin.
     */
    function _getAdmin() internal view returns (address) {
        return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 admin slot.
     */
    function _setAdmin(address newAdmin) private {
        require(newAdmin != address(0), "ERC1967: new admin is the zero address");
        StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;
    }

    /**
     * @dev Changes the admin of the proxy.
     *
     * Emits an {AdminChanged} event.
     */
    function _changeAdmin(address newAdmin) internal {
        emit AdminChanged(_getAdmin(), newAdmin);
        _setAdmin(newAdmin);
    }

    /**
     * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
     * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.
     */
    bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;

    /**
     * @dev Emitted when the beacon is upgraded.
     */
    event BeaconUpgraded(address indexed beacon);

    /**
     * @dev Returns the current beacon.
     */
    function _getBeacon() internal view returns (address) {
        return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;
    }

    /**
     * @dev Stores a new beacon in the EIP1967 beacon slot.
     */
    function _setBeacon(address newBeacon) private {
        require(AddressUpgradeable.isContract(newBeacon), "ERC1967: new beacon is not a contract");
        require(
            AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),
            "ERC1967: beacon implementation is not a contract"
        );
        StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;
    }

    /**
     * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does
     * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).
     *
     * Emits a {BeaconUpgraded} event.
     */
    function _upgradeBeaconToAndCall(
        address newBeacon,
        bytes memory data,
        bool forceCall
    ) internal {
        _setBeacon(newBeacon);
        emit BeaconUpgraded(newBeacon);
        if (data.length > 0 || forceCall) {
            _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);
        }
    }

    /**
     * @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) private returns (bytes memory) {
        require(AddressUpgradeable.isContract(target), "Address: delegate call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return AddressUpgradeable.verifyCallResult(success, returndata, "Address: low-level delegate call failed");
    }
    uint256[50] private __gap;
}

File 26 of 36 : IBeaconUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (proxy/beacon/IBeacon.sol)

pragma solidity ^0.8.0;

/**
 * @dev This is the interface that {BeaconProxy} expects of its beacon.
 */
interface IBeaconUpgradeable {
    /**
     * @dev Must return an address that can be used as a delegate call target.
     *
     * {BeaconProxy} will check that this address is a contract.
     */
    function implementation() external view returns (address);
}

File 27 of 36 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Address.sol)

pragma solidity ^0.8.0;

/**
 * @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
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 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 functionCall(target, data, "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");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(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) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason 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 {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 28 of 36 : StorageSlotUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/StorageSlot.sol)

pragma solidity ^0.8.0;

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 *
 * Example usage to set ERC1967 implementation slot:
 * ```
 * contract ERC1967 {
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 *
 * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._
 */
library StorageSlotUpgradeable {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    /**
     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
     */
    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.
     */
    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
     */
    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.
     */
    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
        assembly {
            r.slot := slot
        }
    }
}

File 29 of 36 : EscrowUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/escrow/Escrow.sol)

pragma solidity ^0.8.0;

import "../../access/OwnableUpgradeable.sol";
import "../AddressUpgradeable.sol";
import "../../proxy/utils/Initializable.sol";

/**
 * @title Escrow
 * @dev Base escrow contract, holds funds designated for a payee until they
 * withdraw them.
 *
 * Intended usage: This contract (and derived escrow contracts) should be a
 * standalone contract, that only interacts with the contract that instantiated
 * it. That way, it is guaranteed that all Ether will be handled according to
 * the `Escrow` rules, and there is no need to check for payable functions or
 * transfers in the inheritance tree. The contract that uses the escrow as its
 * payment method should be its owner, and provide public methods redirecting
 * to the escrow's deposit and withdraw.
 */
contract EscrowUpgradeable is Initializable, OwnableUpgradeable {
    function initialize() public virtual initializer {
        __Escrow_init();
    }
    function __Escrow_init() internal initializer {
        __Context_init_unchained();
        __Ownable_init_unchained();
        __Escrow_init_unchained();
    }

    function __Escrow_init_unchained() internal initializer {
    }
    using AddressUpgradeable for address payable;

    event Deposited(address indexed payee, uint256 weiAmount);
    event Withdrawn(address indexed payee, uint256 weiAmount);

    mapping(address => uint256) private _deposits;

    function depositsOf(address payee) public view returns (uint256) {
        return _deposits[payee];
    }

    /**
     * @dev Stores the sent amount as credit to be withdrawn.
     * @param payee The destination address of the funds.
     */
    function deposit(address payee) public payable virtual onlyOwner {
        uint256 amount = msg.value;
        _deposits[payee] += amount;
        emit Deposited(payee, amount);
    }

    /**
     * @dev Withdraw accumulated balance for a payee, forwarding all gas to the
     * recipient.
     *
     * WARNING: Forwarding all gas opens the door to reentrancy vulnerabilities.
     * Make sure you trust the recipient, or are either following the
     * checks-effects-interactions pattern or using {ReentrancyGuard}.
     *
     * @param payee The address whose funds will be withdrawn and transferred to.
     */
    function withdraw(address payable payee) public virtual onlyOwner {
        uint256 payment = _deposits[payee];

        _deposits[payee] = 0;

        payee.sendValue(payment);

        emit Withdrawn(payee, payment);
    }
    uint256[49] private __gap;
}

File 30 of 36 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.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 initializer {
        __Context_init_unchained();
        __Ownable_init_unchained();
    }

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

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        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);
    }
    uint256[49] private __gap;
}

File 31 of 36 : 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);
}

File 32 of 36 : SafeMathLite.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
library SafeMathLite{

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }
}

File 33 of 36 : IERC1155ReceiverUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (interfaces/IERC1155Receiver.sol)

pragma solidity ^0.8.0;

import "../token/ERC1155/IERC1155ReceiverUpgradeable.sol";

File 34 of 36 : IERC1155ReceiverUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC1155/IERC1155Receiver.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev _Available since v3.1._
 */
interface IERC1155ReceiverUpgradeable is IERC165Upgradeable {
    /**
        @dev Handles the receipt of a single ERC1155 token type. This function is
        called at the end of a `safeTransferFrom` after the balance has been updated.
        To accept the transfer, this must return
        `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
        (i.e. 0xf23a6e61, or its own function selector).
        @param operator The address which initiated the transfer (i.e. msg.sender)
        @param from The address which previously owned the token
        @param id The ID of the token being transferred
        @param value The amount of tokens being transferred
        @param data Additional data with no specified format
        @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
    */
    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    ) external returns (bytes4);

    /**
        @dev Handles the receipt of a multiple ERC1155 token types. This function
        is called at the end of a `safeBatchTransferFrom` after the balances have
        been updated. To accept the transfer(s), this must return
        `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
        (i.e. 0xbc197c81, or its own function selector).
        @param operator The address which initiated the batch transfer (i.e. msg.sender)
        @param from The address which previously owned the token
        @param ids An array containing ids of each token being transferred (order and length must match values array)
        @param values An array containing amounts of each token being transferred (order and length must match ids array)
        @param data Additional data with no specified format
        @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
    */
    function onERC1155BatchReceived(
        address operator,
        address from,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    ) external returns (bytes4);
}

File 35 of 36 : 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 36 of 36 : ConduitLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

enum ConduitItemType {
    NATIVE, // unused
    ERC20,
    ERC721,
    ERC1155
}

struct ConduitTransfer {
    ConduitItemType itemType;
    address token;
    address from;
    address to;
    uint256 identifier;
    uint256 amount;
}

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

Contract ABI

[{"inputs":[],"name":"InvalidERC721TransferAmount","type":"error"},{"inputs":[],"name":"InvalidItemType","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"admin","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"AdminWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"listingId","type":"uint256"}],"name":"Cancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"updater","type":"address"},{"indexed":false,"internalType":"uint256","name":"reg","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fm","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"admin","type":"uint256"}],"name":"FeesUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"listingId","type":"uint256"}],"name":"Listed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"staffMember","type":"address"},{"indexed":true,"internalType":"address","name":"collection","type":"address"},{"indexed":false,"internalType":"address","name":"ipHolder","type":"address"},{"indexed":false,"internalType":"uint16","name":"fee","type":"uint16"}],"name":"RoyaltyChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"staffMember","type":"address"},{"indexed":true,"internalType":"address","name":"collection","type":"address"}],"name":"RoyaltyRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"listingId","type":"uint256"}],"name":"Sold","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"admin","type":"address"},{"indexed":false,"internalType":"address","name":"newStaker","type":"address"}],"name":"StakerUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"IID_BUNDLE","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"IID_IERC1155","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"IID_IERC2981","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"IID_IERC721","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SERVER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STAFF_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UPGRADER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_listingId","type":"uint256"}],"name":"activeListing","outputs":[{"components":[{"internalType":"uint256","name":"listingId","type":"uint256"},{"internalType":"uint256","name":"nftId","type":"uint256"},{"internalType":"address","name":"seller","type":"address"},{"internalType":"address","name":"nft","type":"address"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"address","name":"purchaser","type":"address"},{"internalType":"bool","name":"is1155","type":"bool"},{"internalType":"uint256","name":"listingTime","type":"uint256"},{"internalType":"uint256","name":"saleTime","type":"uint256"},{"internalType":"uint256","name":"endingTime","type":"uint256"},{"internalType":"uint256","name":"royalty","type":"uint256"}],"internalType":"struct IterableMapping.Listing","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"addToEscrow","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_tokens","type":"address[]"},{"internalType":"uint256[]","name":"_ids","type":"uint256[]"},{"internalType":"address","name":"_to","type":"address"}],"name":"bulkTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"calculateRoyalty","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_nft","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"address","name":"_seller","type":"address"}],"name":"cancelActive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"cancelListing","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_ids","type":"uint256[]"}],"name":"cancelListings","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_listingId","type":"uint256"}],"name":"cancelledListing","outputs":[{"components":[{"internalType":"uint256","name":"listingId","type":"uint256"},{"internalType":"uint256","name":"nftId","type":"uint256"},{"internalType":"address","name":"seller","type":"address"},{"internalType":"address","name":"nft","type":"address"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"address","name":"purchaser","type":"address"},{"internalType":"bool","name":"is1155","type":"bool"},{"internalType":"uint256","name":"listingTime","type":"uint256"},{"internalType":"uint256","name":"saleTime","type":"uint256"},{"internalType":"uint256","name":"endingTime","type":"uint256"},{"internalType":"uint256","name":"royalty","type":"uint256"}],"internalType":"struct IterableMapping.Listing","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_listingId","type":"uint256"}],"name":"completeListing","outputs":[{"components":[{"internalType":"uint256","name":"listingId","type":"uint256"},{"internalType":"uint256","name":"nftId","type":"uint256"},{"internalType":"address","name":"seller","type":"address"},{"internalType":"address","name":"nft","type":"address"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"address","name":"purchaser","type":"address"},{"internalType":"bool","name":"is1155","type":"bool"},{"internalType":"uint256","name":"listingTime","type":"uint256"},{"internalType":"uint256","name":"saleTime","type":"uint256"},{"internalType":"uint256","name":"endingTime","type":"uint256"},{"internalType":"uint256","name":"royalty","type":"uint256"}],"internalType":"struct IterableMapping.Listing","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"fee","outputs":[{"internalType":"uint16","name":"userFee","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"}],"name":"getRoyalty","outputs":[{"components":[{"internalType":"address","name":"ipHolder","type":"address"},{"internalType":"uint16","name":"percent","type":"uint16"}],"internalType":"struct Marketplace.Royalty","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"getStandardNFTRoyalty","outputs":[{"internalType":"address","name":"ipHolder","type":"address"},{"internalType":"uint256","name":"royaltyAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC1155","name":"_memberships","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"}],"name":"isBundleContract","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"isFM","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"isMember","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"}],"name":"isRoyaltyStandard","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"isVIP","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_nft","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"makeListing","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_nfts","type":"address[]"},{"internalType":"uint256[]","name":"_ids","type":"uint256[]"},{"internalType":"uint256[]","name":"_prices","type":"uint256[]"}],"name":"makeListings","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"makePurchase","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"makePurchases","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"memberFee","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"membershipStaker","outputs":[{"internalType":"contract IMembershipStaker","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_page","type":"uint256"},{"internalType":"uint16","name":"_pageSize","type":"uint16"}],"name":"pagedActive","outputs":[{"components":[{"internalType":"uint256","name":"listingId","type":"uint256"},{"internalType":"uint256","name":"nftId","type":"uint256"},{"internalType":"address","name":"seller","type":"address"},{"internalType":"address","name":"nft","type":"address"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"address","name":"purchaser","type":"address"},{"internalType":"bool","name":"is1155","type":"bool"},{"internalType":"uint256","name":"listingTime","type":"uint256"},{"internalType":"uint256","name":"saleTime","type":"uint256"},{"internalType":"uint256","name":"endingTime","type":"uint256"},{"internalType":"uint256","name":"royalty","type":"uint256"}],"internalType":"struct IterableMapping.Listing[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_page","type":"uint256"},{"internalType":"uint16","name":"_pageSize","type":"uint16"}],"name":"pagedCancelled","outputs":[{"components":[{"internalType":"uint256","name":"listingId","type":"uint256"},{"internalType":"uint256","name":"nftId","type":"uint256"},{"internalType":"address","name":"seller","type":"address"},{"internalType":"address","name":"nft","type":"address"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"address","name":"purchaser","type":"address"},{"internalType":"bool","name":"is1155","type":"bool"},{"internalType":"uint256","name":"listingTime","type":"uint256"},{"internalType":"uint256","name":"saleTime","type":"uint256"},{"internalType":"uint256","name":"endingTime","type":"uint256"},{"internalType":"uint256","name":"royalty","type":"uint256"}],"internalType":"struct IterableMapping.Listing[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_page","type":"uint256"},{"internalType":"uint16","name":"_pageSize","type":"uint16"}],"name":"pagedComplete","outputs":[{"components":[{"internalType":"uint256","name":"listingId","type":"uint256"},{"internalType":"uint256","name":"nftId","type":"uint256"},{"internalType":"address","name":"seller","type":"address"},{"internalType":"address","name":"nft","type":"address"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"address","name":"purchaser","type":"address"},{"internalType":"bool","name":"is1155","type":"bool"},{"internalType":"uint256","name":"listingTime","type":"uint256"},{"internalType":"uint256","name":"saleTime","type":"uint256"},{"internalType":"uint256","name":"endingTime","type":"uint256"},{"internalType":"uint256","name":"royalty","type":"uint256"}],"internalType":"struct IterableMapping.Listing[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"payRoyalty","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"dest","type":"address"}],"name":"payments","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"regFee","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_nftContract","type":"address"},{"internalType":"address","name":"_ipHolder","type":"address"},{"internalType":"uint16","name":"_fee","type":"uint16"}],"name":"registerRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_nftContract","type":"address"},{"internalType":"address","name":"_paymentAddress","type":"address"},{"internalType":"uint16","name":"_fee","type":"uint16"}],"name":"registerRoyaltyAsOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_nftContract","type":"address"}],"name":"removeRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"royalties","outputs":[{"internalType":"address","name":"ipHolder","type":"address"},{"internalType":"uint16","name":"percent","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_membershipStaker","type":"address"}],"name":"setMembershipStaker","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_ryoshi","type":"address"}],"name":"setRyoshi","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalActive","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalCancelled","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalComplete","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum ConduitItemType","name":"_type","type":"uint8"},{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_identifier","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"transferToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_regFee","type":"uint16"},{"internalType":"uint16","name":"_memFee","type":"uint16"},{"internalType":"uint16","name":"_vipFee","type":"uint16"}],"name":"updateFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"vipFee","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"payee","type":"address"}],"name":"withdrawPayments","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

60a06040523060601b60805234801561001757600080fd5b5060805160601c615b3e6200004c600039600081816113f4015281816114340152818161160101526116410152615b3e6000f3fe60806040526004361061039b5760003560e01c806379c7550f116101dc578063c1fa3ee011610102578063dfa3d773116100a0578063eb61e3711161006f578063eb61e37114610b33578063f4201c3c14610bc5578063f72c0d8b14610be5578063f89f7ab314610c1957600080fd5b8063dfa3d77314610ab5578063e0966dad14610ad5578063e1053f4e14610af0578063e2982c2114610b1357600080fd5b8063c4d66de8116100dc578063c4d66de814610a32578063c9272fb914610a52578063d309888314610a72578063d547741f14610a9557600080fd5b8063c1fa3ee0146109df578063c2168d59146109ff578063c4175a4414610a1f57600080fd5b80639fa6b4a01161017a578063ac7d126e11610149578063ac7d126e14610939578063b78eebe514610966578063bfd7b7e91461099f578063c1b875c8146109bf57600080fd5b80639fa6b4a01461087e578063a217fddf146108e4578063a230c524146108f9578063a68928e21461091957600080fd5b80638ad6ff1e116101b65780638ad6ff1e146107e15780638fff20f31461082057806391d14854146108435780639b8cfe521461086357600080fd5b806379c7550f1461077f57806385290fa11461079f57806389ef8292146107c157600080fd5b80633659cfe6116102c15780634a0fc3d71161025f5780635de33c101161022e5780635de33c10146106ec57806363ea10451461070c578063670babe01461072c5780636fcca69b1461074c57600080fd5b80634a0fc3d7146106965780634f1ef286146106b15780635382f599146106c457806357759600146106d757600080fd5b806339fbd7381161029b57806339fbd7381461062c5780633ccfd60b146106595780634065da631461066e57806342c6e7fd1461068157600080fd5b80633659cfe6146105d957806337c39279146105f957806339f3dc5a1461060c57600080fd5b80632a5ff0021161033957806331b3eb941161030857806331b3eb9414610559578063322aac8f1461057957806332fac3071461059957806336568abe146105b957600080fd5b80632a5ff002146104e45780632a7e7aa4146104f95780632f2ff15d14610519578063305a67a81461053957600080fd5b806318cf28341161037557806318cf2834146104305780631afadd37146104725780631d6c53a114610494578063248a9ca3146104b457600080fd5b806301ffc9a7146103a757806307386bdd146103dc57806316406a851461041057600080fd5b366103a257005b600080fd5b3480156103b357600080fd5b506103c76103c2366004614d4b565b610c39565b60405190151581526020015b60405180910390f35b3480156103e857600080fd5b506103f763152a902d60e11b81565b6040516001600160e01b031990911681526020016103d3565b34801561041c57600080fd5b506103c761042b366004614905565b610c70565b34801561043c57600080fd5b506104647fa8a7bc421f721cb936ea99efdad79237e6ee0b871a2a08cf648691f9584cdc7781565b6040519081526020016103d3565b34801561047e57600080fd5b5061049261048d366004614b48565b610cfe565b005b3480156104a057600080fd5b506104926104af36600461493d565b610dfd565b3480156104c057600080fd5b506104646104cf366004614d04565b60009081526065602052604090206001015490565b3480156104f057600080fd5b50610464610f9a565b34801561050557600080fd5b50610492610514366004614d73565b610fab565b34801561052557600080fd5b50610492610534366004614d1c565b611028565b34801561054557600080fd5b50610492610554366004614d04565b611053565b34801561056557600080fd5b50610492610574366004614905565b61125c565b34801561058557600080fd5b5061049261059436600461493d565b611298565b3480156105a557600080fd5b506103c76105b4366004614905565b61134f565b3480156105c557600080fd5b506104926105d4366004614d1c565b61136b565b3480156105e557600080fd5b506104926105f4366004614905565b6113e9565b610492610607366004614ca4565b6114b2565b34801561061857600080fd5b50610492610627366004614ca4565b611533565b34801561063857600080fd5b5061064c610647366004614e26565b61157f565b6040516103d39190614fba565b34801561066557600080fd5b50610492611595565b61049261067c366004614905565b6115e0565b34801561068d57600080fd5b506104646115ea565b3480156106a257600080fd5b506103f7630dd472c160e21b81565b6104926106bf366004614983565b6115f6565b6104926106d2366004614a93565b6116ac565b3480156106e357600080fd5b50610464611719565b3480156106f857600080fd5b50610492610707366004614905565b611725565b34801561071857600080fd5b5061064c610727366004614e26565b611755565b34801561073857600080fd5b50610492610747366004614de3565b611764565b34801561075857600080fd5b5061076c610767366004614905565b611807565b60405161ffff90911681526020016103d3565b34801561078b57600080fd5b5061049261079a366004614a93565b6118f8565b3480156107ab57600080fd5b50610464600080516020615ac283398151915281565b3480156107cd57600080fd5b506104926107dc366004614ac7565b611e32565b3480156107ed57600080fd5b506108016107fc366004614a93565b612239565b604080516001600160a01b0390931683526020830191909152016103d3565b34801561082c57600080fd5b506101605461076c90600160c01b900461ffff1681565b34801561084f57600080fd5b506103c761085e366004614d1c565b612421565b34801561086f57600080fd5b506103f7636cdb3d1360e11b81565b34801561088a57600080fd5b506108c2610899366004614905565b610171602052600090815260409020546001600160a01b03811690600160a01b900461ffff1682565b604080516001600160a01b03909316835261ffff9091166020830152016103d3565b3480156108f057600080fd5b50610464600081565b34801561090557600080fd5b506103c7610914366004614905565b61244c565b34801561092557600080fd5b50610464610934366004614a93565b612466565b34801561094557600080fd5b50610959610954366004614d04565b6125ad565b6040516103d39190615159565b34801561097257600080fd5b5061017254610987906001600160a01b031681565b6040516001600160a01b0390911681526020016103d3565b3480156109ab57600080fd5b506109596109ba366004614d04565b612663565b3480156109cb57600080fd5b506104926109da366004614905565b612677565b3480156109eb57600080fd5b5061064c6109fa366004614e26565b6126e2565b348015610a0b57600080fd5b50610959610a1a366004614d04565b6126f1565b610492610a2d366004614d04565b612705565b348015610a3e57600080fd5b50610492610a4d366004614905565b612738565b348015610a5e57600080fd5b50610492610a6d366004614905565b61282f565b348015610a7e57600080fd5b506101605461076c90600160b01b900461ffff1681565b348015610aa157600080fd5b50610492610ab0366004614d1c565b612893565b348015610ac157600080fd5b50610492610ad0366004614a52565b6128b9565b348015610ae157600080fd5b506103f76380ac58cd60e01b81565b348015610afc57600080fd5b506101605461076c90600160a01b900461ffff1681565b348015610b1f57600080fd5b50610464610b2e366004614905565b612922565b348015610b3f57600080fd5b50610b9d610b4e366004614905565b604080518082018252600080825260209182018190526001600160a01b03938416815261017182528290208251808401909352549283168252600160a01b90920461ffff169181019190915290565b6040805182516001600160a01b0316815260209283015161ffff1692810192909252016103d3565b348015610bd157600080fd5b506103c7610be0366004614905565b6129a0565b348015610bf157600080fd5b506104647f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e381565b348015610c2557600080fd5b506103c7610c34366004614905565b612b68565b60006001600160e01b03198216637965db0b60e01b1480610c6a57506301ffc9a760e01b6001600160e01b03198316145b92915050565b61016054604051627eeac760e11b81526001600160a01b03838116600483015260016024830152600092839291169062fdd58e9060440160206040518083038186803b158015610cbf57600080fd5b505afa158015610cd3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cf79190614e0e565b1192915050565b8483148015610d0c57508481145b610d4c5760405162461bcd60e51b815260206004820152600c60248201526b6d697373696e67206461746160a01b60448201526064015b60405180910390fd5b60005b85811015610df457610de2878783818110610d7a57634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610d8f9190614905565b868684818110610daf57634e487b7160e01b600052603260045260246000fd5b90506020020135858585818110610dd657634e487b7160e01b600052603260045260246000fd5b905060200201356118f8565b80610dec81615284565b915050610d4f565b50505050505050565b610e068361134f565b15610e405760405162461bcd60e51b815260206004820152600a6024820152696e6f74206c656761637960b01b6044820152606401610d43565b336001600160a01b0316836001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b158015610e8357600080fd5b505afa158015610e97573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebb9190614921565b6001600160a01b031614610efd5760405162461bcd60e51b81526020600482015260096024820152683737ba1037bbb732b960b91b6044820152606401610d43565b6040805180820182526001600160a01b0384811680835261ffff85811660208086018281528a861660008181526101718452899020975188549251909516600160a01b026001600160b01b031990921694909616939093179290921790945584519182528101929092529133917f9c33f160728db2e0d663d19462fc54c52fef3827d82f8e2bf7431872caa03687910160405180910390a3505050565b6000610fa661016b5490565b905090565b610fd57fa8a7bc421f721cb936ea99efdad79237e6ee0b871a2a08cf648691f9584cdc7733612421565b6110125760405162461bcd60e51b815260206004820152600e60248201526d1b9bdd08185d5d1a1bdc9a5e995960921b6044820152606401610d43565b611020868686868686612b84565b505050505050565b6000828152606560205260409020600101546110448133612c73565b61104e8383612cd7565b505050565b6000818152610162602052604090205461109c5760405162461bcd60e51b815260206004820152600a6024820152691a5b9d985b1a59081a5960b21b6044820152606401610d43565b60006110aa61016183612d5d565b6040805161018081018252825481526001830154602082015260028301546001600160a01b0390811692820183905260038401548116606083015260048401546080830152600584015460a0830152600684015490811660c0830152600160a01b900460ff16151560e0820152600783015461010082015260088301546101208201526009830154610140820152600a909201546101608301529091503314806111675750611167600080516020615ac283398151915233612421565b8061119757506111977fa8a7bc421f721cb936ea99efdad79237e6ee0b871a2a08cf648691f9584cdc7733612421565b6111d05760405162461bcd60e51b815260206004820152600a6024820152693737ba103634b9ba32b960b11b6044820152606401610d43565b42610120820152600082815261016260205260409020546111f5905b61016190612d81565b61122d8260405160200161120b91815260200190565b60408051601f19818403018152919052805160209091012061016b9083612f13565b60405182907fc41d93b8bfbf9fd7cf5bfe271fd649ab6a6fec0ea101c23b82a2a28eca2533a990600090a25050565b600261012e5414156112805760405162461bcd60e51b8152600401610d4390615122565b600261012e5561128f81613127565b50600161012e55565b600080516020615ac28339815191526112b18133612c73565b6040805180820182526001600160a01b0385811680835261ffff86811660208086018281528b861660008181526101718452899020975188549251909516600160a01b026001600160b01b031990921694909616939093179290921790945584519182528101929092529133917f9c33f160728db2e0d663d19462fc54c52fef3827d82f8e2bf7431872caa03687910160405180910390a350505050565b6000610c6a6001600160a01b03831663152a902d60e11b613183565b6001600160a01b03811633146113db5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610d43565b6113e5828261319f565b5050565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156114325760405162461bcd60e51b8152600401610d439061503c565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611464613206565b6001600160a01b03161461148a5760405162461bcd60e51b8152600401610d4390615088565b61149381613234565b604080516000808252602082019092526114af9183919061325f565b50565b600261012e5414156114d65760405162461bcd60e51b8152600401610d4390615122565b600261012e5560005b818110156115285761151683838381811061150a57634e487b7160e01b600052603260045260246000fd5b905060200201356133a3565b8061152081615284565b9150506114df565b5050600161012e5550565b60005b8181101561104e5761156d83838381811061156157634e487b7160e01b600052603260045260246000fd5b90506020020135611053565b8061157781615284565b915050611536565b606061158e61016684846136c8565b9392505050565b60006115a18133612c73565b60405147815233907fba443e8671971c36cdeb74f87321041daff421230cbc5e36cb835269ed1d8b7e9060200160405180910390a26114af33476138f9565b6114af8134613a12565b6000610fa66101665490565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016141561163f5760405162461bcd60e51b8152600401610d439061503c565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611671613206565b6001600160a01b0316146116975760405162461bcd60e51b8152600401610d4390615088565b6116a082613234565b6113e58282600161325f565b600034116116b957505050565b60006116c6848484612466565b90503481146117085760405162461bcd60e51b815260206004820152600e60248201526d1a5b9d985b1a5908185b5bdd5b9d60921b6044820152606401610d43565b611713848484613a6e565b50505050565b6000610fa66101615490565b60006117318133612c73565b5061017380546001600160a01b0319166001600160a01b0392909216919091179055565b606061158e61016184846136c8565b60006117708133612c73565b610160805463ffffffff60b01b1916600160c01b61ffff87811691820261ffff60b01b191692909217600160b01b8784169081029190911761ffff60a01b1916600160a01b938716938402179093556040805191825260208201939093529182015233907f93d3bfdb56bc52c00ef2f1ffdff11a306cb6e5f2ef404c9c1bcd5bf27e88c92f9060600160405180910390a250505050565b61016054604051627eeac760e11b81526001600160a01b03838116600483015260036024830152600092839291169062fdd58e9060440160206040518083038186803b15801561185657600080fd5b505afa15801561186a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061188e9190614e0e565b111561189c57506000919050565b6118a5826129a0565b156118bf575061016054600160a01b900461ffff16919050565b6118c882610c70565b156118e2575061016054600160b01b900461ffff16919050565b5061016054600160c01b900461ffff165b919050565b600081116119385760405162461bcd60e51b815260206004820152600d60248201526c696e76616c696420707269636560981b6044820152606401610d43565b60006119546001600160a01b038516636cdb3d1360e11b613183565b905060006119726001600160a01b0386166380ac58cd60e01b613183565b9050818061197d5750805b6119bc5760405162461bcd60e51b815260206004820152601060248201526f756e737570706f72746564207479706560801b6044820152606401610d43565b8015611b44576040516331a9108f60e11b81526004810185905233906001600160a01b03871690636352211e9060240160206040518083038186803b158015611a0457600080fd5b505afa158015611a18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a3c9190614921565b6001600160a01b031614611a7e5760405162461bcd60e51b81526020600482015260096024820152681b9bdd081bdddb995960ba1b6044820152606401610d43565b60405163e985e9c560e01b81523360048201523060248201526001600160a01b0386169063e985e9c59060440160206040518083038186803b158015611ac357600080fd5b505afa158015611ad7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611afb9190614ce4565b611b3f5760405162461bcd60e51b815260206004820152601560248201527436bab9ba1030b8383937bb32903a3930b739b332b960591b6044820152606401610d43565b611cbd565b604051627eeac760e11b8152336004820152602481018590526000906001600160a01b0387169062fdd58e9060440160206040518083038186803b158015611b8b57600080fd5b505afa158015611b9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bc39190614e0e565b11611bfc5760405162461bcd60e51b81526020600482015260096024820152681b9bdd081bdddb995960ba1b6044820152606401610d43565b60405163e985e9c560e01b81523360048201523060248201526001600160a01b0386169063e985e9c59060440160206040518083038186803b158015611c4157600080fd5b505afa158015611c55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c799190614ce4565b611cbd5760405162461bcd60e51b815260206004820152601560248201527436bab9ba1030b8383937bb32903a3930b739b332b960591b6044820152606401610d43565b6000853386604051602001611cd493929190614f96565b6040516020818303038152906040528051906020012090506000611cf9878787612466565b6000838152610165602052604090205490915060ff1615611d855760008281526101636020526040902060048101869055611d44611d3633611807565b879061ffff16612710613bd9565b6005820155600a810182905580546040517ff3ecdc9ffda52c5ad69793c567cb456f83bba2d14f196542e0be80c919a8bda390600090a25050505050505050565b611d8d614778565b6101705481526020810187905233604082018190526001600160a01b038916606083015260808201879052611dc590611d3690611807565b60a082015284151560e0820152426101008201526101608101829052611dee6101618483612f13565b611dfd61017080546001019055565b80516040517ff3ecdc9ffda52c5ad69793c567cb456f83bba2d14f196542e0be80c919a8bda390600090a25050505050505050565b838214611e745760405162461bcd60e51b815260206004820152601060248201526f185c9c985e5cc81b9bdd08195c5d585b60821b6044820152606401610d43565b60008467ffffffffffffffff811115611e9d57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611ed657816020015b611ec36147f6565b815260200190600190039081611ebb5790505b50905060005b8581101561222f576000611f356380ac58cd60e01b898985818110611f1157634e487b7160e01b600052603260045260246000fd5b9050602002016020810190611f269190614905565b6001600160a01b031690613183565b90508015611fb3576002838381518110611f5f57634e487b7160e01b600052603260045260246000fd5b6020026020010151600001906003811115611f8a57634e487b7160e01b600052602160045260246000fd5b90816003811115611fab57634e487b7160e01b600052602160045260246000fd5b905250612091565b611fde636cdb3d1360e11b898985818110611f1157634e487b7160e01b600052603260045260246000fd5b61201f5760405162461bcd60e51b8152602060048201526012602482015271696e76616c696420746f6b656e207479706560701b6044820152606401610d43565b600383838151811061204157634e487b7160e01b600052603260045260246000fd5b602002602001015160000190600381111561206c57634e487b7160e01b600052602160045260246000fd5b9081600381111561208d57634e487b7160e01b600052602160045260246000fd5b9052505b8787838181106120b157634e487b7160e01b600052603260045260246000fd5b90506020020160208101906120c69190614905565b8383815181106120e657634e487b7160e01b600052603260045260246000fd5b6020026020010151602001906001600160a01b031690816001600160a01b0316815250503383838151811061212b57634e487b7160e01b600052603260045260246000fd5b6020026020010151604001906001600160a01b031690816001600160a01b0316815250508383838151811061217057634e487b7160e01b600052603260045260246000fd5b6020026020010151606001906001600160a01b031690816001600160a01b0316815250508585838181106121b457634e487b7160e01b600052603260045260246000fd5b905060200201358383815181106121db57634e487b7160e01b600052603260045260246000fd5b60200260200101516080018181525050600183838151811061220d57634e487b7160e01b600052603260045260246000fd5b602090810291909101015160a00152508061222781615284565b915050611edc565b5061102081613ceb565b6000806122566001600160a01b038616636cdb3d1360e11b613183565b8061227657506122766001600160a01b0386166380ac58cd60e01b613183565b6122ba5760405162461bcd60e51b81526020600482015260156024820152746e6f7420455243373231206f72204552433131353560581b6044820152606401610d43565b6122c385612b68565b156123055760405162461bcd60e51b81526020600482015260126024820152716e6f7420737570706f72742062756e646c6560701b6044820152606401610d43565b61230e8561134f565b1561239b5760405163152a902d60e11b815260048101859052602481018490526001600160a01b03861690632a55205a90604401604080518083038186803b15801561235957600080fd5b505afa15801561236d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123919190614a25565b9092509050612419565b6001600160a01b03851660009081526101716020526040902054600160a01b900461ffff1615612419576001600160a01b038516600090815261017160205260409020546123f8908490600160a01b900461ffff16612710613bd9565b6001600160a01b038087166000908152610171602052604090205416925090505b935093915050565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b600061245782610c70565b80610c6a5750610c6a826129a0565b60008061247285612b68565b1561259657604051635af67c8960e11b81526004810185905260009081906001600160a01b0388169063b5ecf9129060240160006040518083038186803b1580156124bc57600080fd5b505afa1580156124d0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526124f89190810190614bde565b81519193509150600061250b8783613d36565b905060005b8281101561258c57600061257386838151811061253d57634e487b7160e01b600052603260045260246000fd5b602002602001015186848151811061256557634e487b7160e01b600052603260045260246000fd5b602002602001015185612239565b9150612581905081886151bd565b965050600101612510565b50505050506125a5565b6125a1858585612239565b9150505b949350505050565b6125b5614778565b6125c161016b83612d5d565b6040805161018081018252825481526001830154602082015260028301546001600160a01b039081169282019290925260038301548216606082015260048301546080820152600583015460a0820152600683015491821660c0820152600160a01b90910460ff16151560e0820152600782015461010082015260088201546101208201526009820154610140820152600a9091015461016082015292915050565b61266b614778565b6125c161016183612d5d565b600080516020615ac28339815191526126908133612c73565b6001600160a01b0382166000818152610171602052604080822080546001600160b01b03191690555133917f8e70db61b60e9c9516e5635687db011153ad00e07f5f478698a3a7bb3d6a883f91a35050565b606061158e61016b84846136c8565b6126f9614778565b6125c161016683612d5d565b600261012e5414156127295760405162461bcd60e51b8152600401610d4390615122565b600261012e5561128f816133a3565b600054610100900460ff1680612751575060005460ff16155b61276d5760405162461bcd60e51b8152600401610d43906150d4565b600054610100900460ff1615801561278f576000805461ffff19166101011790555b612797613d42565b61279f613dc5565b6127a7613e23565b6127af613e82565b6127ba600033612cd7565b6127e47f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e333612cd7565b61016080546001600160a01b0384166001600160b01b031990911617604b60a11b1763ffffffff60b01b1916627d004b60b21b17905580156113e5576000805461ff00191690555050565b600061283b8133612c73565b61017280546001600160a01b0319166001600160a01b03841690811790915560405190815233907fe8c4d4251ccaaa5d3e3937cf5c7c9d281260ff0b8bf5f914fb4dde280eee7dee9060200160405180910390a25050565b6000828152606560205260409020600101546128af8133612c73565b61104e838361319f565b60008382846040516020016128d093929190614f96565b60408051808303601f190181529181528151602092830120600081815261016590935291205490915060ff161561171357600081815261016360205260409020805461291b90611053565b5050505050565b60fb546040516371d4ed8d60e11b81526001600160a01b038381166004830152600092169063e3a9db1a9060240160206040518083038186803b15801561296857600080fd5b505afa15801561297c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6a9190614e0e565b61016054604051627eeac760e11b81526001600160a01b03838116600483015260026024830152600092839291169062fdd58e9060440160206040518083038186803b1580156129ef57600080fd5b505afa158015612a03573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a279190614e0e565b1180612aaf5750610173546040516370a0823160e01b81526001600160a01b03848116600483015260009216906370a082319060240160206040518083038186803b158015612a7557600080fd5b505afa158015612a89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612aad9190614e0e565b115b15612abc57506001919050565b610172546001600160a01b031615801590612b53575061017254604051630ef40a6760e41b81526001600160a01b038481166004830152600092169063ef40a6709060240160206040518083038186803b158015612b1957600080fd5b505afa158015612b2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b519190614e0e565b115b15612b6057506001919050565b506000919050565b6000610c6a6001600160a01b038316630dd472c160e21b613183565b612b8c6147f6565b604080516001808252818301909252600091816020015b612bab6147f6565b815260200190600190039081612ba357905050905081886003811115612be157634e487b7160e01b600052602160045260246000fd5b90816003811115612c0257634e487b7160e01b600052602160045260246000fd5b9052506001600160a01b0380881660208401528681166040840152851660608301526080820184905260a08201839052805182908290600090612c5557634e487b7160e01b600052603260045260246000fd5b6020026020010181905250612c6981613ceb565b5050505050505050565b612c7d8282612421565b6113e557612c95816001600160a01b03166014613ee1565b612ca0836020613ee1565b604051602001612cb1929190614f21565b60408051601f198184030181529082905262461bcd60e51b8252610d4391600401615009565b612ce18282612421565b6113e55760008281526065602090815260408083206001600160a01b03851684529091529020805460ff19166001179055612d193390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000818152600183016020908152604080832054835260028501909152812061158e565b600081815260048301602052604090205460ff16612d9d575050565b6000818152600280840160209081526040808420805485526001808801845282862086905586865260048089018552838720805460ff1916905586835582820187905594820180546001600160a01b031990811690915560038084018054909216909155948201869055600582018690556006820180546001600160a81b0319169055600782018690556008820186905560098201869055600a9091018590559286019091528220548454909291612e5491615208565b90506000846000018281548110612e7b57634e487b7160e01b600052603260045260246000fd5b600091825260208083209091015480835260038801909152604080832086905586835282209190915585549091508190869085908110612ecb57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001558454859080612ef657634e487b7160e01b600052603160045260246000fd5b600190038181906000526020600020016000905590555050505050565b600082815260048401602052604090205460ff161561300e5760008281526002848101602090815260408084208551808255868401516001808401919091558784015195830180546001600160a01b03199081166001600160a01b039889161790915560608901516003850180549092169088161790556080880151600484015560a0880151600584015560c088015160068401805460e08b0151929098166001600160a81b031990981697909717600160a01b911515919091021790955561010087015160078301556101208701516008830155610140870151600983015561016090960151600a90910155938352940190935290912055565b6000828152600484810160209081526040808420805460ff19166001908117909155600280890184528286208751815587850151818401558784015191810180546001600160a01b039384166001600160a01b031991821617909155606089015160038084018054928616929093169190911790915560808901519682019690965560a0880151600582015560c088015160068201805460e08b01511515600160a01b026001600160a81b0319909116929094169190911792909217909155610100870151600782015561012087015160088201556101408701516009820155610160870151600a9091015587549388018352818520849055838101885587855282852090930186905593518352940190935290912055565b60fb546040516351cff8d960e01b81526001600160a01b038381166004830152909116906351cff8d9906024015b600060405180830381600087803b15801561316f57600080fd5b505af115801561291b573d6000803e3d6000fd5b600061318e836140c3565b801561158e575061158e83836140f6565b6131a98282612421565b156113e55760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e36113e58133612c73565b6000613269613206565b90506132748461417f565b6000835111806132815750815b15613292576132908484614224565b505b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143805460ff1661291b57805460ff191660011781556040516001600160a01b038316602482015261331190869060440160408051601f198184030181529190526020810180516001600160e01b0316631b2ce7f360e11b179052614224565b50805460ff19168155613322613206565b6001600160a01b0316826001600160a01b03161461339a5760405162461bcd60e51b815260206004820152602f60248201527f45524331393637557067726164653a207570677261646520627265616b73206660448201526e75727468657220757067726164657360881b6064820152608401610d43565b61291b8561430f565b600081815261016260205260409020546133ec5760405162461bcd60e51b815260206004820152600a6024820152691a5b9d985b1a59081a5960b21b6044820152606401610d43565b60006133fa61016183612d5d565b604080516101808101825282548152600183015460208083019190915260028401546001600160a01b039081168385015260038501548116606084015260048501546080840152600585015460a0840152600685015490811660c0840152600160a01b900460ff16151560e0830152600784015461010083015260088401546101208301526009840154610140830152600a9093015461016082015260008581526101629093529120549091506134b0906111ec565b3360c08201524261012082015260408051602081018490526134ef910160408051601f1981840301815291905280516020909101206101669083612f13565b80608001513410156135365760405162461bcd60e51b815260206004820152601060248201526f6e6f7420656e6f7567682066756e647360801b6044820152606401610d43565b8060e00151156135615761355c6003826060015183604001513385602001516001612b84565b61357d565b61357d6002826060015183604001513385602001516001612b84565b610172546001600160a01b0316156136465760a08101516000906135a49060016002613bd9565b610172546040519192506000916001600160a01b039091169083908381818185875af1925050503d80600081146135f7576040519150601f19603f3d011682016040523d82523d6000602084013e6135fc565b606091505b50509050806136435760405162461bcd60e51b81526020600482015260136024820152721d1c985b9cd9995c881999594819985a5b1959606a1b6044820152606401610d43565b50505b6101608101511561366857613668816060015182602001518360800151613a6e565b61369981604001518261016001518360a00151846080015161368a9190615208565b6136949190615208565b613a12565b60405182907f92f64ca637d023f354075a4be751b169c1a8a9ccb6d33cdd0cb352054399572790600090a25050565b60606136d2845490565b61370f576040805160008082526020820190925290613707565b6136f4614778565b8152602001906001900390816136ec5790505b50905061158e565b60008261ffff1667ffffffffffffffff81111561373c57634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561377557816020015b613762614778565b81526020019060019003908161375a5790505b50905060008061ffff851661378a87826151e9565b6137949190615208565b90505b6137a58661ffff87166151e9565b8110156138ee57865481106137b9576138ee565b613800878860000183815481106137e057634e487b7160e01b600052603260045260246000fd5b906000526020600020015460009081526002919091016020526040902090565b6040805161018081018252825481526001830154602082015260028301546001600160a01b039081169282019290925260038301548216606082015260048301546080820152600583015460a0820152600683015491821660c0820152600160a01b90910460ff16151560e0820152600782015461010082015260088201546101208201526009820154610140820152600a909101546101608201528351849061ffff85169081106138c257634e487b7160e01b600052603260045260246000fd5b602002602001018190525081806138d890615262565b92505080806138e690615284565b915050613797565b509095945050505050565b804710156139495760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610d43565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114613996576040519150601f19603f3d011682016040523d82523d6000602084013e61399b565b606091505b505090508061104e5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610d43565b60fb5460405163f340fa0160e01b81526001600160a01b0384811660048301529091169063f340fa019083906024016000604051808303818588803b158015613a5a57600080fd5b505af1158015610df4573d6000803e3d6000fd5b613a7783612b68565b15613ba757604051635af67c8960e11b81526004810183905260009081906001600160a01b0386169063b5ecf9129060240160006040518083038186803b158015613ac157600080fd5b505afa158015613ad5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613afd9190810190614bde565b815191935091506000613b108583613d36565b905060005b82811015612c6957600080613b79878481518110613b4357634e487b7160e01b600052603260045260246000fd5b6020026020010151878581518110613b6b57634e487b7160e01b600052603260045260246000fd5b602002602001015186612239565b90925090506001600160a01b038216613b93575050613b15565b613b9d8282613a12565b5050600101613b15565b600080613bb5858585612239565b90925090506001600160a01b038216613bcf575050505050565b61291b8282613a12565b6000808211613c1d5760405162461bcd60e51b815260206004820152601060248201526f4469766973696f6e206279207a65726f60801b6044820152606401610d43565b83613c2a5750600061158e565b6000613c3684866151e9565b905083613c4386836151d5565b1415613c5b57613c5383826151d5565b91505061158e565b6000613c6784876151d5565b90506000613c75858861529f565b90506000613c8386886151d5565b90506000613c91878961529f565b9050613cde613caa88613ca4868561434f565b90613d36565b613cd8613cb7868661434f565b613cd8613cc4898761434f565b613cd88d613cd28c8b61434f565b9061434f565b9061435b565b9998505050505050505050565b805160005b8181101561104e576000838281518110613d1a57634e487b7160e01b600052603260045260246000fd5b60200260200101519050613d2d81614367565b50600101613cf0565b600061158e82846151d5565b600054610100900460ff1680613d5b575060005460ff16155b613d775760405162461bcd60e51b8152600401610d43906150d4565b600054610100900460ff16158015613d99576000805461ffff19166101011790555b613da1614562565b613da9614562565b613db1614562565b80156114af576000805461ff001916905550565b600054610100900460ff1680613dde575060005460ff16155b613dfa5760405162461bcd60e51b8152600401610d43906150d4565b600054610100900460ff16158015613da1576000805461ffff1916610101179055613da9614562565b600054610100900460ff1680613e3c575060005460ff16155b613e585760405162461bcd60e51b8152600401610d43906150d4565b600054610100900460ff16158015613e7a576000805461ffff19166101011790555b613db16145cc565b600054610100900460ff1680613e9b575060005460ff16155b613eb75760405162461bcd60e51b8152600401610d43906150d4565b600054610100900460ff16158015613ed9576000805461ffff19166101011790555b613db16146ce565b60606000613ef08360026151e9565b613efb9060026151bd565b67ffffffffffffffff811115613f2157634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015613f4b576020820181803683370190505b509050600360fc1b81600081518110613f7457634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110613fb157634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053506000613fd58460026151e9565b613fe09060016151bd565b90505b6001811115614074576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061402257634e487b7160e01b600052603260045260246000fd5b1a60f81b82828151811061404657634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c9361406d8161524b565b9050613fe3565b50831561158e5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610d43565b60006140d6826301ffc9a760e01b6140f6565b8015610c6a57506140ef826001600160e01b03196140f6565b1592915050565b604080516001600160e01b03198316602480830191909152825180830390910181526044909101909152602080820180516001600160e01b03166301ffc9a760e01b178152825160009392849283928392918391908a617530fa92503d91506000519050828015614168575060208210155b80156141745750600081115b979650505050505050565b803b6141e35760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610d43565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b0319166001600160a01b0392909216919091179055565b6060823b6142835760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610d43565b600080846001600160a01b03168460405161429e9190614f05565b600060405180830381855af49150503d80600081146142d9576040519150601f19603f3d011682016040523d82523d6000602084013e6142de565b606091505b50915091506143068282604051806060016040528060278152602001615ae26027913961473f565b95945050505050565b6143188161417f565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b600061158e82846151e9565b600061158e82846151bd565b60018151600381111561438a57634e487b7160e01b600052602160045260246000fd5b14156144225780602001516001600160a01b03166323b872dd826040015183606001518460a001516040518463ffffffff1660e01b81526004016143d093929190614f96565b602060405180830381600087803b1580156143ea57600080fd5b505af11580156143fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113e59190614ce4565b60028151600381111561444557634e487b7160e01b600052602160045260246000fd5b14156144b0578060a001516001146144705760405163efcc00b160e01b815260040160405180910390fd5b80602001516001600160a01b03166323b872dd8260400151836060015184608001516040518463ffffffff1660e01b815260040161315593929190614f96565b6003815160038111156144d357634e487b7160e01b600052602160045260246000fd5b14156145495760208101516040808301516060840151608085015160a0808701519451637921219560e11b81526001600160a01b0394851660048201529284166024840152604483019190915260648201939093526084810192909252600060a48301529091169063f242432a9060c401613155565b604051631e4cbc7f60e21b815260040160405180910390fd5b600054610100900460ff168061457b575060005460ff16155b6145975760405162461bcd60e51b8152600401610d43906150d4565b600054610100900460ff16158015613db1576000805461ffff191661010117905580156114af576000805461ff001916905550565b600054610100900460ff16806145e5575060005460ff16155b6146015760405162461bcd60e51b8152600401610d43906150d4565b600054610100900460ff16158015614623576000805461ffff19166101011790555b60405161462f9061482d565b604051809103906000f08015801561464b573d6000803e3d6000fd5b5060fb80546001600160a01b0319166001600160a01b039290921691821790556040805163204a7f0760e21b81529051638129fc1c9160048082019260009290919082900301818387803b1580156146a257600080fd5b505af11580156146b6573d6000803e3d6000fd5b5050505080156114af576000805461ff001916905550565b600054610100900460ff16806146e7575060005460ff16155b6147035760405162461bcd60e51b8152600401610d43906150d4565b600054610100900460ff16158015614725576000805461ffff19166101011790555b600161012e5580156114af576000805461ff001916905550565b6060831561474e57508161158e565b82511561475e5782518084602001fd5b8160405162461bcd60e51b8152600401610d439190615009565b604051806101800160405280600081526020016000815260200160006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160006001600160a01b03168152602001600015158152602001600081526020016000815260200160008152602001600081525090565b6040805160c08101909152806000815260006020820181905260408201819052606082018190526080820181905260a09091015290565b6107b78061530b83390190565b60008083601f84011261484b578182fd5b50813567ffffffffffffffff811115614862578182fd5b6020830191508360208260051b850101111561487d57600080fd5b9250929050565b600082601f830112614894578081fd5b815160206148a96148a483615199565b615168565b80838252828201915082860187848660051b89010111156148c8578586fd5b855b858110156148e6578151845292840192908401906001016148ca565b5090979650505050505050565b803561ffff811681146118f357600080fd5b600060208284031215614916578081fd5b813561158e816152f5565b600060208284031215614932578081fd5b815161158e816152f5565b600080600060608486031215614951578182fd5b833561495c816152f5565b9250602084013561496c816152f5565b915061497a604085016148f3565b90509250925092565b60008060408385031215614995578182fd5b82356149a0816152f5565b915060208381013567ffffffffffffffff808211156149bd578384fd5b818601915086601f8301126149d0578384fd5b8135818111156149e2576149e26152df565b6149f4601f8201601f19168501615168565b91508082528784828501011115614a09578485fd5b8084840185840137810190920192909252919491935090915050565b60008060408385031215614a37578182fd5b8251614a42816152f5565b6020939093015192949293505050565b600080600060608486031215614a66578283fd5b8335614a71816152f5565b9250602084013591506040840135614a88816152f5565b809150509250925092565b600080600060608486031215614aa7578081fd5b8335614ab2816152f5565b95602085013595506040909401359392505050565b600080600080600060608688031215614ade578283fd5b853567ffffffffffffffff80821115614af5578485fd5b614b0189838a0161483a565b90975095506020880135915080821115614b19578485fd5b50614b268882890161483a565b9094509250506040860135614b3a816152f5565b809150509295509295909350565b60008060008060008060608789031215614b60578384fd5b863567ffffffffffffffff80821115614b77578586fd5b614b838a838b0161483a565b90985096506020890135915080821115614b9b578586fd5b614ba78a838b0161483a565b90965094506040890135915080821115614bbf578283fd5b50614bcc89828a0161483a565b979a9699509497509295939492505050565b60008060408385031215614bf0578182fd5b825167ffffffffffffffff80821115614c07578384fd5b818501915085601f830112614c1a578384fd5b81516020614c2a6148a483615199565b8083825282820191508286018a848660051b8901011115614c49578889fd5b8896505b84871015614c74578051614c60816152f5565b835260019690960195918301918301614c4d565b5091880151919650909350505080821115614c8d578283fd5b50614c9a85828601614884565b9150509250929050565b60008060208385031215614cb6578182fd5b823567ffffffffffffffff811115614ccc578283fd5b614cd88582860161483a565b90969095509350505050565b600060208284031215614cf5578081fd5b8151801515811461158e578182fd5b600060208284031215614d15578081fd5b5035919050565b60008060408385031215614d2e578182fd5b823591506020830135614d40816152f5565b809150509250929050565b600060208284031215614d5c578081fd5b81356001600160e01b03198116811461158e578182fd5b60008060008060008060c08789031215614d8b578384fd5b863560048110614d99578485fd5b95506020870135614da9816152f5565b94506040870135614db9816152f5565b93506060870135614dc9816152f5565b9598949750929560808101359460a0909101359350915050565b600080600060608486031215614df7578081fd5b614e00846148f3565b925061496c602085016148f3565b600060208284031215614e1f578081fd5b5051919050565b60008060408385031215614e38578182fd5b82359150614e48602084016148f3565b90509250929050565b80518252602081015160208301526040810151614e7960408401826001600160a01b03169052565b506060810151614e9460608401826001600160a01b03169052565b506080810151608083015260a081015160a083015260c0810151614ec360c08401826001600160a01b03169052565b5060e0810151614ed760e084018215159052565b5061010081810151908301526101208082015190830152610140808201519083015261016090810151910152565b60008251614f1781846020870161521f565b9190910192915050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351614f5981601785016020880161521f565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351614f8a81602884016020880161521f565b01602801949350505050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6020808252825182820181905260009190848201906040850190845b81811015614ffd57614fe9838551614e51565b928401926101809290920191600101614fd6565b50909695505050505050565b602081526000825180602084015261502881604085016020870161521f565b601f01601f19169190910160400192915050565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6101808101610c6a8284614e51565b604051601f8201601f1916810167ffffffffffffffff81118282101715615191576151916152df565b604052919050565b600067ffffffffffffffff8211156151b3576151b36152df565b5060051b60200190565b600082198211156151d0576151d06152b3565b500190565b6000826151e4576151e46152c9565b500490565b6000816000190483118215151615615203576152036152b3565b500290565b60008282101561521a5761521a6152b3565b500390565b60005b8381101561523a578181015183820152602001615222565b838111156117135750506000910152565b60008161525a5761525a6152b3565b506000190190565b600061ffff8083168181141561527a5761527a6152b3565b6001019392505050565b6000600019821415615298576152986152b3565b5060010190565b6000826152ae576152ae6152c9565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146114af57600080fdfe608060405234801561001057600080fd5b50610797806100206000396000f3fe6080604052600436106100705760003560e01c80638da5cb5b1161004e5780638da5cb5b146100c1578063e3a9db1a146100ee578063f2fde38b14610132578063f340fa011461015257600080fd5b806351cff8d914610075578063715018a6146100975780638129fc1c146100ac575b600080fd5b34801561008157600080fd5b50610095610090366004610682565b610165565b005b3480156100a357600080fd5b50610095610207565b3480156100b857600080fd5b5061009561023d565b3480156100cd57600080fd5b506033546040516001600160a01b0390911681526020015b60405180910390f35b3480156100fa57600080fd5b50610124610109366004610682565b6001600160a01b031660009081526065602052604090205490565b6040519081526020016100e5565b34801561013e57600080fd5b5061009561014d366004610682565b6102b1565b610095610160366004610682565b610349565b6033546001600160a01b031633146101985760405162461bcd60e51b815260040161018f906106f3565b60405180910390fd5b6001600160a01b03811660008181526065602052604081208054919055906101c090826103dd565b816001600160a01b03167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5826040516101fb91815260200190565b60405180910390a25050565b6033546001600160a01b031633146102315760405162461bcd60e51b815260040161018f906106f3565b61023b60006104fb565b565b600054610100900460ff1680610256575060005460ff16155b6102725760405162461bcd60e51b815260040161018f906106a5565b600054610100900460ff16158015610294576000805461ffff19166101011790555b61029c61054d565b80156102ae576000805461ff00191690555b50565b6033546001600160a01b031633146102db5760405162461bcd60e51b815260040161018f906106f3565b6001600160a01b0381166103405760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161018f565b6102ae816104fb565b6033546001600160a01b031633146103735760405162461bcd60e51b815260040161018f906106f3565b6001600160a01b03811660009081526065602052604081208054349283929161039d908490610728565b90915550506040518181526001600160a01b038316907f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c4906020016101fb565b8047101561042d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015260640161018f565b6000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461047a576040519150601f19603f3d011682016040523d82523d6000602084013e61047f565b606091505b50509050806104f65760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d61792068617665207265766572746564000000000000606482015260840161018f565b505050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff1680610566575060005460ff16155b6105825760405162461bcd60e51b815260040161018f906106a5565b600054610100900460ff161580156105a4576000805461ffff19166101011790555b6105ac6105b8565b6105b4610622565b61029c5b600054610100900460ff16806105d1575060005460ff16155b6105ed5760405162461bcd60e51b815260040161018f906106a5565b600054610100900460ff1615801561029c576000805461ffff191661010117905580156102ae576000805461ff001916905550565b600054610100900460ff168061063b575060005460ff16155b6106575760405162461bcd60e51b815260040161018f906106a5565b600054610100900460ff16158015610679576000805461ffff19166101011790555b61029c336104fb565b600060208284031215610693578081fd5b813561069e8161074c565b9392505050565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000821982111561074757634e487b7160e01b81526011600452602481fd5b500190565b6001600160a01b03811681146102ae57600080fdfea2646970667358221220c6106604f82bafcd7b8430b0041b8c5862364ea5b3f232a4c1a0423621d34b6964736f6c634300080400335620a1113a72b02a617976b3f6b15600dd7a8b3a916a9ca01e23119d989a0543416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220af8db59b587bc6166cf439fd1335ff3a7f19a779e87a488213a1f11fbd7aa66064736f6c63430008040033

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.