Mumbai Testnet

Contract

0x2937e2476f6D32D964FF9FA6d97f2438D798B8d0

Overview

MATIC Balance

Polygon PoS Chain LogoPolygon PoS Chain LogoPolygon PoS Chain Logo0 MATIC

Multichain Info

N/A
Transaction Hash
Method
Block
From
To
Value
Atomic Match_296351332022-12-13 6:04:11472 days ago1670911451IN
0x2937e247...8D798B8d0
0.00102 MATIC0.000382251.5
Atomic Match_296343462022-12-13 4:58:24472 days ago1670907504IN
0x2937e247...8D798B8d0
0.0204 MATIC0.000598861.5
Atomic Match_296343362022-12-13 4:57:34472 days ago1670907454IN
0x2937e247...8D798B8d0
0.0306 MATIC0.000650121.5
Cancel Order_296340462022-12-13 4:33:19472 days ago1670905999IN
0x2937e247...8D798B8d0
0 MATIC0.000108731.5
Atomic Match_296340332022-12-13 4:32:14472 days ago1670905934IN
0x2937e247...8D798B8d0
0.204 MATIC0.000581181.5
Atomic Match_295684022022-12-09 9:05:54476 days ago1670576754IN
0x2937e247...8D798B8d0
0.051 MATIC0.000622931.607872
Atomic Match_293292942022-11-25 11:20:11489 days ago1669375211IN
0x2937e247...8D798B8d0
0.0000102 MATIC0.0137571531.0497
Atomic Match_292937542022-11-23 9:10:09492 days ago1669194609IN
0x2937e247...8D798B8d0
0.00000102 MATIC0.000638881.50000001
Atomic Match_292936142022-11-23 8:58:27492 days ago1669193907IN
0x2937e247...8D798B8d0
0.000102 MATIC0.000664531.50000001
Cancel Order_291835442022-11-16 14:01:00498 days ago1668607260IN
0x2937e247...8D798B8d0
0 MATIC0.000108731.50000001
Atomic Match_291809962022-11-16 10:28:01498 days ago1668594481IN
0x2937e247...8D798B8d0
0.102 MATIC0.000581181.50000001
Cancel Order_291809872022-11-16 10:27:15498 days ago1668594435IN
0x2937e247...8D798B8d0
0 MATIC0.00010871.5
Atomic Match_291794792022-11-16 8:21:12499 days ago1668586872IN
0x2937e247...8D798B8d0
0.102 MATIC0.000581181.50000001
Cancel Order_291794382022-11-16 8:17:46499 days ago1668586666IN
0x2937e247...8D798B8d0
0 MATIC0.000108731.50000001
Atomic Match_291785592022-11-16 7:04:17499 days ago1668582257IN
0x2937e247...8D798B8d0
0.102 MATIC0.000606831.50000001
Atomic Match_291768382022-11-16 4:40:26499 days ago1668573626IN
0x2937e247...8D798B8d0
0.102 MATIC0.000606831.50000001
Atomic Match_291747152022-11-16 1:42:57499 days ago1668562977IN
0x2937e247...8D798B8d0
0.0102 MATIC0.000584891.5
Atomic Match_291745522022-11-16 1:29:20499 days ago1668562160IN
0x2937e247...8D798B8d0
0.0051 MATIC0.000951142.14683507
Cancel Order_291638772022-11-15 10:36:58499 days ago1668508618IN
0x2937e247...8D798B8d0
0 MATIC0.000110351.52258333
Atomic Match_291632502022-11-15 9:44:33500 days ago1668505473IN
0x2937e247...8D798B8d0
0.00102 MATIC0.000314371.50000001
Atomic Match_291632092022-11-15 9:41:08500 days ago1668505268IN
0x2937e247...8D798B8d0
0.00102 MATIC0.000496151.50000001
Cancel Order_291622032022-11-15 8:17:02500 days ago1668500222IN
0x2937e247...8D798B8d0
0 MATIC0.000108731.50000127
Atomic Match_291574782022-11-15 1:42:03500 days ago1668476523IN
0x2937e247...8D798B8d0
0.0102 MATIC0.000606761.5
Atomic Match_291417672022-11-14 3:48:43501 days ago1668397723IN
0x2937e247...8D798B8d0
0.102 MATIC0.000610611.5
Atomic Match_291415242022-11-14 3:28:24501 days ago1668396504IN
0x2937e247...8D798B8d0
0.0102 MATIC0.000610471.5
View all transactions

Latest 25 internal transactions (View All)

Parent Txn Hash Block From To Value
296351332022-12-13 6:04:11472 days ago1670911451
0x2937e247...8D798B8d0
0.00098 MATIC
296351332022-12-13 6:04:11472 days ago1670911451
0x2937e247...8D798B8d0
0.00002 MATIC
296351332022-12-13 6:04:11472 days ago1670911451
0x2937e247...8D798B8d0
0.00002 MATIC
296343462022-12-13 4:58:24472 days ago1670907504
0x2937e247...8D798B8d0
0.0196 MATIC
296343462022-12-13 4:58:24472 days ago1670907504
0x2937e247...8D798B8d0
0.0004 MATIC
296343462022-12-13 4:58:24472 days ago1670907504
0x2937e247...8D798B8d0
0.0004 MATIC
296343362022-12-13 4:57:34472 days ago1670907454
0x2937e247...8D798B8d0
0.0294 MATIC
296343362022-12-13 4:57:34472 days ago1670907454
0x2937e247...8D798B8d0
0.0006 MATIC
296343362022-12-13 4:57:34472 days ago1670907454
0x2937e247...8D798B8d0
0.0006 MATIC
296340332022-12-13 4:32:14472 days ago1670905934
0x2937e247...8D798B8d0
0.196 MATIC
296340332022-12-13 4:32:14472 days ago1670905934
0x2937e247...8D798B8d0
0.004 MATIC
296340332022-12-13 4:32:14472 days ago1670905934
0x2937e247...8D798B8d0
0.004 MATIC
295684022022-12-09 9:05:54476 days ago1670576754
0x2937e247...8D798B8d0
0.049 MATIC
295684022022-12-09 9:05:54476 days ago1670576754
0x2937e247...8D798B8d0
0.001 MATIC
295684022022-12-09 9:05:54476 days ago1670576754
0x2937e247...8D798B8d0
0.001 MATIC
293292942022-11-25 11:20:11489 days ago1669375211
0x2937e247...8D798B8d0
0.0000088 MATIC
293292942022-11-25 11:20:11489 days ago1669375211
0x2937e247...8D798B8d0
0.000001 MATIC
293292942022-11-25 11:20:11489 days ago1669375211
0x2937e247...8D798B8d0
0.0000002 MATIC
293292942022-11-25 11:20:11489 days ago1669375211
0x2937e247...8D798B8d0
0.0000002 MATIC
292937542022-11-23 9:10:09492 days ago1669194609
0x2937e247...8D798B8d0
0.00000088 MATIC
292937542022-11-23 9:10:09492 days ago1669194609
0x2937e247...8D798B8d0
0.0000001 MATIC
292937542022-11-23 9:10:09492 days ago1669194609
0x2937e247...8D798B8d0
0.00000002 MATIC
292937542022-11-23 9:10:09492 days ago1669194609
0x2937e247...8D798B8d0
0.00000002 MATIC
292936142022-11-23 8:58:27492 days ago1669193907
0x2937e247...8D798B8d0
0.000088 MATIC
292936142022-11-23 8:58:27492 days ago1669193907
0x2937e247...8D798B8d0
0.00001 MATIC
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
PlaygroundExchange

Compiler Version
v0.7.5+commit.eb77ed08

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 25 : PlaygroundExchange.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.7.5;

import "./exchange/Exchange.sol";
import "./registry/ProxyRegistry.sol";
import "./modules/PlaygroundTransferProxy.sol";
import "./royalties/RoyaltyFeeRegistry.sol";

contract PlaygroundExchange is Exchange {
    string public constant name = "Playground Exchange";

    /**
     * @dev Initialize a WyvernExchange instance
     * @param registryAddress Address of the registry instance which this Exchange instance will use
     */
    constructor(
        ProxyRegistry registryAddress,
        PlaygroundTransferProxy tokenTransferProxyAddress,
        RoyaltyFeeRegistry royaltyFeeRegistryAddress
    ) {
        royaltyFeeRegistry = royaltyFeeRegistryAddress;
        registry = registryAddress;
        tokenTransferProxy = tokenTransferProxyAddress;
    }
}

File 2 of 25 : Exchange.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.7.5;
pragma abicoder v2;

import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "../libraries/ArrayUtils.sol";
import "../libraries/SaleKindInterface.sol";
import "../libraries/ReentrancyGuarded.sol";
import "../registry/ProxyRegistry.sol";
import "../modules/PlaygroundTransferProxy.sol";
import "../registry/AuthenticatedProxy.sol";
import "./ExchangeMain.sol";

contract Exchange is ExchangeMain {
    /**
     * @dev Call calculateFinalPrice - library function exposed for testing.
     */
    function calculateFinalPrice(
        SaleKindInterface.Side side,
        SaleKindInterface.SaleKind saleKind,
        uint256 basePrice,
        uint256 extra,
        uint256 listingTime,
        uint256 expirationTime,
        uint256 amount
    ) public view returns (uint256) {
        return
            SaleKindInterface.calculateFinalPrice(
                side,
                saleKind,
                basePrice,
                extra,
                listingTime,
                expirationTime,
                amount
            );
    }

    /**
     * @dev Call hashOrder - Solidity ABI encoding limitation workaround, hopefully temporary.
     */
    function hashOrder_(
        address[7] memory addrs,
        uint256[7] memory uints,
        FeeMethod feeMethod,
        SaleKindInterface.Side side,
        SaleKindInterface.SaleKind saleKind,
        AuthenticatedProxy.HowToCall howToCall,
        bytes memory callData,
        bytes memory replacementPattern,
        bytes memory staticExtradata
    ) public pure returns (bytes32) {
        return
            hashOrder(
                Order(
                    addrs[0],
                    addrs[1],
                    addrs[2],
                    uints[0],
                    uints[1],
                    addrs[3],
                    feeMethod,
                    side,
                    saleKind,
                    addrs[4],
                    howToCall,
                    callData,
                    replacementPattern,
                    addrs[5],
                    staticExtradata,
                    addrs[6],
                    uints[2],
                    uints[3],
                    uints[4],
                    uints[5],
                    uints[6]
                )
            );
    }

    /**
     * @dev Call hashToSign - Solidity ABI encoding limitation workaround, hopefully temporary.
     */
    function hashToSign_(
        address[7] memory addrs,
        uint256[7] memory uints,
        FeeMethod feeMethod,
        SaleKindInterface.Side side,
        SaleKindInterface.SaleKind saleKind,
        AuthenticatedProxy.HowToCall howToCall,
        bytes memory callData,
        bytes memory replacementPattern,
        bytes memory staticExtradata
    ) public pure returns (bytes32) {
        return
            hashToSign(
                Order(
                    addrs[0],
                    addrs[1],
                    addrs[2],
                    uints[0],
                    uints[1],
                    addrs[3],
                    feeMethod,
                    side,
                    saleKind,
                    addrs[4],
                    howToCall,
                    callData,
                    replacementPattern,
                    addrs[5],
                    staticExtradata,
                    addrs[6],
                    uints[2],
                    uints[3],
                    uints[4],
                    uints[5],
                    uints[6]
                )
            );
    }

    /**
     * @dev Call validateOrderParameters - Solidity ABI encoding limitation workaround, hopefully temporary.
     */
    function validateOrderParameters_(
        address[7] memory addrs,
        uint256[7] memory uints,
        FeeMethod feeMethod,
        SaleKindInterface.Side side,
        SaleKindInterface.SaleKind saleKind,
        AuthenticatedProxy.HowToCall howToCall,
        bytes memory callData,
        bytes memory replacementPattern,
        bytes memory staticExtradata
    ) public view returns (bool) {
        Order memory order = Order(
            addrs[0],
            addrs[1],
            addrs[2],
            uints[0],
            uints[1],
            addrs[3],
            feeMethod,
            side,
            saleKind,
            addrs[4],
            howToCall,
            callData,
            replacementPattern,
            addrs[5],
            staticExtradata,
            addrs[6],
            uints[2],
            uints[3],
            uints[4],
            uints[5],
            uints[6]
        );
        return validateOrderParameters(order);
    }

    /**
     * @dev Call validateOrder - Solidity ABI encoding limitation workaround, hopefully temporary.
     */
    function validateOrder_(
        address[7] memory addrs,
        uint256[7] memory uints,
        FeeMethod feeMethod,
        SaleKindInterface.Side side,
        SaleKindInterface.SaleKind saleKind,
        AuthenticatedProxy.HowToCall howToCall,
        bytes memory callData,
        bytes memory replacementPattern,
        bytes memory staticExtradata,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public view returns (bool) {
        Order memory order = Order(
            addrs[0],
            addrs[1],
            addrs[2],
            uints[0],
            uints[1],
            addrs[3],
            feeMethod,
            side,
            saleKind,
            addrs[4],
            howToCall,
            callData,
            replacementPattern,
            addrs[5],
            staticExtradata,
            addrs[6],
            uints[2],
            uints[3],
            uints[4],
            uints[5],
            uints[6]
        );
        return validateOrder(hashToSign(order), order, Sig(v, r, s));
    }

    /**
     * @dev Call approveOrder - Solidity ABI encoding limitation workaround, hopefully temporary.
     */
    function approveOrder_(
        address[7] memory addrs,
        uint256[7] memory uints,
        FeeMethod feeMethod,
        SaleKindInterface.Side side,
        SaleKindInterface.SaleKind saleKind,
        AuthenticatedProxy.HowToCall howToCall,
        bytes memory callData,
        bytes memory replacementPattern,
        bytes memory staticExtradata,
        bool orderbookInclusionDesired
    ) public {
        Order memory order = Order(
            addrs[0],
            addrs[1],
            addrs[2],
            uints[0],
            uints[1],
            addrs[3],
            feeMethod,
            side,
            saleKind,
            addrs[4],
            howToCall,
            callData,
            replacementPattern,
            addrs[5],
            staticExtradata,
            addrs[6],
            uints[2],
            uints[3],
            uints[4],
            uints[5],
            uints[6]
        );
        return approveOrder(order, orderbookInclusionDesired);
    }

    /**
     * @dev Call cancelOrder - Solidity ABI encoding limitation workaround, hopefully temporary.
     */
    function cancelOrder_(
        address[7] memory addrs,
        uint256[7] memory uints,
        FeeMethod feeMethod,
        SaleKindInterface.Side side,
        SaleKindInterface.SaleKind saleKind,
        AuthenticatedProxy.HowToCall howToCall,
        bytes memory callData,
        bytes memory replacementPattern,
        bytes memory staticExtradata,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public {
        return
            cancelOrder(
                Order(
                    addrs[0],
                    addrs[1],
                    addrs[2],
                    uints[0],
                    uints[1],
                    addrs[3],
                    feeMethod,
                    side,
                    saleKind,
                    addrs[4],
                    howToCall,
                    callData,
                    replacementPattern,
                    addrs[5],
                    staticExtradata,
                    addrs[6],
                    uints[2],
                    uints[3],
                    uints[4],
                    uints[5],
                    uints[6]
                ),
                Sig(v, r, s)
            );
    }

    /**
     * @dev Call calculateCurrentPrice - Solidity ABI encoding limitation workaround, hopefully temporary.
     */
    function calculateCurrentPrice_(
        address[7] memory addrs,
        uint256[7] memory uints,
        FeeMethod feeMethod,
        SaleKindInterface.Side side,
        SaleKindInterface.SaleKind saleKind,
        AuthenticatedProxy.HowToCall howToCall,
        bytes memory callData,
        bytes memory replacementPattern,
        bytes memory staticExtradata,
        uint256 amount
    ) public view returns (uint256) {
        return
            calculateCurrentPrice(
                Order(
                    addrs[0],
                    addrs[1],
                    addrs[2],
                    uints[0],
                    uints[1],
                    addrs[3],
                    feeMethod,
                    side,
                    saleKind,
                    addrs[4],
                    howToCall,
                    callData,
                    replacementPattern,
                    addrs[5],
                    staticExtradata,
                    addrs[6],
                    uints[2],
                    uints[3],
                    uints[4],
                    uints[5],
                    uints[6]
                ),
                amount
            );
    }

    /**
     * @dev Call ordersCanMatch - Solidity ABI encoding limitation workaround, hopefully temporary.
     */
    function ordersCanMatch_(
        address[14] memory addrs,
        uint256[14] memory uints,
        uint8[8] memory feeMethodsSidesKindsHowToCalls,
        bytes memory calldataBuy,
        bytes memory calldataSell,
        bytes memory replacementPatternBuy,
        bytes memory replacementPatternSell,
        bytes memory staticExtradataBuy,
        bytes memory staticExtradataSell
    ) public view returns (bool) {
        Order memory buy = Order(
            addrs[0],
            addrs[1],
            addrs[2],
            uints[0],
            uints[1],
            addrs[3],
            FeeMethod(feeMethodsSidesKindsHowToCalls[0]),
            SaleKindInterface.Side(feeMethodsSidesKindsHowToCalls[1]),
            SaleKindInterface.SaleKind(feeMethodsSidesKindsHowToCalls[2]),
            addrs[4],
            AuthenticatedProxy.HowToCall(feeMethodsSidesKindsHowToCalls[3]),
            calldataBuy,
            replacementPatternBuy,
            addrs[5],
            staticExtradataBuy,
            addrs[6],
            uints[2],
            uints[3],
            uints[4],
            uints[5],
            uints[6]
        );
        Order memory sell = Order(
            addrs[7],
            addrs[8],
            addrs[9],
            uints[7],
            uints[8],
            addrs[10],
            FeeMethod(feeMethodsSidesKindsHowToCalls[4]),
            SaleKindInterface.Side(feeMethodsSidesKindsHowToCalls[5]),
            SaleKindInterface.SaleKind(feeMethodsSidesKindsHowToCalls[6]),
            addrs[11],
            AuthenticatedProxy.HowToCall(feeMethodsSidesKindsHowToCalls[7]),
            calldataSell,
            replacementPatternSell,
            addrs[12],
            staticExtradataSell,
            addrs[13],
            uints[9],
            uints[10],
            uints[11],
            uints[12],
            uints[13]
        );
        return ordersCanMatch(buy, sell);
    }

    // /**
    //  * @dev Return whether or not two orders' calldata specifications can match
    //  * @param buyCalldata Buy-side order calldata
    //  * @param buyReplacementPattern Buy-side order calldata replacement mask
    //  * @param sellCalldata Sell-side order calldata
    //  * @param sellReplacementPattern Sell-side order calldata replacement mask
    //  * @return Whether the orders' calldata can be matched
    //  */
    // function orderCalldataCanMatch(
    //     bytes memory buyCalldata,
    //     bytes memory buyReplacementPattern,
    //     bytes memory sellCalldata,
    //     bytes memory sellReplacementPattern
    // ) public pure returns (bool) {
    //     if (buyReplacementPattern.length > 0) {
    //         ArrayUtils.guardedArrayReplace(
    //             buyCalldata,
    //             sellCalldata,
    //             buyReplacementPattern
    //         );
    //     }
    //     if (sellReplacementPattern.length > 0) {
    //         ArrayUtils.guardedArrayReplace(
    //             sellCalldata,
    //             buyCalldata,
    //             sellReplacementPattern
    //         );
    //     }
    //     return ArrayUtils.arrayEq(buyCalldata, sellCalldata);
    // }

    /**
     * @dev Call calculateMatchPrice - Solidity ABI encoding limitation workaround, hopefully temporary.
     */
    function calculateMatchPrice_(
        address[14] memory addrs,
        uint256[14] memory uints,
        uint8[8] memory feeMethodsSidesKindsHowToCalls,
        bytes memory calldataBuy,
        bytes memory calldataSell,
        bytes memory replacementPatternBuy,
        bytes memory replacementPatternSell,
        bytes memory staticExtradataBuy,
        bytes memory staticExtradataSell,
        uint256 amount
    ) public view returns (uint256) {
        Order memory buy = Order(
            addrs[0],
            addrs[1],
            addrs[2],
            uints[0],
            uints[1],
            addrs[3],
            FeeMethod(feeMethodsSidesKindsHowToCalls[0]),
            SaleKindInterface.Side(feeMethodsSidesKindsHowToCalls[1]),
            SaleKindInterface.SaleKind(feeMethodsSidesKindsHowToCalls[2]),
            addrs[4],
            AuthenticatedProxy.HowToCall(feeMethodsSidesKindsHowToCalls[3]),
            calldataBuy,
            replacementPatternBuy,
            addrs[5],
            staticExtradataBuy,
            addrs[6],
            uints[2],
            uints[3],
            uints[4],
            uints[5],
            uints[6]
        );
        Order memory sell = Order(
            addrs[7],
            addrs[8],
            addrs[9],
            uints[7],
            uints[8],
            addrs[10],
            FeeMethod(feeMethodsSidesKindsHowToCalls[4]),
            SaleKindInterface.Side(feeMethodsSidesKindsHowToCalls[5]),
            SaleKindInterface.SaleKind(feeMethodsSidesKindsHowToCalls[6]),
            addrs[11],
            AuthenticatedProxy.HowToCall(feeMethodsSidesKindsHowToCalls[7]),
            calldataSell,
            replacementPatternSell,
            addrs[12],
            staticExtradataSell,
            addrs[13],
            uints[9],
            uints[10],
            uints[11],
            uints[12],
            uints[13]
        );
        return calculateMatchPrice(buy, sell, amount);
    }

    /**
     * @dev Call atomicMatch - Solidity ABI encoding limitation workaround, hopefully temporary.
     */
    function atomicMatch_(
        address[14] memory addrs,
        uint256[14] memory uints,
        uint8[8] memory feeMethodsSidesKindsHowToCalls,
        bytes memory calldataBuy,
        bytes memory calldataSell,
        bytes memory replacementPatternBuy,
        bytes memory replacementPatternSell,
        bytes memory staticExtradataBuy,
        bytes memory staticExtradataSell,
        uint8[2] memory vs,
        bytes32[5] memory rssMetadata
    ) public payable {
        return
            atomicMatch(
                Order(
                    addrs[0],
                    addrs[1],
                    addrs[2],
                    uints[0],
                    uints[1],
                    addrs[3],
                    FeeMethod(feeMethodsSidesKindsHowToCalls[0]),
                    SaleKindInterface.Side(feeMethodsSidesKindsHowToCalls[1]),
                    SaleKindInterface.SaleKind(
                        feeMethodsSidesKindsHowToCalls[2]
                    ),
                    addrs[4],
                    AuthenticatedProxy.HowToCall(
                        feeMethodsSidesKindsHowToCalls[3]
                    ),
                    calldataBuy,
                    replacementPatternBuy,
                    addrs[5],
                    staticExtradataBuy,
                    addrs[6],
                    uints[2],
                    uints[3],
                    uints[4],
                    uints[5],
                    uints[6]
                ),
                Sig(vs[0], rssMetadata[0], rssMetadata[1]),
                Order(
                    addrs[7],
                    addrs[8],
                    addrs[9],
                    uints[7],
                    uints[8],
                    addrs[10],
                    FeeMethod(feeMethodsSidesKindsHowToCalls[4]),
                    SaleKindInterface.Side(feeMethodsSidesKindsHowToCalls[5]),
                    SaleKindInterface.SaleKind(
                        feeMethodsSidesKindsHowToCalls[6]
                    ),
                    addrs[11],
                    AuthenticatedProxy.HowToCall(
                        feeMethodsSidesKindsHowToCalls[7]
                    ),
                    calldataSell,
                    replacementPatternSell,
                    addrs[12],
                    staticExtradataSell,
                    addrs[13],
                    uints[9],
                    uints[10],
                    uints[11],
                    uints[12],
                    uints[13]
                ),
                Sig(vs[1], rssMetadata[2], rssMetadata[3]),
                rssMetadata[4]
            );
    }
}

File 3 of 25 : ProxyRegistry.sol
/*

  Proxy registry; keeps a mapping of AuthenticatedProxy contracts and mapping of contracts authorized to access them.  
  
  Abstracted away from the Exchange (a) to reduce Exchange attack surface and (b) so that the Exchange contract can be upgraded without users needing to transfer assets to new proxies.

*/
// SPDX-License-Identifier: MIT
pragma solidity 0.7.5;

import "@openzeppelin/contracts/access/Ownable.sol";

import "./OwnableDelegateProxy.sol";
import "./ProxyRegistryInterface.sol";

/**
 * @title ProxyRegistry
 * @author Wyvern Protocol Developers
 */
contract ProxyRegistry is Ownable, ProxyRegistryInterface {
    /* DelegateProxy implementation contract. Must be initialized. */
    address public override delegateProxyImplementation;

    /* Authenticated proxies by user. */
    mapping(address => OwnableDelegateProxy) public override proxies;

    /* Contracts pending access. */
    mapping(address => uint256) public pending;

    /* Contracts allowed to call those proxies. */
    mapping(address => bool) public contracts;

    /* Delay period for adding an authenticated contract.
       This mitigates a particular class of potential attack on the Wyvern DAO (which owns this registry) - if at any point the value of assets held by proxy contracts exceeded the value of half the WYV supply (votes in the DAO),
       a malicious but rational attacker could buy half the Wyvern and grant themselves access to all the proxy contracts. A delay period renders this attack nonthreatening - given two weeks, if that happened, users would have
       plenty of time to notice and transfer their assets.
    */
    uint256 public delayPeriod;

    function setDelayPeriod(uint256 _delayPeriod) external onlyOwner {
        delayPeriod = _delayPeriod;
    }

    /**
     * Start the process to enable access for specified contract. Subject to delay period.
     *
     * @dev ProxyRegistry owner only
     * @param addr Address to which to grant permissions
     */
    function startGrantAuthentication(address addr) public onlyOwner {
        require(
            !contracts[addr] && pending[addr] == 0,
            "Contract is already allowed in registry, or pending"
        );
        pending[addr] = block.timestamp;
    }

    /**
     * End the process to enable access for specified contract after delay period has passed.
     *
     * @dev ProxyRegistry owner only
     * @param addr Address to which to grant permissions
     */
    function endGrantAuthentication(address addr) public onlyOwner {
        require(
            !contracts[addr] &&
                pending[addr] != 0 &&
                ((pending[addr] + delayPeriod) < block.timestamp),
            "Contract is no longer pending or has already been approved by registry"
        );
        pending[addr] = 0;
        contracts[addr] = true;
    }

    /**
     * Revoke access for specified contract. Can be done instantly.
     *
     * @dev ProxyRegistry owner only
     * @param addr Address of which to revoke permissions
     */
    function revokeAuthentication(address addr) public onlyOwner {
        contracts[addr] = false;
    }

    /**
     * Register a proxy contract with this registry
     *
     * @dev Must be called by the user which the proxy is for, creates a new AuthenticatedProxy
     * @return proxy New AuthenticatedProxy contract
     */
    function registerProxy() public returns (OwnableDelegateProxy proxy) {
        return registerProxyFor(msg.sender);
    }

    /**
     * Register a proxy contract with this registry, overriding any existing proxy
     *
     * @dev Must be called by the user which the proxy is for, creates a new AuthenticatedProxy
     * @return proxy New AuthenticatedProxy contract
     */
    function registerProxyOverride()
        public
        returns (OwnableDelegateProxy proxy)
    {
        proxy = new OwnableDelegateProxy(
            msg.sender,
            delegateProxyImplementation,
            abi.encodeWithSignature(
                "initialize(address,address)",
                msg.sender,
                address(this)
            )
        );
        proxies[msg.sender] = proxy;
        return proxy;
    }

    /**
     * Register a proxy contract with this registry
     *
     * @dev Can be called by any user
     * @return proxy New AuthenticatedProxy contract
     */
    function registerProxyFor(address user)
        public
        returns (OwnableDelegateProxy proxy)
    {
        require(
            proxies[user] == OwnableDelegateProxy(0),
            "User already has a proxy"
        );
        proxy = new OwnableDelegateProxy(
            user,
            delegateProxyImplementation,
            abi.encodeWithSignature(
                "initialize(address,address)",
                user,
                address(this)
            )
        );
        proxies[user] = proxy;
        return proxy;
    }

    /**
     * Transfer access
     */
    function transferAccessTo(address from, address to) public {
        OwnableDelegateProxy proxy = proxies[from];

        /* CHECKS */
        require(
            OwnableDelegateProxy(msg.sender) == proxy,
            "Proxy transfer can only be called by the proxy"
        );
        require(
            proxies[to] == OwnableDelegateProxy(0),
            "Proxy transfer has existing proxy as destination"
        );

        /* EFFECTS */
        delete proxies[from];
        proxies[to] = proxy;
    }
}

File 4 of 25 : PlaygroundTransferProxy.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.7.5;

import "../registry/ProxyRegistry.sol";
import "../libraries/TransferHelper.sol";
import "./ERC20.sol";

contract PlaygroundTransferProxy {
    /* Authentication registry. */
    ProxyRegistry public registry;

    constructor(ProxyRegistry _registry) {
        require(address(_registry) != address(0), "INVALID REGISTRY");
        registry = _registry;
    }

    /**
     * Call ERC20 `transferFrom`
     *
     * @dev Authenticated contract only
     * @param token ERC20 token address
     * @param from From address
     * @param to To address
     * @param amount Transfer amount
     */
    function transferFrom(
        address token,
        address from,
        address to,
        uint256 amount
    ) public {
        require(registry.contracts(msg.sender));
        TransferHelper.safeTransferFrom(token, from, to, amount);
    }
}

File 5 of 25 : RoyaltyFeeRegistry.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.7.5;

import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";

import {IRoyaltyFeeRegistry} from "./interfaces/IRoyaltyFeeRegistry.sol";

/**
 * @title RoyaltyFeeRegistry
 * @notice It is a royalty fee registry for the Helixmeta exchange.
 */
contract RoyaltyFeeRegistry is IRoyaltyFeeRegistry, Ownable {
    struct FeeInfo {
        address setter;
        address receiver;
        uint256 fee;
    }

    // Limit (if enforced for fee royalty in percentage (10,000 = 100%)
    uint256 public royaltyFeeLimit;

    mapping(address => FeeInfo) private _royaltyFeeInfoCollection;
    mapping(address => mapping(uint256 => FeeInfo))
        private _royaltyFeeInfoNFTCollection;

    event NewRoyaltyFeeLimit(uint256 royaltyFeeLimit);
    event RoyaltyFeeUpdate(
        address indexed collection,
        address indexed setter,
        address indexed receiver,
        uint256 fee
    );

    event NFTRoyaltyFeeUpdate(
        uint256 indexed tokenId,
        address indexed setter,
        address indexed receiver,
        uint256 fee
    );

    /**
     * @notice Constructor
     * @param _royaltyFeeLimit new royalty fee limit (500 = 5%, 1,000 = 10%)
     */
    constructor(uint256 _royaltyFeeLimit) {
        require(_royaltyFeeLimit <= 9500, "Owner: Royalty fee limit too high");
        royaltyFeeLimit = _royaltyFeeLimit;
    }

    /**
     * @notice Update royalty info for collection
     * @param _royaltyFeeLimit new royalty fee limit (500 = 5%, 1,000 = 10%)
     */
    function updateRoyaltyFeeLimit(uint256 _royaltyFeeLimit)
        external
        override
        onlyOwner
    {
        require(_royaltyFeeLimit <= 9500, "Owner: Royalty fee limit too high");
        royaltyFeeLimit = _royaltyFeeLimit;

        emit NewRoyaltyFeeLimit(_royaltyFeeLimit);
    }

    /**
     * @notice Update royalty info for collection
     * @param collection address of the NFT contract
     * @param setter address that sets the receiver
     * @param receiver receiver for the royalty fee
     * @param fee fee (500 = 5%, 1,000 = 10%)
     */
    function updateRoyaltyInfoForCollection(
        address collection,
        address setter,
        address receiver,
        uint256 fee
    ) external override onlyOwner {
        require(fee <= royaltyFeeLimit, "Registry: Royalty fee too high");
        _royaltyFeeInfoCollection[collection] = FeeInfo({
            setter: setter,
            receiver: receiver,
            fee: fee
        });

        emit RoyaltyFeeUpdate(collection, setter, receiver, fee);
    }

    /**
     * @notice Update royalty info for collection
     * @param collection address of the NFT contract
     * @param tokenId string number tokenId gen
     * @param setter address that sets the receiver
     * @param receiver receiver for the royalty fee
     * @param fee fee (500 = 5%, 1,000 = 10%)
     */
    function updateRoyaltyInfoForNFTCollection(
        address collection,
        uint256 tokenId,
        address setter,
        address receiver,
        uint256 fee
    ) external override onlyOwner {
        require(fee <= royaltyFeeLimit, "Registry: Royalty fee too high");
        _royaltyFeeInfoNFTCollection[collection][tokenId] = FeeInfo({
            setter: setter,
            receiver: receiver,
            fee: fee
        });

        emit NFTRoyaltyFeeUpdate(tokenId, setter, receiver, fee);
    }

    /**
     * @notice Calculate royalty info for a collection address and a sale gross amount
     * @param collection collection address
     * @param amount amount
     * @return receiver address and amount received by royalty recipient
     */
    function royaltyInfo(
        address collection,
        uint256 amount,
        uint256 tokenId
    ) external view override returns (address, uint256) {
        if (
            _royaltyFeeInfoNFTCollection[collection][tokenId].receiver !=
            address(0)
        ) {
            return (
                _royaltyFeeInfoNFTCollection[collection][tokenId].receiver,
                (amount *
                    _royaltyFeeInfoNFTCollection[collection][tokenId].fee) /
                    10000
            );
        }
        return (
            _royaltyFeeInfoCollection[collection].receiver,
            (amount * _royaltyFeeInfoCollection[collection].fee) / 10000
        );
    }

    /**
     * @notice View royalty info for a collection address
     * @param collection collection address
     */
    function royaltyFeeInfoCollection(address collection)
        external
        view
        override
        returns (
            address,
            address,
            uint256
        )
    {
        return (
            _royaltyFeeInfoCollection[collection].setter,
            _royaltyFeeInfoCollection[collection].receiver,
            _royaltyFeeInfoCollection[collection].fee
        );
    }

     /**
     * @notice View royalty info for a collection address
     * @param collection collection address
     * @param tokenId uint256
     */
    function royaltyFeeInfoNFTCollection(address collection, uint256 tokenId)
        external
        view
        override
        returns (
            address,
            address,
            uint256
        )
    {
        return (
            _royaltyFeeInfoNFTCollection[collection][tokenId].setter,
            _royaltyFeeInfoNFTCollection[collection][tokenId].receiver,
            _royaltyFeeInfoNFTCollection[collection][tokenId].fee
        );
    }
}

File 6 of 25 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        uint256 c = a + b;
        if (c < a) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b > a) return (false, 0);
        return (true, a - b);
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) return (true, 0);
        uint256 c = a * b;
        if (c / a != b) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a / b);
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a % b);
    }

    /**
     * @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) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");
        return c;
    }

    /**
     * @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) {
        require(b <= a, "SafeMath: subtraction overflow");
        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) {
        if (a == 0) return 0;
        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");
        return c;
    }

    /**
     * @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. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: division by zero");
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: modulo by zero");
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        return a - b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryDiv}.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a % b;
    }
}

File 7 of 25 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "../utils/Context.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 Ownable is Context {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor () internal {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), 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 {
        emit OwnershipTransferred(_owner, address(0));
        _owner = 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");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

File 8 of 25 : ArrayUtils.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.7.5;

import "@openzeppelin/contracts/math/SafeMath.sol";

/**
 * @title ArrayUtils
 * @author Wyvern Protocol Developers
 */
library ArrayUtils {
    /**
     * Replace bytes in an array with bytes in another array, guarded by a bitmask
     * Efficiency of this function is a bit unpredictable because of the EVM's word-specific model (arrays under 32 bytes will be slower)
     * Modifies the provided byte array parameter in place
     *
     * @dev Mask must be the size of the byte array. A nonzero byte means the byte array can be changed.
     * @param array The original array
     * @param desired The target array
     * @param mask The mask specifying which bits can be changed
     */
    function guardedArrayReplace(
        bytes memory array,
        bytes memory desired,
        bytes memory mask
    ) internal pure {
        require(
            array.length == desired.length,
            "Arrays have different lengths"
        );
        require(
            array.length == mask.length,
            "Array and mask have different lengths"
        );

        uint256 words = array.length / 0x20;
        uint256 index = words * 0x20;
        assert(index / 0x20 == words);
        uint256 i;

        for (i = 0; i < words; i++) {
            /* Conceptually: array[i] = (!mask[i] && array[i]) || (mask[i] && desired[i]), bitwise in word chunks. */
            assembly {
                let commonIndex := mul(0x20, add(1, i))
                let maskValue := mload(add(mask, commonIndex))
                mstore(
                    add(array, commonIndex),
                    or(
                        and(not(maskValue), mload(add(array, commonIndex))),
                        and(maskValue, mload(add(desired, commonIndex)))
                    )
                )
            }
        }

        /* Deal with the last section of the byte array. */
        if (words > 0) {
            /* This overlaps with bytes already set but is still more efficient than iterating through each of the remaining bytes individually. */
            i = words;
            assembly {
                let commonIndex := mul(0x20, add(1, i))
                let maskValue := mload(add(mask, commonIndex))
                mstore(
                    add(array, commonIndex),
                    or(
                        and(not(maskValue), mload(add(array, commonIndex))),
                        and(maskValue, mload(add(desired, commonIndex)))
                    )
                )
            }
        } else {
            /* If the byte array is shorter than a word, we must unfortunately do the whole thing bytewise.
               (bounds checks could still probably be optimized away in assembly, but this is a rare case) */
            for (i = index; i < array.length; i++) {
                array[i] =
                    ((mask[i] ^ 0xff) & array[i]) |
                    (mask[i] & desired[i]);
            }
        }
    }

    /**
     * Test if two arrays are equal
     * Source: https://github.com/GNSPS/solidity-bytes-utils/blob/master/contracts/BytesLib.sol
     *
     * @dev Arrays must be of equal length, otherwise will return false
     * @param a First array
     * @param b Second array
     * @return Whether or not all bytes in the arrays are equal
     */
    function arrayEq(bytes memory a, bytes memory b)
        internal
        pure
        returns (bool)
    {
        bool success = true;

        assembly {
            let length := mload(a)

            // if lengths don't match the arrays are not equal
            switch eq(length, mload(b))
            case 1 {
                // cb is a circuit breaker in the for loop since there's
                //  no said feature for inline assembly loops
                // cb = 1 - don't breaker
                // cb = 0 - break
                let cb := 1

                let mc := add(a, 0x20)
                let end := add(mc, length)

                for {
                    let cc := add(b, 0x20)
                    // the next line is the loop condition:
                    // while(uint(mc < end) + cb == 2)
                } eq(add(lt(mc, end), cb), 2) {
                    mc := add(mc, 0x20)
                    cc := add(cc, 0x20)
                } {
                    // if any of these checks fails then arrays are not equal
                    if iszero(eq(mload(mc), mload(cc))) {
                        // unsuccess:
                        success := 0
                        cb := 0
                    }
                }
            }
            default {
                // unsuccess:
                success := 0
            }
        }

        return success;
    }

    /**
     * Drop the beginning of an array
     *
     * @param _bytes array
     * @param _start start index
     * @return Whether or not all bytes in the arrays are equal
     */
    function arrayDrop(bytes memory _bytes, uint256 _start)
        internal
        pure
        returns (bytes memory)
    {
        uint256 _length = SafeMath.sub(_bytes.length, _start);
        return arraySlice(_bytes, _start, _length);
    }

    /**
     * Take from the beginning of an array
     *
     * @param _bytes array
     * @param _length elements to take
     * @return Whether or not all bytes in the arrays are equal
     */
    function arrayTake(bytes memory _bytes, uint256 _length)
        internal
        pure
        returns (bytes memory)
    {
        return arraySlice(_bytes, 0, _length);
    }

    /**
     * Slice an array
     * Source: https://github.com/GNSPS/solidity-bytes-utils/blob/master/contracts/BytesLib.sol
     *
     * @param _bytes array
     * @param _start start index
     * @param _length length to take
     * @return Whether or not all bytes in the arrays are equal
     */
    function arraySlice(
        bytes memory _bytes,
        uint256 _start,
        uint256 _length
    ) internal pure returns (bytes memory) {
        bytes memory tempBytes;

        assembly {
            switch iszero(_length)
            case 0 {
                // Get a location of some free memory and store it in tempBytes as
                // Solidity does for memory variables.
                tempBytes := mload(0x40)

                // The first word of the slice result is potentially a partial
                // word read from the original array. To read it, we calculate
                // the length of that partial word and start copying that many
                // bytes into the array. The first word we copy will start with
                // data we don't care about, but the last `lengthmod` bytes will
                // land at the beginning of the contents of the new array. When
                // we're done copying, we overwrite the full first word with
                // the actual length of the slice.
                let lengthmod := and(_length, 31)

                // The multiplication in the next line is necessary
                // because when slicing multiples of 32 bytes (lengthmod == 0)
                // the following copy loop was copying the origin's length
                // and then ending prematurely not copying everything it should.
                let mc := add(
                    add(tempBytes, lengthmod),
                    mul(0x20, iszero(lengthmod))
                )
                let end := add(mc, _length)

                for {
                    // The multiplication in the next line has the same exact purpose
                    // as the one above.
                    let cc := add(
                        add(
                            add(_bytes, lengthmod),
                            mul(0x20, iszero(lengthmod))
                        ),
                        _start
                    )
                } lt(mc, end) {
                    mc := add(mc, 0x20)
                    cc := add(cc, 0x20)
                } {
                    mstore(mc, mload(cc))
                }

                mstore(tempBytes, _length)

                //update free-memory pointer
                //allocating the array padded to 32 bytes like the compiler does now
                mstore(0x40, and(add(mc, 31), not(31)))
            }
            //if we want a zero-length slice let's just return a zero-length array
            default {
                tempBytes := mload(0x40)

                mstore(0x40, add(tempBytes, 0x20))
            }
        }

        return tempBytes;
    }

    /**
     * Unsafe write byte array into a memory location
     *
     * @param index Memory location
     * @param source Byte array to write
     * @return End memory index
     */
    function unsafeWriteBytes(uint256 index, bytes memory source)
        internal
        pure
        returns (uint256)
    {
        if (source.length > 0) {
            assembly {
                let length := mload(source)
                let end := add(source, add(0x20, length))
                let arrIndex := add(source, 0x20)
                let tempIndex := index
                for {

                } eq(lt(arrIndex, end), 1) {
                    arrIndex := add(arrIndex, 0x20)
                    tempIndex := add(tempIndex, 0x20)
                } {
                    mstore(tempIndex, mload(arrIndex))
                }
                index := add(index, length)
            }
        }
        return index;
    }

    /**
     * Unsafe write address into a memory location
     *
     * @param index Memory location
     * @param source Address to write
     * @return End memory index
     */
    function unsafeWriteAddress(uint256 index, address source)
        internal
        pure
        returns (uint256)
    {
        uint256 conv = uint256(source) << 0x60;
        assembly {
            mstore(index, conv)
            index := add(index, 0x14)
        }
        return index;
    }

    /**
     * Unsafe write uint into a memory location
     *
     * @param index Memory location
     * @param source uint to write
     * @return End memory index
     */
    function unsafeWriteUint(uint256 index, uint256 source)
        internal
        pure
        returns (uint256)
    {
        assembly {
            mstore(index, source)
            index := add(index, 0x20)
        }
        return index;
    }

    /**
     * Unsafe write uint8 into a memory location
     *
     * @param index Memory location
     * @param source uint8 to write
     * @return End memory index
     */
    function unsafeWriteUint8(uint256 index, uint8 source)
        internal
        pure
        returns (uint256)
    {
        assembly {
            mstore8(index, source)
            index := add(index, 0x1)
        }
        return index;
    }
}

File 9 of 25 : SaleKindInterface.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.7.5;

import "@openzeppelin/contracts/math/SafeMath.sol";

library SaleKindInterface {
    /**
     * Side: buy or sell.
     */
    enum Side {
        Buy,
        Sell
    }

    /**
     * Currently supported kinds of sale: fixed price, Dutch auction.
     * English auctions cannot be supported without stronger escrow guarantees.
     * Future interesting options: Vickrey auction, nonlinear Dutch auctions.
     */
    enum SaleKind {
        FixedPrice,
        DutchAuction
    }

    /**
     * @dev Check whether the parameters of a sale are valid
     * @param saleKind Kind of sale
     * @param expirationTime Order expiration time
     * @return Whether the parameters were valid
     */
    function validateParameters(SaleKind saleKind, uint256 expirationTime)
        internal
        pure
        returns (bool)
    {
        /* Auctions must have a set expiration date. */
        return (saleKind == SaleKind.FixedPrice || expirationTime > 0);
    }

    /**
     * @dev Return whether or not an order can be settled
     * @dev Precondition: parameters have passed validateParameters
     * @param listingTime Order listing time
     * @param expirationTime Order expiration time
     */
    function canSettleOrder(uint256 listingTime, uint256 expirationTime)
        internal
        view
        returns (bool)
    {
        return
            (listingTime < block.timestamp) &&
            (expirationTime == 0 || block.timestamp < expirationTime);
    }

    /**
     * @dev Calculate the settlement price of an order
     * @dev Precondition: parameters have passed validateParameters.
     * @param side Order side
     * @param saleKind Method of sale
     * @param basePrice Order base price
     * @param extra Order extra price data
     * @param listingTime Order listing time
     * @param expirationTime Order expiration time
     */
    function calculateFinalPrice(
        Side side,
        SaleKind saleKind,
        uint256 basePrice,
        uint256 extra,
        uint256 listingTime,
        uint256 expirationTime,
        uint256 amount
    ) internal view returns (uint256 finalPrice) {
        if (saleKind == SaleKind.FixedPrice) {
            return SafeMath.mul(basePrice, amount);
        } else if (saleKind == SaleKind.DutchAuction) {
            uint256 diff = SafeMath.div(
                SafeMath.mul(extra, SafeMath.sub(block.timestamp, listingTime)),
                SafeMath.sub(expirationTime, listingTime)
            );
            if (side == Side.Sell) {
                /* Sell-side - start price: basePrice. End price: basePrice - extra. */
                return SafeMath.sub(SafeMath.mul(basePrice, amount), diff);
            } else {
                /* Buy-side - start price: basePrice. End price: basePrice + extra. */
                return SafeMath.add(SafeMath.mul(basePrice, amount), diff);
            }
        }
    }
}

File 10 of 25 : ReentrancyGuarded.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.7.5;

/**
 * @title ReentrancyGuarded
 * @author Wyvern Protocol Developers
 */
contract ReentrancyGuarded {
    bool reentrancyLock = false;

    /* Prevent a contract function from being reentrant-called. */
    modifier reentrancyGuard() {
        require(!reentrancyLock, "Reentrancy detected");
        reentrancyLock = true;
        _;
        reentrancyLock = false;
    }
}

File 11 of 25 : AuthenticatedProxy.sol
/* 

  Proxy contract to hold access to assets on behalf of a user (e.g. ERC20 approve) and execute calls under particular conditions.

*/
// SPDX-License-Identifier: MIT
pragma solidity 0.7.5;

import "./ProxyRegistry.sol";
import "./TokenRecipient.sol";
import "./proxy/OwnedUpgradeabilityStorage.sol";

/**
 * @title AuthenticatedProxy
 * @author Wyvern Protocol Developers
 */
contract AuthenticatedProxy is TokenRecipient, OwnedUpgradeabilityStorage {
    /* Whether initialized. */
    bool initialized = false;

    /* Address which owns this proxy. */
    address public user;

    /* Associated registry with contract authentication information. */
    ProxyRegistry public registry;

    /* Whether access has been revoked. */
    bool public revoked;

    /* Delegate call could be used to atomically transfer multiple assets owned by the proxy contract with one order. */
    enum HowToCall {
        Call,
        DelegateCall
    }

    /* Event fired when the proxy access is revoked or unrevoked. */
    event Revoked(bool revoked);

    /**
     * Initialize an AuthenticatedProxy
     *
     * @param addrUser Address of user on whose behalf this proxy will act
     * @param addrRegistry Address of ProxyRegistry contract which will manage this proxy
     */
    function initialize(address addrUser, ProxyRegistry addrRegistry) public {
        require(!initialized, "Authenticated proxy already initialized");
        initialized = true;
        user = addrUser;
        registry = addrRegistry;
    }

    /**
     * Set the revoked flag (allows a user to revoke ProxyRegistry access)
     *
     * @dev Can be called by the user only
     * @param revoke Whether or not to revoke access
     */
    function setRevoke(bool revoke) public {
        require(
            msg.sender == user,
            "Authenticated proxy can only be revoked by its user"
        );
        revoked = revoke;
        emit Revoked(revoke);
    }

    /**
     * Execute a message call from the proxy contract
     *
     * @dev Can be called by the user, or by a contract authorized by the registry as long as the user has not revoked access
     * @param dest Address to which the call will be sent
     * @param howToCall Which kind of call to make
     * @param data Calldata to send
     * @return result Result of the call (success or failure)
     */
    function proxy(
        address dest,
        HowToCall howToCall,
        bytes memory data
    ) public returns (bool result, bytes memory ret) {
        require(
            msg.sender == user || (!revoked && registry.contracts(msg.sender)),
            "Authenticated proxy can only be called by its user, or by a contract authorized by the registry as long as the user has not revoked access"
        );
        if (howToCall == HowToCall.Call) {
            (result, ret) = dest.call(data);
        } else if (howToCall == HowToCall.DelegateCall) {
            (result, ret) = dest.delegatecall(data);
        }
    }

    /**
     * Execute a message call and assert success
     *
     * @dev Same functionality as `proxy`, just asserts the return value
     * @param dest Address to which the call will be sent
     * @param howToCall What kind of call to make
     * @param data Calldata to send
     */
    function proxyAssert(
        address dest,
        HowToCall howToCall,
        bytes memory data
    ) public {
        (bool result, ) = proxy(dest, howToCall, data);
        require(result, "Proxy assertion failed");
    }
}

File 12 of 25 : ExchangeMain.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.7.5;
pragma abicoder v2;

import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "../libraries/ArrayUtils.sol";
import "../libraries/SaleKindInterface.sol";
import "../libraries/ReentrancyGuarded.sol";
import "../registry/ProxyRegistry.sol";
import "../modules/ERC20.sol";
import "../modules/PlaygroundTransferProxy.sol";
import "../registry/AuthenticatedProxy.sol";
import "../interfaces/IPlaygroundStore.sol";
import "../royalties/interfaces/IRoyaltyFeeRegistry.sol";

contract ExchangeMain is ReentrancyGuarded, Ownable {
    /* The token used to pay exchange fees. */
    bytes4 constant ERC1155_SIGNATURE = 0x127217d6;
    /* User registry. */
    ProxyRegistry public registry;

    /* Token transfer proxy. */
    PlaygroundTransferProxy public tokenTransferProxy;

    /* Royalties */
    IRoyaltyFeeRegistry public royaltyFeeRegistry;

    struct SellRemaining {
        bool tracking;
        uint256 left;
    }

    mapping(bytes32 => SellRemaining) public sellOrderAmountRemaining;

    /* Cancelled / finalized orders, by hash. */
    mapping(bytes32 => bool) public cancelledOrFinalized;

    /* Orders verified by on-chain approval (alternative to ECDSA signatures so that smart contracts can place orders directly). */
    mapping(bytes32 => bool) public approvedOrders;

    /* Fee method: protocol fee or split fee. */
    enum FeeMethod {
        ProtocolFee,
        SplitFee
    }

    /* Inverse basis point. */
    uint256 public constant INVERSE_BASIS_POINT = 10000;

    /* An ECDSA signature. */
    struct Sig {
        /* v parameter */
        uint8 v;
        /* r parameter */
        bytes32 r;
        /* s parameter */
        bytes32 s;
    }

    /* An order on the exchange. */
    struct Order {
        /* Exchange address, intended as a versioning mechanism. */
        address exchange;
        /* Order maker address. */
        address maker;
        /* Order taker address, if specified. */
        address taker;
        /* Maker relayer fee of the order, unused for taker order. */
        uint256 makerRelayerFee;
        /* Taker relayer fee of the order, or maximum taker fee for a taker order. */
        uint256 takerRelayerFee;
        // /* Maker protocol fee of the order, unused for taker order. */
        // uint makerProtocolFee;
        // /* Taker protocol fee of the order, or maximum taker fee for a taker order. */
        // uint takerProtocolFee;
        /* Order fee recipient or zero address for taker order. */
        address feeRecipient;
        /* Fee method (protocol token or split fee). */
        FeeMethod feeMethod;
        /* Side (buy/sell). */
        SaleKindInterface.Side side;
        /* Kind of sale. */
        SaleKindInterface.SaleKind saleKind;
        /* Target. */
        address target;
        /* HowToCall. */
        AuthenticatedProxy.HowToCall howToCall;
        /* Calldata. */
        bytes callData;
        bytes replacementPattern;
        /* Calldata replacement pattern, or an empty byte array for no replacement. */
        // bytes replacementPattern;
        // /* Static call target, zero-address for no static call. */
        address staticTarget;
        /* Static call extra data. */
        bytes staticExtradata;
        /* Token used to pay for the order, or the zero-address as a sentinel value for Ether. */
        address paymentToken;
        /* Base price of the order (in paymentTokens). */
        uint256 basePrice;
        /* Auction extra parameter - minimum bid increment for English auctions, starting/ending price difference. */
        uint256 extra;
        /* Listing timestamp. */
        uint256 listingTime;
        /* Expiration timestamp - 0 for no expiry. */
        uint256 expirationTime;
        /* Order salt, used to prevent duplicate hashes. */
        uint256 salt;
    }

    event OrderApprovedPartOne(
        bytes32 indexed hash,
        address exchange,
        address indexed maker,
        address taker,
        uint256 makerRelayerFee,
        uint256 takerRelayerFee,
        address indexed feeRecipient,
        FeeMethod feeMethod,
        SaleKindInterface.Side side,
        SaleKindInterface.SaleKind saleKind,
        address target
    );
    event OrderApprovedPartTwo(
        bytes32 indexed hash,
        AuthenticatedProxy.HowToCall howToCall,
        bytes callData,
        address staticTarget,
        bytes staticExtradata,
        address paymentToken,
        uint256 basePrice,
        uint256 extra,
        uint256 listingTime,
        uint256 expirationTime,
        uint256 salt,
        bool orderbookInclusionDesired
    );
    // event OrderApprovedPartOne    (bytes32 indexed hash, address exchange, address indexed maker, address taker, uint makerRelayerFee, uint takerRelayerFee, uint makerProtocolFee, uint takerProtocolFee, address indexed feeRecipient, FeeMethod feeMethod, SaleKindInterface.Side side, SaleKindInterface.SaleKind saleKind, address target);
    // event OrderApprovedPartTwo    (bytes32 indexed hash, AuthenticatedProxy.HowToCall howToCall, bytes callData, bytes replacementPattern, address staticTarget, bytes staticExtradata, address paymentToken, uint basePrice, uint extra, uint listingTime, uint expirationTime, uint salt, bool orderbookInclusionDesired);
    event OrderCancelled(bytes32 indexed hash);
    event OrdersMatched(
        bytes32 buyHash,
        bytes32 sellHash,
        address maker,
        address taker,
        uint256 price,
        uint256 tokenId,
        address collection,
        uint256 tokenAmount,
        bytes32 indexed metadata
    );

    /**
     * @dev Transfer tokens
     * @param token Token to transfer
     * @param from Address to charge fees
     * @param to Address to receive fees
     * @param amount Amount of protocol tokens to charge
     */
    function transferTokens(
        address token,
        address from,
        address to,
        uint256 amount
    ) internal {
        if (amount > 0) {
            tokenTransferProxy.transferFrom(token, from, to, amount);
        }
    }

    /**
     * @dev Charge a fee in protocol tokens
     * @param from Address to charge fees
     * @param to Address to receive fees
     * @param amount Amount of protocol tokens to charge
     */
    function chargeProtocolFee(
        address token,
        address from,
        address to,
        uint256 amount
    ) internal {
        transferTokens(token, from, to, amount);
    }

    /**
     * Calculate size of an order struct when tightly packed
     *
     * @param order Order to calculate size of
     * @return Size in bytes
     */
    function sizeOf(Order memory order) internal pure returns (uint256) {
        return ((0x14 * 7) +
            (0x20 * 9) +
            4 +
            order.callData.length +
            order.replacementPattern.length +
            order.staticExtradata.length);
        // return ((0x14 * 7) + (0x20 * 9) + 4 + order.callData.length + order.replacementPattern.length + order.staticExtradata.length);
    }

    /**
     * @dev Hash an order, returning the canonical order hash, without the message prefix
     * @param order Order to hash
     */
    function hashOrder(Order memory order)
        internal
        pure
        returns (bytes32 hash)
    {
        /* Unfortunately abi.encodePacked doesn't work here, stack size constraints. */
        uint256 size = sizeOf(order);
        bytes memory array = new bytes(size);
        uint256 index;
        assembly {
            index := add(array, 0x20)
        }
        index = ArrayUtils.unsafeWriteAddress(index, order.exchange);
        index = ArrayUtils.unsafeWriteAddress(index, order.maker);
        index = ArrayUtils.unsafeWriteAddress(index, order.taker);
        index = ArrayUtils.unsafeWriteUint(index, order.makerRelayerFee);
        index = ArrayUtils.unsafeWriteUint(index, order.takerRelayerFee);
        // index = ArrayUtils.unsafeWriteUint(index, order.makerProtocolFee);
        // index = ArrayUtils.unsafeWriteUint(index, order.takerProtocolFee);
        index = ArrayUtils.unsafeWriteAddress(index, order.feeRecipient);
        index = ArrayUtils.unsafeWriteUint8(index, uint8(order.feeMethod));
        index = ArrayUtils.unsafeWriteUint8(index, uint8(order.side));
        index = ArrayUtils.unsafeWriteUint8(index, uint8(order.saleKind));
        index = ArrayUtils.unsafeWriteAddress(index, order.target);
        index = ArrayUtils.unsafeWriteUint8(index, uint8(order.howToCall));
        index = ArrayUtils.unsafeWriteBytes(index, order.callData);
        index = ArrayUtils.unsafeWriteBytes(index, order.replacementPattern);
        index = ArrayUtils.unsafeWriteAddress(index, order.staticTarget);
        index = ArrayUtils.unsafeWriteBytes(index, order.staticExtradata);
        index = ArrayUtils.unsafeWriteAddress(index, order.paymentToken);
        index = ArrayUtils.unsafeWriteUint(index, order.basePrice);
        index = ArrayUtils.unsafeWriteUint(index, order.extra);
        index = ArrayUtils.unsafeWriteUint(index, order.listingTime);
        index = ArrayUtils.unsafeWriteUint(index, order.expirationTime);
        index = ArrayUtils.unsafeWriteUint(index, order.salt);
        assembly {
            hash := keccak256(add(array, 0x20), size)
        }
        return hash;
    }

    /**
     * @dev Hash an order, returning the hash that a client must sign, including the standard message prefix
     * @param order Order to hash
     * @return Hash of message prefix and order hash per Ethereum format
     */
    function hashToSign(Order memory order) internal pure returns (bytes32) {
        return
            keccak256(
                abi.encodePacked(
                    "\x19Ethereum Signed Message:\n32",
                    hashOrder(order)
                )
            );
    }

    /**
     * @dev Assert an order is valid and return its hash
     * @param order Order to validate
     * @param sig ECDSA signature
     */
    function requireValidOrder(Order memory order, Sig memory sig)
        internal
        view
        returns (bytes32)
    {
        bytes32 hash = hashToSign(order);
        require(validateOrder(hash, order, sig), "INVALID_ORDER_HASH");
        return hash;
    }

    /**
     * @dev Validate order parameters (does *not* check signature validity)
     * @param order Order to validate
     */
    function validateOrderParameters(Order memory order)
        internal
        view
        returns (bool)
    {
        /* Order must be targeted at this protocol version (this Exchange contract). */
        if (order.exchange != address(this)) {
            return false;
        }

        /* Order must possess valid sale kind parameter combination. */
        if (
            !SaleKindInterface.validateParameters(
                order.saleKind,
                order.expirationTime
            )
        ) {
            return false;
        }

        // /* If using the split fee method, order must have sufficient protocol fees. */
        // if (order.feeMethod == FeeMethod.SplitFee && (order.makerProtocolFee < minimumMakerProtocolFee || order.takerProtocolFee < minimumTakerProtocolFee)) {
        //     return false;
        // }

        return true;
    }

    /**
     * @dev Validate a provided previously approved / signed order, hash, and signature.
     * @param hash Order hash (already calculated, passed to avoid recalculation)
     * @param order Order to validate
     * @param sig ECDSA signature
     */
    function validateOrder(
        bytes32 hash,
        Order memory order,
        Sig memory sig
    ) internal view returns (bool) {
        /* Not done in an if-conditional to prevent unnecessary ecrecover evaluation, which seems to happen even though it should short-circuit. */

        /* Order must have valid parameters. */
        if (!validateOrderParameters(order)) {
            return false;
        }

        /* Order must have not been canceled or already filled. */
        if (cancelledOrFinalized[hash]) {
            return false;
        }

        /* Order authentication. Order must be either:
        /* (a) previously approved */
        if (approvedOrders[hash]) {
            return true;
        }

        /* or (b) ECDSA-signed by maker. */
        if (ecrecover(hash, sig.v, sig.r, sig.s) == order.maker) {
            return true;
        }

        return false;
    }

    /**
     * @dev Approve an order and optionally mark it for orderbook inclusion. Must be called by the maker of the order
     * @param order Order to approve
     * @param orderbookInclusionDesired Whether orderbook providers should include the order in their orderbooks
     */
    function approveOrder(Order memory order, bool orderbookInclusionDesired)
        internal
    {
        /* CHECKS */

        /* Assert sender is authorized to approve order. */
        require(msg.sender == order.maker);

        /* Calculate order hash. */
        bytes32 hash = hashToSign(order);

        /* Assert order has not already been approved. */
        require(!approvedOrders[hash]);

        /* EFFECTS */

        /* Mark order as approved. */
        approvedOrders[hash] = true;

        /* Log approval event. Must be split in two due to Solidity stack size limitations. */
        {
            emit OrderApprovedPartOne(
                hash,
                order.exchange,
                order.maker,
                order.taker,
                order.makerRelayerFee,
                order.takerRelayerFee,
                order.feeRecipient,
                order.feeMethod,
                order.side,
                order.saleKind,
                order.target
            );
        }
        {
            emit OrderApprovedPartTwo(
                hash,
                order.howToCall,
                order.callData,
                order.staticTarget,
                order.staticExtradata,
                order.paymentToken,
                order.basePrice,
                order.extra,
                order.listingTime,
                order.expirationTime,
                order.salt,
                orderbookInclusionDesired
            );
        }
    }

    /**
     * @dev Cancel an order, preventing it from being matched. Must be called by the maker of the order
     * @param order Order to cancel
     * @param sig ECDSA signature
     */
    function cancelOrder(Order memory order, Sig memory sig) internal {
        /* CHECKS */
        bytes32 _hash = hashOrder(order);
        /* Calculate order hash. */
        bytes32 hash = requireValidOrder(order, sig);
        /* Assert sender is authorized to cancel order. */
        require(msg.sender == order.maker);

        /* Mark order as cancelled, preventing it from being matched. */
        cancelledOrFinalized[hash] = true;

        /* Log cancel event. */
        emit OrderCancelled(_hash);
    }

    /**
     * @dev Calculate the current price of an order (convenience function)
     * @param order Order to calculate the price of
     * @return The current price of the order
     */
    function calculateCurrentPrice(Order memory order, uint256 amount)
        internal
        view
        returns (uint256)
    {
        return
            SaleKindInterface.calculateFinalPrice(
                order.side,
                order.saleKind,
                order.basePrice,
                order.extra,
                order.listingTime,
                order.expirationTime,
                amount
            );
    }

    /**
     * @dev Calculate the price two orders would match at, if in fact they would match (otherwise fail)
     * @param buy Buy-side order
     * @param sell Sell-side order
     * @return Match price
     */
    function calculateMatchPrice(
        Order memory buy,
        Order memory sell,
        uint256 amount
    ) internal view returns (uint256) {
        /* Calculate sell price. */
        uint256 sellPrice = SaleKindInterface.calculateFinalPrice(
            sell.side,
            sell.saleKind,
            sell.basePrice,
            sell.extra,
            sell.listingTime,
            sell.expirationTime,
            amount
        );

        /* Calculate buy price. */
        uint256 buyPrice = SaleKindInterface.calculateFinalPrice(
            buy.side,
            buy.saleKind,
            buy.basePrice,
            buy.extra,
            buy.listingTime,
            buy.expirationTime,
            amount
        );

        /* Require price cross. */
        require(buyPrice >= sellPrice);

        /* Maker/taker priority. */
        return sell.feeRecipient != address(0) ? sellPrice : buyPrice;
    }

    /**
     * @dev Execute all ERC20 token / Ether transfers associated with an order match (fees and buyer => seller transfer)
     * @param buy Buy-side order
     * @param sell Sell-side order
     */
    function executeFundsTransfer(
        Order memory buy,
        Order memory sell,
        uint256 amount,
        uint256 tokenId
    ) internal returns (uint256) {
        /* Only payable in the special case of unwrapped Ether. */
        if (sell.paymentToken != address(0)) {
            require(msg.value == 0);
        }

        /* Calculate match price. */
        uint256 price = calculateMatchPrice(buy, sell, amount);
        /* If paying using a token (not Ether), transfer tokens. This is done prior to fee payments to that a seller will have tokens before being charged fees. */
        if (price > 0 && sell.paymentToken != address(0)) {
            transferTokens(sell.paymentToken, buy.maker, sell.maker, price);
        }
        /* Amount that will be received by seller (for Ether). */
        uint256 receiveAmount = price;

        /* Amount that must be sent by buyer (for Ether). */
        uint256 requiredAmount = price;
        /* Determine maker/taker and charge fees accordingly. */
        if (sell.feeRecipient != address(0)) {
            /* Sell-side order is maker. */

            /* Assert taker fee is less than or equal to maximum fee specified by buyer. */
            require(sell.takerRelayerFee <= buy.takerRelayerFee);

            if (sell.feeMethod == FeeMethod.SplitFee) {
                // /* Assert taker fee is less than or equal to maximum fee specified by buyer. */
                // require(sell.takerProtocolFee <= buy.takerProtocolFee);

                /* Maker fees are deducted from the token amount that the maker receives. Taker fees are extra tokens that must be paid by the taker. */

                if (sell.makerRelayerFee > 0) {
                    uint256 makerRelayerFee = SafeMath.div(
                        SafeMath.mul(sell.makerRelayerFee, price),
                        INVERSE_BASIS_POINT
                    );
                    if (sell.paymentToken == address(0)) {
                        receiveAmount = SafeMath.sub(
                            receiveAmount,
                            makerRelayerFee
                        );
                        payable(sell.feeRecipient).transfer(makerRelayerFee);
                    } else {
                        transferTokens(
                            sell.paymentToken,
                            sell.maker,
                            sell.feeRecipient,
                            makerRelayerFee
                        );
                    }
                }

                if (sell.takerRelayerFee > 0) {
                    uint256 takerRelayerFee = SafeMath.div(
                        SafeMath.mul(sell.takerRelayerFee, price),
                        INVERSE_BASIS_POINT
                    );
                    if (sell.paymentToken == address(0)) {
                        requiredAmount = SafeMath.add(
                            requiredAmount,
                            takerRelayerFee
                        );
                        payable(sell.feeRecipient).transfer(takerRelayerFee);
                    } else {
                        transferTokens(
                            sell.paymentToken,
                            buy.maker,
                            sell.feeRecipient,
                            takerRelayerFee
                        );
                    }
                }
            } else {
                /* Charge maker fee to seller. */
                chargeProtocolFee(
                    sell.paymentToken,
                    sell.maker,
                    sell.feeRecipient,
                    sell.makerRelayerFee
                );

                /* Charge taker fee to buyer. */
                chargeProtocolFee(
                    sell.paymentToken,
                    buy.maker,
                    sell.feeRecipient,
                    sell.takerRelayerFee
                );
            }
        } else {
            /* Buy-side order is maker. */

            /* Assert taker fee is less than or equal to maximum fee specified by seller. */
            require(buy.takerRelayerFee <= sell.takerRelayerFee);

            if (sell.feeMethod == FeeMethod.SplitFee) {
                /* The Exchange does not escrow Ether, so direct Ether can only be used to with sell-side maker / buy-side taker orders. */
                require(sell.paymentToken != address(0));

                // /* Assert taker fee is less than or equal to maximum fee specified by seller. */
                // require(buy.takerProtocolFee <= sell.takerProtocolFee);

                if (buy.makerRelayerFee > 0) {
                    uint256 makerRelayerFee = SafeMath.div(
                        SafeMath.mul(buy.makerRelayerFee, price),
                        INVERSE_BASIS_POINT
                    );
                    transferTokens(
                        sell.paymentToken,
                        buy.maker,
                        buy.feeRecipient,
                        makerRelayerFee
                    );
                }

                if (buy.takerRelayerFee > 0) {
                    uint256 takerRelayerFee = SafeMath.div(
                        SafeMath.mul(buy.takerRelayerFee, price),
                        INVERSE_BASIS_POINT
                    );
                    transferTokens(
                        sell.paymentToken,
                        sell.maker,
                        buy.feeRecipient,
                        takerRelayerFee
                    );
                }
            } else {
                /* Charge maker fee to buyer. */
                chargeProtocolFee(
                    sell.paymentToken,
                    buy.maker,
                    buy.feeRecipient,
                    buy.makerRelayerFee
                );

                /* Charge taker fee to seller. */
                chargeProtocolFee(
                    sell.paymentToken,
                    sell.maker,
                    buy.feeRecipient,
                    buy.takerRelayerFee
                );
            }
        }

        {
            (
                address royaltyFeeRecipient,
                uint256 royaltyFeeAmount
            ) = royaltyFeeRegistry.royaltyInfo(sell.target, price, tokenId);

            // Check if there is a royalty fee and that it is different to 0
            if (
                (royaltyFeeRecipient != address(0)) && (royaltyFeeAmount != 0)
            ) {
                receiveAmount = SafeMath.sub(receiveAmount, royaltyFeeAmount);

                if (sell.paymentToken == address(0)) {
                    payable(royaltyFeeRecipient).transfer(royaltyFeeAmount);
                }

                if (
                    sell.paymentToken != address(0) &&
                    sell.maker != royaltyFeeRecipient
                ) {
                    transferTokens(
                        sell.paymentToken,
                        sell.maker,
                        royaltyFeeRecipient,
                        royaltyFeeAmount
                    );
                }
            }
        }

        if (sell.paymentToken == address(0)) {
            /* Special-case Ether, order must be matched by buyer. */
            require(msg.value >= requiredAmount);
            payable(sell.maker).transfer(receiveAmount);
            /* Allow overshoot for variable-price auctions, refund difference. */
            uint256 diff = SafeMath.sub(msg.value, requiredAmount);
            if (diff > 0) {
                payable(buy.maker).transfer(diff);
            }
        }

        /* This contract should never hold Ether, however, we cannot assert this, since it is impossible to prevent anyone from sending Ether e.g. with selfdestruct. */

        return price;
    }

    /**
     * @dev Return whether or not two orders can be matched with each other by basic parameters (does not check order signatures / calldata or perform static calls)
     * @param buy Buy-side order
     * @param sell Sell-side order
     * @return Whether or not the two orders can be matched
     */
    function ordersCanMatch(Order memory buy, Order memory sell)
        internal
        view
        returns (bool)
    {
        return (/* Must be opposite-side. */
        (buy.side == SaleKindInterface.Side.Buy &&
            sell.side == SaleKindInterface.Side.Sell) &&
            /* Must use same fee method. */
            (buy.feeMethod == sell.feeMethod) &&
            /* Must use same payment token. */
            (buy.paymentToken == sell.paymentToken) &&
            /* Must match maker/taker addresses. */
            (sell.taker == address(0) || sell.taker == buy.maker) &&
            (buy.taker == address(0) || buy.taker == sell.maker) &&
            /* One must be maker and the other must be taker (no bool XOR in Solidity). */
            ((sell.feeRecipient == address(0) &&
                buy.feeRecipient != address(0)) ||
                (sell.feeRecipient != address(0) &&
                    buy.feeRecipient == address(0))) &&
            /* Must match target. */
            (buy.target == sell.target) &&
            /* Must match howToCall. */
            (buy.howToCall == sell.howToCall) &&
            /* Buy-side order must be settleable. */
            SaleKindInterface.canSettleOrder(
                buy.listingTime,
                buy.expirationTime
            ) &&
            /* Sell-side order must be settleable. */
            SaleKindInterface.canSettleOrder(
                sell.listingTime,
                sell.expirationTime
            ));
    }

    function _validatePartialSellingAmount(
        Order memory buy,
        Order memory sell,
        bool isMint
    ) internal returns (bool, uint256) {
        uint256 buyAmount;
        uint256 sellAmount;
        uint256 tokenId;

        bytes32 hash = hashToSign(sell);
        SellRemaining storage sellAmountRemaining = sellOrderAmountRemaining[
            hash
        ];

        uint8 index = isMint ? 3 : 4;

        assembly {
            let sellCallData := mload(add(sell, mul(0x20, 11)))
            let buyCallData := mload(add(buy, mul(0x20, 11)))

            tokenId := mload(add(sellCallData, add(mul(0x20, 2), 0x04)))
            buyAmount := mload(add(buyCallData, add(mul(0x20, index), 0x04)))
            sellAmount := mload(add(sellCallData, add(mul(0x20, index), 0x04)))
        }

        if (!sellAmountRemaining.tracking) {
            sellAmountRemaining.tracking = true;
            sellAmountRemaining.left = sellAmount;
        }

        require(
            SafeMath.sub(sellAmountRemaining.left, buyAmount) >= 0,
            "Exchange::ERC1155 remaining is not enough!"
        );

        sellAmountRemaining.left = SafeMath.sub(
            sellAmountRemaining.left,
            buyAmount
        );

        if (sellAmountRemaining.left == 0) {
            delete sellOrderAmountRemaining[hash];
            return (true, buyAmount);
        }

        return (false, buyAmount);
    }

    function makeStaticCall(Order memory order, bool callMint)
        internal
        returns (bytes memory)
    {
        if (callMint) {
            (bool result, bytes memory returnData) = order.target.call(
                order.callData
            );
            require(result, "Exchange::Failed when call other contract");

            return returnData;
        } else {
            /* Retrieve delegateProxy contract. */
            OwnableDelegateProxy delegateProxy = registry.proxies(order.maker);
            /* Proxy must exist. */
            require(
                address(delegateProxy) != address(0),
                "User not registed proxy yet!"
            );
            /* Assert implementation. */
            require(
                delegateProxy.implementation() ==
                    registry.delegateProxyImplementation()
            );
            /* Execute specified call through proxy. */
            (bool result, bytes memory returnData) = AuthenticatedProxy(
                address(delegateProxy)
            ).proxy(order.target, order.howToCall, order.callData);

            require(result, "Exchange::Failed when call other contract");

            return returnData;
        }
    }

    struct MatchOrder {
        bytes32 buyHash;
        bytes32 sellHash;
        address maker;
        address taker;
        uint256 price;
    }

    /**
     * @dev Atomically match two orders, ensuring validity of the match, and execute all associated state transitions. Protected against reentrancy by a contract-global lock.
     * @param buy Buy-side order
     * @param buySig Buy-side order signature
     * @param sell Sell-side order
     * @param sellSig Sell-side order signature
     */
    function atomicMatch(
        Order memory buy,
        Sig memory buySig,
        Order memory sell,
        Sig memory sellSig,
        bytes32 metadata
    ) internal reentrancyGuard {
        MatchOrder memory matchOrder;
        /* CHECKS */
        /* Ensure buy order validity and calculate hash if necessary. */

        bytes32 _sellHash = hashOrder(sell);
        bytes32 _buyHash = hashOrder(buy);

        if (buy.maker == msg.sender) {
            require(validateOrderParameters(buy));
        } else {
            matchOrder.buyHash = requireValidOrder(buy, buySig);
        }
        /* Ensure sell order validity and calculate hash if necessary. */

        if (sell.maker == msg.sender) {
            require(validateOrderParameters(sell));
        } else {
            matchOrder.sellHash = requireValidOrder(sell, sellSig);
        }
        /* Must be matchable. */
        require(
            ordersCanMatch(buy, sell),
            "PlaygroundExchange:: Order not matched"
        );
        /* Target must exist (prevent malicious selfdestructs just prior to order settlement). */
        uint256 size;
        address target = sell.target;
        assembly {
            size := extcodesize(target)
        }
        require(size > 0);

        bytes4 signature;
        bool soldOut = true;
        uint256 amount = 1;

        assembly {
            let sellCallData := mload(add(sell, mul(0x20, 11)))
            signature := mload(add(sellCallData, 0x20))
        }

        if (
            signature == ERC1155_SIGNATURE ||
            signature == 0xf242432a ||
            signature == 0xaba30037 ||
            signature == 0xe8a568db
        ) {
            (soldOut, amount) = _validatePartialSellingAmount(
                buy,
                sell,
                signature == 0xe8a568db
            );
        }

        /* Must match calldata after replacement, if specified. */
        if (buy.replacementPattern.length > 0) {
            ArrayUtils.guardedArrayReplace(
                buy.callData,
                sell.callData,
                buy.replacementPattern
            );
        }

        if (sell.replacementPattern.length > 0) {
            ArrayUtils.guardedArrayReplace(
                sell.callData,
                buy.callData,
                sell.replacementPattern
            );
        }

        require(ArrayUtils.arrayEq(buy.callData, sell.callData));

        /* Mark previously signed or approved orders as finalized. */
        if (msg.sender != buy.maker) {
            cancelledOrFinalized[matchOrder.buyHash] = true;
        }
        if (msg.sender != sell.maker && soldOut) {
            cancelledOrFinalized[matchOrder.sellHash] = true;
        }

        makeStaticCall(
            sell,
            (signature == 0x9f6ed25f || signature == 0xe8a568db)
        );

        uint256 _tokenId;
        assembly {
            let sellCallData := mload(add(sell, mul(0x20, 11)))
            _tokenId := mload(add(sellCallData, add(mul(0x20, 2), 0x04)))
        }
        // /* Execute funds transfer and pay fees. */
        matchOrder.price = executeFundsTransfer(buy, sell, amount, _tokenId);

        matchOrder.maker = buy.maker;
        matchOrder.taker = sell.maker;

        // /* Log match event. */
        emit OrdersMatched(
            _buyHash,
            _sellHash,
            matchOrder.maker,
            matchOrder.taker,
            matchOrder.price,
            _tokenId,
            target,
            amount,
            metadata
        );
    }
}

File 13 of 25 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/*
 * @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 GSN meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address payable) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

File 14 of 25 : OwnableDelegateProxy.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.7.5;

import "./proxy/OwnedUpgradeabilityProxy.sol";

/**
 * @title OwnableDelegateProxy
 * @author Wyvern Protocol Developers
 */
contract OwnableDelegateProxy is OwnedUpgradeabilityProxy {
    constructor(
        address owner,
        address initialImplementation,
        bytes memory data
    ) {
        require(owner != address(0), "owner: zero address");
        require(
            initialImplementation != address(0),
            "initialImplementation: zero address"
        );
        setUpgradeabilityOwner(owner);
        _upgradeTo(initialImplementation);
        (bool success, ) = initialImplementation.delegatecall(data);
        require(success, "OwnableDelegateProxy failed implementation");
    }
}

File 15 of 25 : ProxyRegistryInterface.sol
/*

  Proxy registry interface.

*/
// SPDX-License-Identifier: MIT
pragma solidity 0.7.5;

import "./OwnableDelegateProxy.sol";

/**
 * @title ProxyRegistryInterface
 * @author Wyvern Protocol Developers
 */
interface ProxyRegistryInterface {
    function delegateProxyImplementation() external returns (address);

    function proxies(address owner) external returns (OwnableDelegateProxy);
}

File 16 of 25 : OwnedUpgradeabilityProxy.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.7.5;

import "./Proxy.sol";
import "./OwnedUpgradeabilityStorage.sol";

/**
 * @title OwnedUpgradeabilityProxy
 * @dev This contract combines an upgradeability proxy with basic authorization control functionalities
 */
contract OwnedUpgradeabilityProxy is Proxy, OwnedUpgradeabilityStorage {
    /**
     * @dev Event to show ownership has been transferred
     * @param previousOwner representing the address of the previous owner
     * @param newOwner representing the address of the new owner
     */
    event ProxyOwnershipTransferred(address previousOwner, address newOwner);

    /**
     * @dev This event will be emitted every time the implementation gets upgraded
     * @param implementation representing the address of the upgraded implementation
     */
    event Upgraded(address indexed implementation);

    /**
     * @dev Tells the address of the current implementation
     * @return address of the current implementation
     */
    function implementation() public view override returns (address) {
        return _implementation;
    }

    /**
     * @dev Tells the proxy type (EIP 897)
     * @return proxyTypeId Proxy type, 2 for forwarding proxy
     */
    function proxyType() public pure override returns (uint256 proxyTypeId) {
        return 2;
    }

    /**
     * @dev Upgrades the implementation address
     * @param implementation_ representing the address of the new implementation to be set
     */
    function _upgradeTo(address implementation_) internal {
        require(
            _implementation != implementation_,
            "Proxy already uses this implementation"
        );
        _implementation = implementation_;
        emit Upgraded(implementation_);
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyProxyOwner() {
        require(
            msg.sender == proxyOwner(),
            "Only the proxy owner can call this method"
        );
        _;
    }

    /**
     * @dev Tells the address of the proxy owner
     * @return the address of the proxy owner
     */
    function proxyOwner() public view returns (address) {
        return upgradeabilityOwner();
    }

    /**
     * @dev Allows the current owner to transfer control of the contract to a newOwner.
     * @param newOwner The address to transfer ownership to.
     */
    function transferProxyOwnership(address newOwner) public onlyProxyOwner {
        require(newOwner != address(0), "New owner cannot be the null address");
        emit ProxyOwnershipTransferred(proxyOwner(), newOwner);
        setUpgradeabilityOwner(newOwner);
    }

    /**
     * @dev Allows the upgradeability owner to upgrade the current implementation of the proxy.
     * @param implementation_ representing the address of the new implementation to be set.
     */
    function upgradeTo(address implementation_) public onlyProxyOwner {
        _upgradeTo(implementation_);
    }

    /**
     * @dev Allows the upgradeability owner to upgrade the current implementation of the proxy
     * and delegatecall the new implementation for initialization.
     * @param implementation_ representing the address of the new implementation to be set.
     * @param data represents the msg.data to bet sent in the low level call. This parameter may include the function
     * signature of the implementation to be called with the needed payload
     */
    function upgradeToAndCall(address implementation_, bytes memory data)
        public
        payable
        onlyProxyOwner
    {
        upgradeTo(implementation_);
        (bool success, ) = address(this).delegatecall(data);
        require(success, "Call failed after proxy upgrade");
    }
}

File 17 of 25 : Proxy.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.7.5;

/**
 * @title Proxy
 * @dev Gives the possibility to delegate any call to a foreign implementation.
 */
abstract contract Proxy {
    /**
     * @dev Tells the address of the implementation where every call will be delegated.
     * @return address of the implementation to which it will be delegated
     */
    function implementation() public view virtual returns (address);

    /**
     * @dev Tells the type of proxy (EIP 897)
     * @return proxyTypeId Type of proxy, 2 for upgradeable proxy
     */
    function proxyType() public pure virtual returns (uint256 proxyTypeId);

    /**
     * @dev Fallback function allowing to perform a delegatecall to the given implementation.
     * This function will return whatever the implementation call returns
     */
    fallback() external payable {
        _receiveNativeToken();
    }

    /**
     * @dev Receive function allowing to perform a delegatecall to the given implementation.
     * This function will return whatever the implementation call returns
     */
    receive() external payable {
        _receiveNativeToken();
    }

    function _receiveNativeToken() private {
        address _impl = implementation();
        require(_impl != address(0), "Proxy implementation required");

        assembly {
            let ptr := mload(0x40)
            calldatacopy(ptr, 0, calldatasize())
            let result := delegatecall(gas(), _impl, ptr, calldatasize(), 0, 0)
            let size := returndatasize()
            returndatacopy(ptr, 0, size)

            switch result
            case 0 {
                revert(ptr, size)
            }
            default {
                return(ptr, size)
            }
        }
    }
}

File 18 of 25 : OwnedUpgradeabilityStorage.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.7.5;

/**
 * @title OwnedUpgradeabilityStorage
 * @dev This contract keeps track of the upgradeability owner
 */
contract OwnedUpgradeabilityStorage {
    // Current implementation
    address internal _implementation;

    // Owner of the contract
    address private _upgradeabilityOwner;

    /**
     * @dev Tells the address of the owner
     * @return the address of the owner
     */
    function upgradeabilityOwner() public view returns (address) {
        return _upgradeabilityOwner;
    }

    /**
     * @dev Sets the address of the owner
     */
    function setUpgradeabilityOwner(address newUpgradeabilityOwner) internal {
        _upgradeabilityOwner = newUpgradeabilityOwner;
    }
}

File 19 of 25 : TransferHelper.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0;

// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
    function safeApprove(
        address token,
        address to,
        uint256 value
    ) internal {
        // bytes4(keccak256(bytes('approve(address,uint256)')));
        (bool success, bytes memory data) = token.call(
            abi.encodeWithSelector(0x095ea7b3, to, value)
        );
        require(
            success && (data.length == 0 || abi.decode(data, (bool))),
            "TransferHelper::safeApprove: approve failed"
        );
    }

    function safeTransfer(
        address token,
        address to,
        uint256 value
    ) internal {
        // bytes4(keccak256(bytes('transfer(address,uint256)')));
        (bool success, bytes memory data) = token.call(
            abi.encodeWithSelector(0xa9059cbb, to, value)
        );
        require(
            success && (data.length == 0 || abi.decode(data, (bool))),
            "TransferHelper::safeTransfer: transfer failed"
        );
    }

    function safeTransferFrom(
        address token,
        address from,
        address to,
        uint256 value
    ) internal {
        // bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
        (bool success, bytes memory data) = token.call(
            abi.encodeWithSelector(0x23b872dd, from, to, value)
        );
        require(
            success && (data.length == 0 || abi.decode(data, (bool))),
            "TransferHelper::transferFrom: transferFrom failed"
        );
    }
}

File 20 of 25 : ERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.7.5;

import "./ERC20Basic.sol";

interface ERC20 is ERC20Basic {
    function allowance(address owner, address spender)
        external
        view
        returns (uint256);

    function transferFrom(
        address from,
        address to,
        uint256 value
    ) external returns (bool);

    function approve(address spender, uint256 value) external returns (bool);

    event Approval(
        address indexed owner,
        address indexed spender,
        uint256 value
    );
}

File 21 of 25 : ERC20Basic.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.7.5;

interface ERC20Basic {
    function totalSupply() external view returns (uint256);

    function balanceOf(address who) external view returns (uint256);

    function transfer(address to, uint256 value) external returns (bool);

    event Transfer(address indexed from, address indexed to, uint256 value);
}

File 22 of 25 : TokenRecipient.sol
/*

  Token recipient. Modified very slightly from the example on http://ethereum.org/dao (just to index log parameters).

*/
// SPDX-License-Identifier: MIT
pragma solidity 0.7.5;

import "../modules/ERC20.sol";

/**
 * @title TokenRecipient
 * @author Wyvern Protocol Developers
 */
contract TokenRecipient {
    event ReceivedEther(address indexed sender, uint256 amount);
    event ReceivedTokens(
        address indexed from,
        uint256 value,
        address indexed token,
        bytes extraData
    );

    /**
     * @dev Receive tokens and generate a log event
     * @param from Address from which to transfer tokens
     * @param value Amount of tokens to transfer
     * @param token Address of token
     * @param extraData Additional data to log
     */
    function receiveApproval(
        address from,
        uint256 value,
        address token,
        bytes memory extraData
    ) public {
        ERC20 t = ERC20(token);
        require(
            t.transferFrom(from, address(this), value),
            "ERC20 token transfer failed"
        );
        emit ReceivedTokens(from, value, token, extraData);
    }

    /**
     * @dev Receive Ether and generate a log event
     */
    fallback() external payable {
        emit ReceivedEther(msg.sender, msg.value);
    }

    /**
     * @dev Receive Ether and generate a log event
     */
    receive() external payable {
        emit ReceivedEther(msg.sender, msg.value);
    }
}

File 23 of 25 : IPlaygroundStore.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.7.5;
pragma abicoder v2;

import "../libraries/LibPart.sol";

interface IPlaygroundStore {
    function singleTransfer(
        address _from,
        address _to,
        uint256 _tokenId
    ) external returns (uint256);

    function mintTo(address _to, LibPart.Part memory _royalty)
        external
        returns (uint256);

    function owner() external view returns (address);
}

File 24 of 25 : IRoyaltyFeeRegistry.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.7.5;

interface IRoyaltyFeeRegistry {
    function updateRoyaltyFeeLimit(uint256 _royaltyFeeLimit) external;

    function updateRoyaltyInfoForCollection(
        address collection,
        address setter,
        address receiver,
        uint256 fee
    ) external;

    function updateRoyaltyInfoForNFTCollection(
        address collection,
        uint256 tokenId,
        address setter,
        address receiver,
        uint256 fee
    ) external;

    function royaltyFeeInfoCollection(address collection)
        external
        view
        returns (
            address,
            address,
            uint256
        );

    function royaltyFeeInfoNFTCollection(address collection, uint256 tokenId)
        external
        view
        returns (
            address,
            address,
            uint256
        );

    function royaltyInfo(
        address collection,
        uint256 amount,
        uint256 tokenId
    ) external view returns (address, uint256);
}

File 25 of 25 : LibPart.sol
// SPDX-License-Identifier: MIT pragma
pragma solidity 0.7.5;

library LibPart {
    bytes32 public constant TYPE_HASH =
        keccak256("Part(address account,uint96 value)");

    struct Part {
        address payable account;
        uint96 value;
    }

    function hash(Part memory part) internal pure returns (bytes32) {
        return keccak256(abi.encode(TYPE_HASH, part.account, part.value));
    }
}

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

Contract ABI

[{"inputs":[{"internalType":"contract ProxyRegistry","name":"registryAddress","type":"address"},{"internalType":"contract PlaygroundTransferProxy","name":"tokenTransferProxyAddress","type":"address"},{"internalType":"contract RoyaltyFeeRegistry","name":"royaltyFeeRegistryAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"hash","type":"bytes32"},{"indexed":false,"internalType":"address","name":"exchange","type":"address"},{"indexed":true,"internalType":"address","name":"maker","type":"address"},{"indexed":false,"internalType":"address","name":"taker","type":"address"},{"indexed":false,"internalType":"uint256","name":"makerRelayerFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"takerRelayerFee","type":"uint256"},{"indexed":true,"internalType":"address","name":"feeRecipient","type":"address"},{"indexed":false,"internalType":"enum ExchangeMain.FeeMethod","name":"feeMethod","type":"uint8"},{"indexed":false,"internalType":"enum SaleKindInterface.Side","name":"side","type":"uint8"},{"indexed":false,"internalType":"enum SaleKindInterface.SaleKind","name":"saleKind","type":"uint8"},{"indexed":false,"internalType":"address","name":"target","type":"address"}],"name":"OrderApprovedPartOne","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"hash","type":"bytes32"},{"indexed":false,"internalType":"enum AuthenticatedProxy.HowToCall","name":"howToCall","type":"uint8"},{"indexed":false,"internalType":"bytes","name":"callData","type":"bytes"},{"indexed":false,"internalType":"address","name":"staticTarget","type":"address"},{"indexed":false,"internalType":"bytes","name":"staticExtradata","type":"bytes"},{"indexed":false,"internalType":"address","name":"paymentToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"basePrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"extra","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"listingTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"expirationTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"salt","type":"uint256"},{"indexed":false,"internalType":"bool","name":"orderbookInclusionDesired","type":"bool"}],"name":"OrderApprovedPartTwo","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"hash","type":"bytes32"}],"name":"OrderCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"buyHash","type":"bytes32"},{"indexed":false,"internalType":"bytes32","name":"sellHash","type":"bytes32"},{"indexed":false,"internalType":"address","name":"maker","type":"address"},{"indexed":false,"internalType":"address","name":"taker","type":"address"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"collection","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenAmount","type":"uint256"},{"indexed":true,"internalType":"bytes32","name":"metadata","type":"bytes32"}],"name":"OrdersMatched","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"INVERSE_BASIS_POINT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[7]","name":"addrs","type":"address[7]"},{"internalType":"uint256[7]","name":"uints","type":"uint256[7]"},{"internalType":"enum ExchangeMain.FeeMethod","name":"feeMethod","type":"uint8"},{"internalType":"enum SaleKindInterface.Side","name":"side","type":"uint8"},{"internalType":"enum SaleKindInterface.SaleKind","name":"saleKind","type":"uint8"},{"internalType":"enum AuthenticatedProxy.HowToCall","name":"howToCall","type":"uint8"},{"internalType":"bytes","name":"callData","type":"bytes"},{"internalType":"bytes","name":"replacementPattern","type":"bytes"},{"internalType":"bytes","name":"staticExtradata","type":"bytes"},{"internalType":"bool","name":"orderbookInclusionDesired","type":"bool"}],"name":"approveOrder_","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"approvedOrders","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[14]","name":"addrs","type":"address[14]"},{"internalType":"uint256[14]","name":"uints","type":"uint256[14]"},{"internalType":"uint8[8]","name":"feeMethodsSidesKindsHowToCalls","type":"uint8[8]"},{"internalType":"bytes","name":"calldataBuy","type":"bytes"},{"internalType":"bytes","name":"calldataSell","type":"bytes"},{"internalType":"bytes","name":"replacementPatternBuy","type":"bytes"},{"internalType":"bytes","name":"replacementPatternSell","type":"bytes"},{"internalType":"bytes","name":"staticExtradataBuy","type":"bytes"},{"internalType":"bytes","name":"staticExtradataSell","type":"bytes"},{"internalType":"uint8[2]","name":"vs","type":"uint8[2]"},{"internalType":"bytes32[5]","name":"rssMetadata","type":"bytes32[5]"}],"name":"atomicMatch_","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address[7]","name":"addrs","type":"address[7]"},{"internalType":"uint256[7]","name":"uints","type":"uint256[7]"},{"internalType":"enum ExchangeMain.FeeMethod","name":"feeMethod","type":"uint8"},{"internalType":"enum SaleKindInterface.Side","name":"side","type":"uint8"},{"internalType":"enum SaleKindInterface.SaleKind","name":"saleKind","type":"uint8"},{"internalType":"enum AuthenticatedProxy.HowToCall","name":"howToCall","type":"uint8"},{"internalType":"bytes","name":"callData","type":"bytes"},{"internalType":"bytes","name":"replacementPattern","type":"bytes"},{"internalType":"bytes","name":"staticExtradata","type":"bytes"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"calculateCurrentPrice_","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum SaleKindInterface.Side","name":"side","type":"uint8"},{"internalType":"enum SaleKindInterface.SaleKind","name":"saleKind","type":"uint8"},{"internalType":"uint256","name":"basePrice","type":"uint256"},{"internalType":"uint256","name":"extra","type":"uint256"},{"internalType":"uint256","name":"listingTime","type":"uint256"},{"internalType":"uint256","name":"expirationTime","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"calculateFinalPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[14]","name":"addrs","type":"address[14]"},{"internalType":"uint256[14]","name":"uints","type":"uint256[14]"},{"internalType":"uint8[8]","name":"feeMethodsSidesKindsHowToCalls","type":"uint8[8]"},{"internalType":"bytes","name":"calldataBuy","type":"bytes"},{"internalType":"bytes","name":"calldataSell","type":"bytes"},{"internalType":"bytes","name":"replacementPatternBuy","type":"bytes"},{"internalType":"bytes","name":"replacementPatternSell","type":"bytes"},{"internalType":"bytes","name":"staticExtradataBuy","type":"bytes"},{"internalType":"bytes","name":"staticExtradataSell","type":"bytes"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"calculateMatchPrice_","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[7]","name":"addrs","type":"address[7]"},{"internalType":"uint256[7]","name":"uints","type":"uint256[7]"},{"internalType":"enum ExchangeMain.FeeMethod","name":"feeMethod","type":"uint8"},{"internalType":"enum SaleKindInterface.Side","name":"side","type":"uint8"},{"internalType":"enum SaleKindInterface.SaleKind","name":"saleKind","type":"uint8"},{"internalType":"enum AuthenticatedProxy.HowToCall","name":"howToCall","type":"uint8"},{"internalType":"bytes","name":"callData","type":"bytes"},{"internalType":"bytes","name":"replacementPattern","type":"bytes"},{"internalType":"bytes","name":"staticExtradata","type":"bytes"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"cancelOrder_","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"cancelledOrFinalized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[7]","name":"addrs","type":"address[7]"},{"internalType":"uint256[7]","name":"uints","type":"uint256[7]"},{"internalType":"enum ExchangeMain.FeeMethod","name":"feeMethod","type":"uint8"},{"internalType":"enum SaleKindInterface.Side","name":"side","type":"uint8"},{"internalType":"enum SaleKindInterface.SaleKind","name":"saleKind","type":"uint8"},{"internalType":"enum AuthenticatedProxy.HowToCall","name":"howToCall","type":"uint8"},{"internalType":"bytes","name":"callData","type":"bytes"},{"internalType":"bytes","name":"replacementPattern","type":"bytes"},{"internalType":"bytes","name":"staticExtradata","type":"bytes"}],"name":"hashOrder_","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address[7]","name":"addrs","type":"address[7]"},{"internalType":"uint256[7]","name":"uints","type":"uint256[7]"},{"internalType":"enum ExchangeMain.FeeMethod","name":"feeMethod","type":"uint8"},{"internalType":"enum SaleKindInterface.Side","name":"side","type":"uint8"},{"internalType":"enum SaleKindInterface.SaleKind","name":"saleKind","type":"uint8"},{"internalType":"enum AuthenticatedProxy.HowToCall","name":"howToCall","type":"uint8"},{"internalType":"bytes","name":"callData","type":"bytes"},{"internalType":"bytes","name":"replacementPattern","type":"bytes"},{"internalType":"bytes","name":"staticExtradata","type":"bytes"}],"name":"hashToSign_","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[14]","name":"addrs","type":"address[14]"},{"internalType":"uint256[14]","name":"uints","type":"uint256[14]"},{"internalType":"uint8[8]","name":"feeMethodsSidesKindsHowToCalls","type":"uint8[8]"},{"internalType":"bytes","name":"calldataBuy","type":"bytes"},{"internalType":"bytes","name":"calldataSell","type":"bytes"},{"internalType":"bytes","name":"replacementPatternBuy","type":"bytes"},{"internalType":"bytes","name":"replacementPatternSell","type":"bytes"},{"internalType":"bytes","name":"staticExtradataBuy","type":"bytes"},{"internalType":"bytes","name":"staticExtradataSell","type":"bytes"}],"name":"ordersCanMatch_","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"registry","outputs":[{"internalType":"contract ProxyRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"royaltyFeeRegistry","outputs":[{"internalType":"contract IRoyaltyFeeRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"sellOrderAmountRemaining","outputs":[{"internalType":"bool","name":"tracking","type":"bool"},{"internalType":"uint256","name":"left","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenTransferProxy","outputs":[{"internalType":"contract PlaygroundTransferProxy","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[7]","name":"addrs","type":"address[7]"},{"internalType":"uint256[7]","name":"uints","type":"uint256[7]"},{"internalType":"enum ExchangeMain.FeeMethod","name":"feeMethod","type":"uint8"},{"internalType":"enum SaleKindInterface.Side","name":"side","type":"uint8"},{"internalType":"enum SaleKindInterface.SaleKind","name":"saleKind","type":"uint8"},{"internalType":"enum AuthenticatedProxy.HowToCall","name":"howToCall","type":"uint8"},{"internalType":"bytes","name":"callData","type":"bytes"},{"internalType":"bytes","name":"replacementPattern","type":"bytes"},{"internalType":"bytes","name":"staticExtradata","type":"bytes"}],"name":"validateOrderParameters_","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[7]","name":"addrs","type":"address[7]"},{"internalType":"uint256[7]","name":"uints","type":"uint256[7]"},{"internalType":"enum ExchangeMain.FeeMethod","name":"feeMethod","type":"uint8"},{"internalType":"enum SaleKindInterface.Side","name":"side","type":"uint8"},{"internalType":"enum SaleKindInterface.SaleKind","name":"saleKind","type":"uint8"},{"internalType":"enum AuthenticatedProxy.HowToCall","name":"howToCall","type":"uint8"},{"internalType":"bytes","name":"callData","type":"bytes"},{"internalType":"bytes","name":"replacementPattern","type":"bytes"},{"internalType":"bytes","name":"staticExtradata","type":"bytes"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"validateOrder_","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]

60806040526000805460ff191690553480156200001b57600080fd5b5060405162005d3238038062005d32833981810160405260608110156200004157600080fd5b508051602082015160409092015190919060006200005e620000f1565b60008054610100600160a81b0319166101006001600160a01b038416908102919091178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350600380546001600160a01b03199081166001600160a01b039384161790915560018054821694831694909417909355600280549093169116179055620000f5565b3390565b615c2d80620001056000396000f3fe6080604052600436106101355760003560e01c80638da5cb5b116100ab578063c16f51561161006f578063c16f5156146118a4578063cae6047f146118b9578063ce2cb088146118ce578063d040944114611b0a578063e57d4adb14611ee3578063f2fde38b14611f0d57610135565b80638da5cb5b146111925780639c57bf6b146111a7578063a27958ae146111ec578063a37c73371461142a578063accf45171461166857610135565b8063715018a6116100fd578063715018a6146108c95780637a5e68cf146108de5780637b10399914610cb95780637b49486f14610cce5780638076f00514610f2c57806382c8878514610f5657610135565b806306fdde031461013a5780630eefdbad146101c457806316bb9828146101f557806356d8a0a9146106185780636b6a254814610862575b600080fd5b34801561014657600080fd5b5061014f611f40565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610189578181015183820152602001610171565b50505050905090810190601f1680156101b65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101d057600080fd5b506101d9611f6f565b604080516001600160a01b039092168252519081900360200190f35b610616600480360361062081101561020c57600080fd5b81019080806101c00190600e806020026040519081016040528092919082600e6020028082843760009201919091525050604080516101c08181019092529295949381810193925090600e90839083908082843760009201919091525050604080516101008181019092529295949381810193925090600890839083908082843760009201919091525091949392602081019250359050600160201b8111156102b457600080fd5b8201836020820111156102c657600080fd5b803590602001918460018302840111600160201b831117156102e757600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561033957600080fd5b82018360208201111561034b57600080fd5b803590602001918460018302840111600160201b8311171561036c57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b8111156103be57600080fd5b8201836020820111156103d057600080fd5b803590602001918460018302840111600160201b831117156103f157600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561044357600080fd5b82018360208201111561045557600080fd5b803590602001918460018302840111600160201b8311171561047657600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b8111156104c857600080fd5b8201836020820111156104da57600080fd5b803590602001918460018302840111600160201b831117156104fb57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561054d57600080fd5b82018360208201111561055f57600080fd5b803590602001918460018302840111600160201b8311171561058057600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250506040805180820182529396959481810194935091506002908390839080828437600092019190915250506040805160a081810190925292959493818101939250906005908390839080828437600092019190915250919450611f7e9350505050565b005b34801561062457600080fd5b50610616600480360361030081101561063c57600080fd5b810190808060e001906007806020026040519081016040528092919082600760200280828437600092019190915250506040805160e081810190925292959493818101939250906007908390839080828437600092019190915250919460ff84358116956020860135821695604081013583169550606081013590921693509060a081019060800135600160201b8111156106d657600080fd5b8201836020820111156106e857600080fd5b803590602001918460018302840111600160201b8311171561070957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561075b57600080fd5b82018360208201111561076d57600080fd5b803590602001918460018302840111600160201b8311171561078e57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b8111156107e057600080fd5b8201836020820111156107f257600080fd5b803590602001918460018302840111600160201b8311171561081357600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505060ff8335169350505060208101359060400135612454565b34801561086e57600080fd5b506108b7600480360360e081101561088557600080fd5b5060ff813581169160208101359091169060408101359060608101359060808101359060a08101359060c00135612654565b60408051918252519081900360200190f35b3480156108d557600080fd5b50610616612673565b3480156108ea57600080fd5b506108b7600480360361056081101561090257600080fd5b81019080806101c00190600e806020026040519081016040528092919082600e6020028082843760009201919091525050604080516101c08181019092529295949381810193925090600e90839083908082843760009201919091525050604080516101008181019092529295949381810193925090600890839083908082843760009201919091525091949392602081019250359050600160201b8111156109aa57600080fd5b8201836020820111156109bc57600080fd5b803590602001918460018302840111600160201b831117156109dd57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b811115610a2f57600080fd5b820183602082011115610a4157600080fd5b803590602001918460018302840111600160201b83111715610a6257600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b811115610ab457600080fd5b820183602082011115610ac657600080fd5b803590602001918460018302840111600160201b83111715610ae757600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b811115610b3957600080fd5b820183602082011115610b4b57600080fd5b803590602001918460018302840111600160201b83111715610b6c57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b811115610bbe57600080fd5b820183602082011115610bd057600080fd5b803590602001918460018302840111600160201b83111715610bf157600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b811115610c4357600080fd5b820183602082011115610c5557600080fd5b803590602001918460018302840111600160201b83111715610c7657600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505091359250612736915050565b348015610cc557600080fd5b506101d9612b74565b348015610cda57600080fd5b50610f186004803603610300811015610cf257600080fd5b810190808060e001906007806020026040519081016040528092919082600760200280828437600092019190915250506040805160e081810190925292959493818101939250906007908390839080828437600092019190915250919460ff84358116956020860135821695604081013583169550606081013590921693509060a081019060800135600160201b811115610d8c57600080fd5b820183602082011115610d9e57600080fd5b803590602001918460018302840111600160201b83111715610dbf57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b811115610e1157600080fd5b820183602082011115610e2357600080fd5b803590602001918460018302840111600160201b83111715610e4457600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b811115610e9657600080fd5b820183602082011115610ea857600080fd5b803590602001918460018302840111600160201b83111715610ec957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505060ff8335169350505060208101359060400135612b83565b604080519115158252519081900360200190f35b348015610f3857600080fd5b50610f1860048036036020811015610f4f57600080fd5b5035612d86565b348015610f6257600080fd5b506108b760048036036102a0811015610f7a57600080fd5b810190808060e001906007806020026040519081016040528092919082600760200280828437600092019190915250506040805160e081810190925292959493818101939250906007908390839080828437600092019190915250919460ff84358116956020860135821695604081013583169550606081013590921693509060a081019060800135600160201b81111561101457600080fd5b82018360208201111561102657600080fd5b803590602001918460018302840111600160201b8311171561104757600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561109957600080fd5b8201836020820111156110ab57600080fd5b803590602001918460018302840111600160201b831117156110cc57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561111e57600080fd5b82018360208201111561113057600080fd5b803590602001918460018302840111600160201b8311171561115157600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550612d9b945050505050565b34801561119e57600080fd5b506101d9612f71565b3480156111b357600080fd5b506111d1600480360360208110156111ca57600080fd5b5035612f85565b60408051921515835260208301919091528051918290030190f35b3480156111f857600080fd5b5061061660048036036102c081101561121057600080fd5b810190808060e001906007806020026040519081016040528092919082600760200280828437600092019190915250506040805160e081810190925292959493818101939250906007908390839080828437600092019190915250919460ff84358116956020860135821695604081013583169550606081013590921693509060a081019060800135600160201b8111156112aa57600080fd5b8201836020820111156112bc57600080fd5b803590602001918460018302840111600160201b831117156112dd57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561132f57600080fd5b82018360208201111561134157600080fd5b803590602001918460018302840111600160201b8311171561136257600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b8111156113b457600080fd5b8201836020820111156113c657600080fd5b803590602001918460018302840111600160201b831117156113e757600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505050503515159050612fa4565b34801561143657600080fd5b506108b760048036036102c081101561144e57600080fd5b810190808060e001906007806020026040519081016040528092919082600760200280828437600092019190915250506040805160e081810190925292959493818101939250906007908390839080828437600092019190915250919460ff84358116956020860135821695604081013583169550606081013590921693509060a081019060800135600160201b8111156114e857600080fd5b8201836020820111156114fa57600080fd5b803590602001918460018302840111600160201b8311171561151b57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561156d57600080fd5b82018360208201111561157f57600080fd5b803590602001918460018302840111600160201b831117156115a057600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b8111156115f257600080fd5b82018360208201111561160457600080fd5b803590602001918460018302840111600160201b8311171561162557600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550509135925061311a915050565b34801561167457600080fd5b50610f1860048036036102a081101561168c57600080fd5b810190808060e001906007806020026040519081016040528092919082600760200280828437600092019190915250506040805160e081810190925292959493818101939250906007908390839080828437600092019190915250919460ff84358116956020860135821695604081013583169550606081013590921693509060a081019060800135600160201b81111561172657600080fd5b82018360208201111561173857600080fd5b803590602001918460018302840111600160201b8311171561175957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b8111156117ab57600080fd5b8201836020820111156117bd57600080fd5b803590602001918460018302840111600160201b831117156117de57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561183057600080fd5b82018360208201111561184257600080fd5b803590602001918460018302840111600160201b8311171561186357600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506132f2945050505050565b3480156118b057600080fd5b506101d9613469565b3480156118c557600080fd5b506108b7613478565b3480156118da57600080fd5b506108b760048036036102a08110156118f257600080fd5b810190808060e001906007806020026040519081016040528092919082600760200280828437600092019190915250506040805160e081810190925292959493818101939250906007908390839080828437600092019190915250919460ff84358116956020860135821695604081013583169550606081013590921693509060a081019060800135600160201b81111561198c57600080fd5b82018360208201111561199e57600080fd5b803590602001918460018302840111600160201b831117156119bf57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b811115611a1157600080fd5b820183602082011115611a2357600080fd5b803590602001918460018302840111600160201b83111715611a4457600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b811115611a9657600080fd5b820183602082011115611aa857600080fd5b803590602001918460018302840111600160201b83111715611ac957600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061347e945050505050565b348015611b1657600080fd5b50610f186004803603610540811015611b2e57600080fd5b81019080806101c00190600e806020026040519081016040528092919082600e6020028082843760009201919091525050604080516101c08181019092529295949381810193925090600e90839083908082843760009201919091525050604080516101008181019092529295949381810193925090600890839083908082843760009201919091525091949392602081019250359050600160201b811115611bd657600080fd5b820183602082011115611be857600080fd5b803590602001918460018302840111600160201b83111715611c0957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b811115611c5b57600080fd5b820183602082011115611c6d57600080fd5b803590602001918460018302840111600160201b83111715611c8e57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b811115611ce057600080fd5b820183602082011115611cf257600080fd5b803590602001918460018302840111600160201b83111715611d1357600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b811115611d6557600080fd5b820183602082011115611d7757600080fd5b803590602001918460018302840111600160201b83111715611d9857600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b811115611dea57600080fd5b820183602082011115611dfc57600080fd5b803590602001918460018302840111600160201b83111715611e1d57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b811115611e6f57600080fd5b820183602082011115611e8157600080fd5b803590602001918460018302840111600160201b83111715611ea257600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550613646945050505050565b348015611eef57600080fd5b50610f1860048036036020811015611f0657600080fd5b50356139cf565b348015611f1957600080fd5b5061061660048036036020811015611f3057600080fd5b50356001600160a01b03166139e4565b60405180604001604052806013815260200172506c617967726f756e642045786368616e676560681b81525081565b6002546001600160a01b031681565b612447604051806102a001604052808d6000600e8110611f9a57fe5b60200201516001600160a01b031681526020018d6001600e8110611fba57fe5b60200201516001600160a01b031681526020018d6002600e8110611fda57fe5b60200201516001600160a01b031681526020018c6000600e8110611ffa57fe5b602002015181526020018c6001600e811061201157fe5b602002015181526020018d6003600e811061202857fe5b60200201516001600160a01b031681526020018b60006008811061204857fe5b602002015160ff16600181111561205b57fe5b600181111561206657fe5b81526020018b6001602002015160ff16600181111561208157fe5b600181111561208c57fe5b81526020018b6002602002015160ff1660018111156120a757fe5b60018111156120b257fe5b815260808e01516001600160a01b031660208201526040018b6003602002015160ff1660018111156120e057fe5b60018111156120eb57fe5b8152602081018b90526040810189905260a0808f01516001600160a01b0316606083015260808201889052018d600660200201516001600160a01b031681526020018c6002600e811061213a57fe5b602002015181526020018c6003600e811061215157fe5b602002015181526020018c6004600e811061216857fe5b602002015181526020018c6005600e811061217f57fe5b602002015181526020018c6006600e811061219657fe5b6020908102919091015190915260408051606081018252865160ff168152855192810192909252810184600160200201519052604080516102a08101909152808f600760200201516001600160a01b031681526020018f6008600e81106121f957fe5b60200201516001600160a01b031681526020018f6009600e811061221957fe5b60200201516001600160a01b031681526020018e6007600e811061223957fe5b602002015181526020018e6008600e811061225057fe5b602002015181526020018f600a600e811061226757fe5b60200201516001600160a01b031681526020018d60046008811061228757fe5b602002015160ff16600181111561229a57fe5b60018111156122a557fe5b81526020018d6005602002015160ff1660018111156122c057fe5b60018111156122cb57fe5b81526020018d6006602002015160ff1660018111156122e657fe5b60018111156122f157fe5b81526020018f600b60200201516001600160a01b031681526020018d60076008811061231957fe5b602002015160ff16600181111561232c57fe5b600181111561233757fe5b8152602081018c9052604081018a90526060018f600c60200201516001600160a01b031681526020018781526020018f600d600e811061237357fe5b60200201516001600160a01b031681526020018e6009600e811061239357fe5b602002015181526020018e600a600e81106123aa57fe5b602002015181526020018e600b600e81106123c157fe5b602002015181526020018e600c600e81106123d857fe5b602002015181526020018e600d600e81106123ef57fe5b60200201519052604080516060810190915280876001602002015160ff1681526020018660026005811061241f57fe5b602002015181526020018660036005811061243657fe5b602002015190526080860151613b03565b5050505050505050505050565b612646604051806102a001604052808e60006007811061247057fe5b60200201516001600160a01b031681526020018e60016007811061249057fe5b60200201516001600160a01b031681526020018e6002600781106124b057fe5b60200201516001600160a01b031681526020018d6000600781106124d057fe5b602002015181526020018d6001600781106124e757fe5b602002015181526020018e6003600781106124fe57fe5b60200201516001600160a01b031681526020018c600181111561251d57fe5b81526020018b600181111561252e57fe5b81526020018a600181111561253f57fe5b815260808f01516001600160a01b0316602082015260400189600181111561256357fe5b815260208101899052604081018890526060018e600560200201516001600160a01b031681526020018681526020018e60066007811061259f57fe5b60200201516001600160a01b031681526020018d6002600781106125bf57fe5b602002015181526020018d6003600781106125d657fe5b602002015181526020018d6004600781106125ed57fe5b602002015181526020018d60056007811061260457fe5b602002015181526020018d60066007811061261b57fe5b602002015181525060405180606001604052808660ff16815260200185815260200184815250613ec5565b505050505050505050505050565b600061266588888888888888613f48565b90505b979650505050505050565b61267b613fed565b6001600160a01b031661268c612f71565b6001600160a01b0316146126e7576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516101009091046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a360008054610100600160a81b0319169055565b60006127406155c0565b604080516102a081019091528c516001600160a01b03168152602081018d600160200201516001600160a01b031681526020018d6002600e811061278057fe5b60200201516001600160a01b031681526020018c6000600e81106127a057fe5b602002015181526020018c6001600e81106127b757fe5b602002015181526020018d6003600e81106127ce57fe5b60200201516001600160a01b031681526020018b6000600881106127ee57fe5b602002015160ff16600181111561280157fe5b600181111561280c57fe5b81526020018b6001602002015160ff16600181111561282757fe5b600181111561283257fe5b81526020018b6002602002015160ff16600181111561284d57fe5b600181111561285857fe5b815260808e01516001600160a01b031660208201526040018b6003602002015160ff16600181111561288657fe5b600181111561289157fe5b8152602081018b90526040810189905260a0808f01516001600160a01b0316606083015260808201889052018d600660200201516001600160a01b031681526020018c6002600e81106128e057fe5b602002015181526020018c6003600e81106128f757fe5b602002015181526020018c6004600e811061290e57fe5b602002015181526020018c6005600e811061292557fe5b602002015181526020018c6006600e811061293c57fe5b60200201519052905061294d6155c0565b604080516102a0810190915260e08e01516001600160a01b03168152602081018e600860200201516001600160a01b031681526020018e6009600e811061299057fe5b60200201516001600160a01b031681526020018d6007600e81106129b057fe5b602002015181526020018d6008600e81106129c757fe5b602002015181526020018e600a600e81106129de57fe5b60200201516001600160a01b031681526020018c6004600881106129fe57fe5b602002015160ff166001811115612a1157fe5b6001811115612a1c57fe5b81526020018c6005602002015160ff166001811115612a3757fe5b6001811115612a4257fe5b81526020018c6006602002015160ff166001811115612a5d57fe5b6001811115612a6857fe5b81526101608f01516001600160a01b031660208201526040018c6007602002015160ff166001811115612a9757fe5b6001811115612aa257fe5b8152602081018b9052604081018990526101808f01516001600160a01b031660608201526080810187905260a0018e600d60200201516001600160a01b031681526020018d6009600e8110612af357fe5b602002015181526020018d600a600e8110612b0a57fe5b602002015181526020018d600b600e8110612b2157fe5b602002015181526020018d600c600e8110612b3857fe5b602002015181526020018d600d600e8110612b4f57fe5b602002015190529050612b63828286613ff1565b9d9c50505050505050505050505050565b6001546001600160a01b031681565b6000612b8d6155c0565b604080516102a081019091528e516001600160a01b03168152602081018f600160200201516001600160a01b031681526020018f600260078110612bcd57fe5b60200201516001600160a01b031681526020018e600060078110612bed57fe5b602002015181526020018e600160078110612c0457fe5b602002015181526020018f600360078110612c1b57fe5b60200201516001600160a01b031681526020018d6001811115612c3a57fe5b81526020018c6001811115612c4b57fe5b81526020018b6001811115612c5c57fe5b81526020018f600460200201516001600160a01b031681526020018a6001811115612c8357fe5b8152602081018a9052604081018990526060018f600560200201516001600160a01b031681526020018781526020018f600660078110612cbf57fe5b60200201516001600160a01b031681526020018e600260078110612cdf57fe5b602002015181526020018e600360078110612cf657fe5b602002015181526020018e600460078110612d0d57fe5b602002015181526020018e600560078110612d2457fe5b602002015181526020018e600660078110612d3b57fe5b602002015190529050612d74612d5082614085565b8260405180606001604052808960ff168152602001888152602001878152506140be565b9e9d5050505050505050505050505050565b60056020526000908152604090205460ff1681565b6000612f63604051806102a001604052808c600060078110612db957fe5b60200201516001600160a01b031681526020018c600160078110612dd957fe5b60200201516001600160a01b031681526020018c600260078110612df957fe5b60200201516001600160a01b031681526020018b600060078110612e1957fe5b602002015181526020018b600160078110612e3057fe5b602002015181526020018c600360078110612e4757fe5b60200201516001600160a01b031681526020018a6001811115612e6657fe5b8152602001896001811115612e7757fe5b8152602001886001811115612e8857fe5b815260808d01516001600160a01b03166020820152604001876001811115612eac57fe5b8152602081018790526040810186905260a0808e01516001600160a01b0316606083015260808201869052018c600660200201516001600160a01b031681526020018b600260078110612efb57fe5b602002015181526020018b600360078110612f1257fe5b602002015181526020018b600460078110612f2957fe5b602002015181526020018b600560078110612f4057fe5b602002015181526020018b600660078110612f5757fe5b60200201519052614085565b9a9950505050505050505050565b60005461010090046001600160a01b031690565b6004602052600090815260409020805460019091015460ff9091169082565b612fac6155c0565b604080516102a0810182528c516001600160a01b0390811682526020808f01518216818401528e840151909116928201929092528b516060820152908b0151608082015260a081018c600360200201516001600160a01b031681526020018a600181111561301657fe5b815260200189600181111561302757fe5b815260200188600181111561303857fe5b815260808d01516001600160a01b0316602082015260400187600181111561305c57fe5b8152602081018790526040810186905260a0808e01516001600160a01b0316606083015260808201869052018c600660200201516001600160a01b031681526020018b6002600781106130ab57fe5b602002015181526020018b6003600781106130c257fe5b602002015181526020018b6004600781106130d957fe5b602002015181526020018b6005600781106130f057fe5b602002015181526020018b60066007811061310757fe5b602002015190529050612447818361419d565b60006132e3604051806102a001604052808d60006007811061313857fe5b60200201516001600160a01b031681526020018d60016007811061315857fe5b60200201516001600160a01b031681526020018d60026007811061317857fe5b60200201516001600160a01b031681526020018c60006007811061319857fe5b602002015181526020018c6001600781106131af57fe5b602002015181526020018d6003600781106131c657fe5b60200201516001600160a01b031681526020018b60018111156131e557fe5b81526020018a60018111156131f657fe5b815260200189600181111561320757fe5b815260808e01516001600160a01b0316602082015260400188600181111561322b57fe5b8152602081018890526040810187905260a0808f01516001600160a01b0316606083015260808201879052018d600660200201516001600160a01b031681526020018c60026007811061327a57fe5b602002015181526020018c60036007811061329157fe5b602002015181526020018c6004600781106132a857fe5b602002015181526020018c6005600781106132bf57fe5b602002015181526020018c6006600781106132d657fe5b602002015190528361431c565b9b9a5050505050505050505050565b60006132fc6155c0565b604080516102a0810182528c516001600160a01b0390811682526020808f01518216818401528e840151909116928201929092528b516060820152908b0151608082015260a081018c600360200201516001600160a01b031681526020018a600181111561336657fe5b815260200189600181111561337757fe5b815260200188600181111561338857fe5b815260808d01516001600160a01b031660208201526040018760018111156133ac57fe5b8152602081018790526040810186905260a0808e01516001600160a01b0316606083015260808201869052018c600660200201516001600160a01b031681526020018b6002600781106133fb57fe5b602002015181526020018b60036007811061341257fe5b602002015181526020018b60046007811061342957fe5b602002015181526020018b60056007811061344057fe5b602002015181526020018b60066007811061345757fe5b6020020151905290506132e381614353565b6003546001600160a01b031681565b61271081565b6000612f63604051806102a001604052808c60006007811061349c57fe5b60200201516001600160a01b031681526020018c6001600781106134bc57fe5b60200201516001600160a01b031681526020018c6002600781106134dc57fe5b60200201516001600160a01b031681526020018b6000600781106134fc57fe5b602002015181526020018b60016007811061351357fe5b602002015181526020018c60036007811061352a57fe5b60200201516001600160a01b031681526020018a600181111561354957fe5b815260200189600181111561355a57fe5b815260200188600181111561356b57fe5b815260808d01516001600160a01b0316602082015260400187600181111561358f57fe5b8152602081018790526040810186905260a0808e01516001600160a01b0316606083015260808201869052018c600660200201516001600160a01b031681526020018b6002600781106135de57fe5b602002015181526020018b6003600781106135f557fe5b602002015181526020018b60046007811061360c57fe5b602002015181526020018b60056007811061362357fe5b602002015181526020018b60066007811061363a57fe5b60200201519052614397565b60006136506155c0565b604080516102a0810182528c516001600160a01b0390811682526020808f01518216818401528e8401518216938301939093528c51606080840191909152928d01516080830152918d015190911660a0820152895160c082019060ff1660018111156136b857fe5b60018111156136c357fe5b81526020018a6001602002015160ff1660018111156136de57fe5b60018111156136e957fe5b81526020018a6002602002015160ff16600181111561370457fe5b600181111561370f57fe5b815260808d01516001600160a01b031660208201526040018a6003602002015160ff16600181111561373d57fe5b600181111561374857fe5b8152602081018a90526040810188905260a0808e01516001600160a01b0316606083015260808201879052018c600660200201516001600160a01b031681526020018b6002600e811061379757fe5b602002015181526020018b6003600e81106137ae57fe5b602002015181526020018b6004600e81106137c557fe5b602002015181526020018b6005600e81106137dc57fe5b602002015181526020018b6006600e81106137f357fe5b6020020151905290506138046155c0565b604080516102a08101825260e08e01516001600160a01b0390811682526101008f0151811660208301526101208f01511691810191909152606081018c6007602002015181526020018c6008600e811061385a57fe5b602002015181526020018d600a600e811061387157fe5b60200201516001600160a01b031681526020018b60046008811061389157fe5b602002015160ff1660018111156138a457fe5b60018111156138af57fe5b81526020018b6005602002015160ff1660018111156138ca57fe5b60018111156138d557fe5b81526020018b6006602002015160ff1660018111156138f057fe5b60018111156138fb57fe5b81526101608e01516001600160a01b031660208201526040018b6007602002015160ff16600181111561392a57fe5b600181111561393557fe5b8152602081018a9052604081018890526101808e01516001600160a01b039081166060830152608082018790526101a08f01511660a08201526101208d81015160c08301526101408e015160e08301526101608e0151610100830152018c600c602002015181526020018c600d600e81106139ac57fe5b6020020151905290506139bf8282614575565b9c9b505050505050505050505050565b60066020526000908152604090205460ff1681565b6139ec613fed565b6001600160a01b03166139fd612f71565b6001600160a01b031614613a58576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038116613a9d5760405162461bcd60e51b8152600401808060200182810382526026815260200180615b8c6026913960400191505060405180910390fd5b600080546040516001600160a01b038085169361010090930416917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b60005460ff1615613b51576040805162461bcd60e51b81526020600482015260136024820152721499595b9d1c985b98de4819195d1958dd1959606a1b604482015290519081900360640190fd5b6000805460ff19166001179055613b66615675565b6000613b7185614397565b90506000613b7e88614397565b60208901519091506001600160a01b0316331415613bad57613b9f88614353565b613ba857600080fd5b613bba565b613bb7888861474b565b83525b60208601516001600160a01b0316331415613be657613bd886614353565b613be157600080fd5b613bf6565b613bf0868661474b565b60208401525b613c008887614575565b613c255760405162461bcd60e51b8152600401613c1c90615a2d565b60405180910390fd5b610120860151803b9081613c3857600080fd5b610160880151602001516001806001600160e01b031983166309390beb60e11b1480613c745750637921219560e11b6001600160e01b03198416145b80613c8f575063aba3003760e01b6001600160e01b03198416145b80613caa575063e8a568db60e01b6001600160e01b03198416145b15613cd357613ccd8d8c63e8a568db60e01b6001600160e01b0319871614614780565b90925090505b6101808d01515115613cf957613cf98d61016001518c61016001518f6101800151614887565b6101808b01515115613d1f57613d1f8b61016001518e61016001518d6101800151614887565b613d338d61016001518c6101600151614a3d565b613d3c57600080fd5b8c602001516001600160a01b0316336001600160a01b031614613d755787516000908152600560205260409020805460ff191660011790555b8a602001516001600160a01b0316336001600160a01b031614158015613d985750815b15613dbd576020808901516000908152600590915260409020805460ff191660011790555b613df58b639f6ed25f60e01b6001600160e01b031986161480613df0575063e8a568db60e01b6001600160e01b03198616145b614aa1565b506101608b015160440151613e0c8e8d8484614dc0565b8960800181815250508d6020015189604001906001600160a01b031690816001600160a01b0316815250508b6020015189606001906001600160a01b031690816001600160a01b031681525050897fe7a1db1f6ecefcc453c6281929883772b09e803260cad416021d547dd2f0d02f888a8c604001518d606001518e60800151878c8a604051613ea398979695949392919061591b565b60405180910390a250506000805460ff19169055505050505050505050505050565b6000613ed083614397565b90506000613ede848461474b565b905083602001516001600160a01b0316336001600160a01b031614613f0257600080fd5b600081815260056020526040808220805460ff191660011790555183917f5152abf959f6564662358c2e52b702259b78bac5ee7842a0f01937e670efcc7d91a250505050565b600080876001811115613f5757fe5b1415613f6e57613f6786836152fc565b9050612668565b6001876001811115613f7c57fe5b1415612668576000613fa9613f9a87613f954289615355565b6152fc565b613fa48688615355565b6153b2565b90506001896001811115613fb957fe5b1415613fda57613fd2613fcc88856152fc565b82615355565b915050612668565b613fd2613fe788856152fc565b82615419565b3390565b6000806140208460e0015185610100015186610200015187610220015188610240015189610260015189613f48565b905060006140508660e001518761010001518861020001518961022001518a61024001518b61026001518a613f48565b90508181101561405f57600080fd5b60a08501516001600160a01b03166140775780614079565b815b925050505b9392505050565b600061409082614397565b6040516020016140a091906157e5565b6040516020818303038152906040528051906020012090505b919050565b60006140c983614353565b6140d55750600061407e565b60008481526005602052604090205460ff16156140f45750600061407e565b60008481526006602052604090205460ff16156141135750600161407e565b82602001516001600160a01b031660018584600001518560200151866040015160405160008152602001604052604051614150949392919061595d565b6020604051602081039080840390855afa158015614172573d6000803e3d6000fd5b505050602060405103516001600160a01b031614156141935750600161407e565b5060009392505050565b81602001516001600160a01b0316336001600160a01b0316146141bf57600080fd5b60006141ca83614085565b60008181526006602052604090205490915060ff16156141e957600080fd5b60016006600083815260200190815260200160002060006101000a81548160ff0219169083151502179055508260a001516001600160a01b031683602001516001600160a01b0316827f9527c050ae65b9188e21083193300cf58effa30739e47513d42d12b56f00b9c186600001518760400151886060015189608001518a60c001518b60e001518c61010001518d6101200151604051614291989796959493929190615854565b60405180910390a4807f57d34cb565121afd87a9e65f8e633848d02ca86728a9fb7b0666a9e52e573b24846101400151856101600151866101a00151876101c00151886101e001518961020001518a61022001518b61024001518c61026001518d61028001518d60405161430f9b9a9998979695949392919061597b565b60405180910390a2505050565b600061434a8360e0015184610100015185610200015186610220015187610240015188610260015188613f48565b90505b92915050565b80516000906001600160a01b0316301461436f575060006140b9565b614383826101000151836102600151615473565b61438f575060006140b9565b506001919050565b6000806143a383615491565b905060608167ffffffffffffffff811180156143be57600080fd5b506040519080825280601f01601f1916602001820160405280156143e9576020820181803683370190505b50845190915060208201906143ff9082906154b1565b905061440f8186602001516154b1565b905061441f8186604001516154b1565b905061442f8186606001516154cb565b905061443f8186608001516154cb565b905061444f818660a001516154b1565b905061446a818660c00151600181111561446557fe5b6154d3565b9050614480818660e00151600181111561446557fe5b905061449781866101000151600181111561446557fe5b90506144a8818661012001516154b1565b90506144bf81866101400151600181111561446557fe5b90506144d0818661016001516154e0565b90506144e1818661018001516154e0565b90506144f281866101a001516154b1565b905061450381866101c001516154e0565b905061451481866101e001516154b1565b9050614525818661020001516154cb565b9050614536818661022001516154cb565b9050614547818661024001516154cb565b9050614558818661026001516154cb565b9050614569818661028001516154cb565b50506020012092915050565b6000808360e00151600181111561458857fe5b1480156145a4575060018260e0015160018111156145a257fe5b145b80156145cd57508160c0015160018111156145bb57fe5b8360c0015160018111156145cb57fe5b145b80156145f45750816101e001516001600160a01b0316836101e001516001600160a01b0316145b801561462e575060408201516001600160a01b0316158061462e575082602001516001600160a01b031682604001516001600160a01b0316145b8015614668575060408301516001600160a01b03161580614668575081602001516001600160a01b031683604001516001600160a01b0316145b80156146c3575060a08201516001600160a01b0316158015614696575060a08301516001600160a01b031615155b806146c3575060a08201516001600160a01b0316158015906146c3575060a08301516001600160a01b0316155b80156146ea57508161012001516001600160a01b03168361012001516001600160a01b0316145b80156147155750816101400151600181111561470257fe5b836101400151600181111561471357fe5b145b80156147305750614730836102400151846102600151615523565b801561434a575061434a826102400151836102600151615523565b60008061475784614085565b90506147648185856140be565b61434a5760405162461bcd60e51b8152600401613c1c90615a01565b60008060008060008061479288614085565b6000818152600460205260408120919250886147af5760046147b2565b60035b6101608b810151908d0151604482015160046020850292830181015192909301909201518554919950975090955090915060ff166147fd57815460ff19166001908117835582018590555b600061480d836001015488615355565b101561482b5760405162461bcd60e51b8152600401613c1c90615af3565b614839826001015487615355565b600183018190556148725750506000908152600460205260408120805460ff19168155600190810191909155945091925061487f915050565b5060009650939450505050505b935093915050565b81518351146148dd576040805162461bcd60e51b815260206004820152601d60248201527f417272617973206861766520646966666572656e74206c656e67746873000000604482015290519081900360640190fd5b805183511461491d5760405162461bcd60e51b8152600401808060200182810382526025815260200180615bb26025913960400191505060405180910390fd5b6000602084518161492a57fe5b0490506020808202908104821461493d57fe5b60005b8281101561496c5760010160208102848101518682015191880180519282169119909216179052614940565b82156149995782905080600101602002808501518187015181168289015182191617828901525050614a35565b50805b8551811015614a35578481815181106149b157fe5b602001015160f81c60f81b8482815181106149c857fe5b602001015160f81c60f81b168682815181106149e057fe5b602001015160f81c60f81b8583815181106149f757fe5b602001015160f81c60f81b60ff60f81b181617868281518110614a1657fe5b60200101906001600160f81b031916908160001a90535060010161499c565b505050505050565b815181516000916001918114808314614a595760009250614a97565b600160208701838101602088015b600284838510011415614a92578051835114614a865760009650600093505b60209283019201614a67565b505050505b5090949350505050565b60608115614b3c57600060608461012001516001600160a01b0316856101600151604051614acf91906157c9565b6000604051808303816000865af19150503d8060008114614b0c576040519150601f19603f3d011682016040523d82523d6000602084013e614b11565b606091505b509150915081614b335760405162461bcd60e51b8152600401613c1c90615aaa565b915061434d9050565b600154602084015160405163c455279160e01b81526000926001600160a01b03169163c455279191614b719190600401615816565b60206040518083038186803b158015614b8957600080fd5b505afa158015614b9d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614bc191906156a3565b90506001600160a01b038116614be95760405162461bcd60e51b8152600401613c1c90615a73565b600160009054906101000a90046001600160a01b03166001600160a01b03166397204d8e6040518163ffffffff1660e01b815260040160206040518083038186803b158015614c3757600080fd5b505afa158015614c4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614c6f91906156a3565b6001600160a01b0316816001600160a01b0316635c60da1b6040518163ffffffff1660e01b815260040160206040518083038186803b158015614cb157600080fd5b505afa158015614cc5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614ce991906156a3565b6001600160a01b031614614cfc57600080fd5b60006060826001600160a01b0316631b0f7ba98761012001518861014001518961016001516040518463ffffffff1660e01b8152600401614d3f939291906158c0565b600060405180830381600087803b158015614d5957600080fd5b505af1158015614d6d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052614d9591908101906156ec565b9150915081614db65760405162461bcd60e51b8152600401613c1c90615aaa565b925061434d915050565b6101e08301516000906001600160a01b031615614de2573415614de257600080fd5b6000614def868686613ff1565b9050600081118015614e0e57506101e08501516001600160a01b031615155b15614e2c57614e2c856101e00151876020015187602001518461553f565b60a0850151819081906001600160a01b031615614ff257876080015187608001511115614e5857600080fd5b60018760c001516001811115614e6a57fe5b1415614fb357606087015115614f13576000614e95614e8d8960600151866152fc565b6127106153b2565b6101e08901519091506001600160a01b0316614ef857614eb58382615355565b60a08901516040519194506001600160a01b03169082156108fc029083906000818181858888f19350505050158015614ef2573d6000803e3d6000fd5b50614f11565b614f11886101e0015189602001518a60a001518461553f565b505b608087015115614fae576000614f30614e8d8960800151866152fc565b6101e08901519091506001600160a01b0316614f9357614f508282615419565b60a08901516040519193506001600160a01b03169082156108fc029083906000818181858888f19350505050158015614f8d573d6000803e3d6000fd5b50614fac565b614fac886101e001518a602001518a60a001518461553f565b505b614fed565b614fd0876101e0015188602001518960a001518a606001516155b4565b614fed876101e0015189602001518960a001518a608001516155b4565b6150e9565b86608001518860800151111561500757600080fd5b60018760c00151600181111561501957fe5b14156150af576101e08701516001600160a01b031661503757600080fd5b606088015115615071576000615054614e8d8a60600151866152fc565b905061506f886101e001518a602001518b60a001518461553f565b505b608088015115614fed57600061508e614e8d8a60800151866152fc565b90506150a9886101e0015189602001518b60a001518461553f565b506150e9565b6150cc876101e0015189602001518a60a001518b606001516155b4565b6150e9876101e0015188602001518a60a001518b608001516155b4565b6003546101208801516040516329c5eaf560e11b815260009283926001600160a01b039091169163538bd5ea916151269189908c906004016158fa565b604080518083038186803b15801561513d57600080fd5b505afa158015615151573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061517591906156bf565b90925090506001600160a01b0382161580159061519157508015155b1561523b576151a08482615355565b6101e08a01519094506001600160a01b03166151ee576040516001600160a01b0383169082156108fc029083906000818181858888f193505050501580156151ec573d6000803e3d6000fd5b505b6101e08901516001600160a01b0316158015906152215750816001600160a01b031689602001516001600160a01b031614155b1561523b5761523b896101e001518a60200151848461553f565b50506101e08701516001600160a01b03166152f0578034101561525d57600080fd5b86602001516001600160a01b03166108fc839081150290604051600060405180830381858888f1935050505015801561529a573d6000803e3d6000fd5b5060006152a73483615355565b905080156152ee5788602001516001600160a01b03166108fc829081150290604051600060405180830381858888f193505050501580156152ec573d6000803e3d6000fd5b505b505b50909695505050505050565b60008261530b5750600061434d565b8282028284828161531857fe5b041461434a5760405162461bcd60e51b8152600401808060200182810382526021815260200180615bd76021913960400191505060405180910390fd5b6000828211156153ac576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b6000808211615408576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b81838161541157fe5b049392505050565b60008282018381101561434a576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60008083600181111561548257fe5b148061434a5750501515919050565b6101c081015151610180820151516101608301515101016101b001919050565b60601b6bffffffffffffffffffffffff1916815260140190565b815260200190565b6000818353505060010190565b80516000901561551c57815180602001830160208401855b600183831014156155135781518152602091820191016154f8565b50505092909201915b5090919050565b6000428310801561434a575081158061434a5750504210919050565b80156155ae57600254604051630aed65f560e11b81526001600160a01b03909116906315dacbea9061557b90879087908790879060040161582a565b600060405180830381600087803b15801561559557600080fd5b505af11580156155a9573d6000803e3d6000fd5b505050505b50505050565b6155ae8484848461553f565b604080516102a081018252600080825260208201819052918101829052606081018290526080810182905260a081018290529060c0820190815260200160008152602001600081526000602082018190526040909101908152602001606081526020016060815260200160006001600160a01b031681526020016060815260200160006001600160a01b0316815260200160008152602001600081526020016000815260200160008152602001600081525090565b6040805160a08101825260008082526020820181905291810182905260608101829052608081019190915290565b6000602082840312156156b4578081fd5b815161434a81615b76565b600080604083850312156156d1578081fd5b82516156dc81615b76565b6020939093015192949293505050565b600080604083850312156156fe578182fd5b8251801515811461570d578283fd5b602084015190925067ffffffffffffffff8082111561572a578283fd5b818501915085601f83011261573d578283fd5b81518181111561574957fe5b604051601f8201601f19168101602001838111828210171561576757fe5b60405281815283820160200188101561577e578485fd5b61578f826020830160208701615b3d565b809450505050509250929050565b600081518084526157b5816020860160208601615b3d565b601f01601f19169290920160200192915050565b600082516157db818460208701615b3d565b9190910192915050565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b6001600160a01b0391909116815260200190565b6001600160a01b039485168152928416602084015292166040820152606081019190915260800190565b6001600160a01b0389811682528881166020830152604082018890526060820187905261010082019061588687615b69565b86608084015261589586615b69565b8560a08401526158a485615b69565b8460c084015280841660e0840152509998505050505050505050565b6001600160a01b038416815260006158d784615b69565b836020830152606060408301526158f1606083018461579d565b95945050505050565b6001600160a01b039390931683526020830191909152604082015260600190565b97885260208801969096526001600160a01b0394851660408801529284166060870152608086019190915260a08501521660c083015260e08201526101000190565b93845260ff9290921660208401526040830152606082015260800190565b60006101606159898e615b69565b8d835280602084015261599e8184018e61579d565b6001600160a01b038d8116604086015284820360608601529091506159c3828d61579d565b9a166080840152505060a081019690965260c086019490945260e0850192909252610100840152610120830152151561014090910152949350505050565b6020808252601290820152710929cac82989288be9ea4888aa4be9082a6960731b604082015260600190565b60208082526026908201527f506c617967726f756e6445786368616e67653a3a204f72646572206e6f74206d604082015265185d18da195960d21b606082015260800190565b6020808252601c908201527f55736572206e6f742072656769737465642070726f7879207965742100000000604082015260600190565b60208082526029908201527f45786368616e67653a3a4661696c6564207768656e2063616c6c206f746865726040820152680818dbdb9d1c9858dd60ba1b606082015260800190565b6020808252602a908201527f45786368616e67653a3a455243313135352072656d61696e696e67206973206e6040820152696f7420656e6f7567682160b01b606082015260800190565b60005b83811015615b58578181015183820152602001615b40565b838111156155ae5750506000910152565b60028110615b7357fe5b50565b6001600160a01b0381168114615b7357600080fdfe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373417272617920616e64206d61736b206861766520646966666572656e74206c656e67746873536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a2646970667358221220800981201b07cec4fefa5ce56ea0174e2dce5195e38656448834ad259e287ef764736f6c63430007050033000000000000000000000000d6a0aa0fde8b4511cd81fd3cbf7c47367f44efa20000000000000000000000005356cbb70c40edfa6e31f5d6839df231de8a10a400000000000000000000000016ef34d96247141c75439e629637678d9eb1cea0

Deployed Bytecode

0x6080604052600436106101355760003560e01c80638da5cb5b116100ab578063c16f51561161006f578063c16f5156146118a4578063cae6047f146118b9578063ce2cb088146118ce578063d040944114611b0a578063e57d4adb14611ee3578063f2fde38b14611f0d57610135565b80638da5cb5b146111925780639c57bf6b146111a7578063a27958ae146111ec578063a37c73371461142a578063accf45171461166857610135565b8063715018a6116100fd578063715018a6146108c95780637a5e68cf146108de5780637b10399914610cb95780637b49486f14610cce5780638076f00514610f2c57806382c8878514610f5657610135565b806306fdde031461013a5780630eefdbad146101c457806316bb9828146101f557806356d8a0a9146106185780636b6a254814610862575b600080fd5b34801561014657600080fd5b5061014f611f40565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610189578181015183820152602001610171565b50505050905090810190601f1680156101b65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101d057600080fd5b506101d9611f6f565b604080516001600160a01b039092168252519081900360200190f35b610616600480360361062081101561020c57600080fd5b81019080806101c00190600e806020026040519081016040528092919082600e6020028082843760009201919091525050604080516101c08181019092529295949381810193925090600e90839083908082843760009201919091525050604080516101008181019092529295949381810193925090600890839083908082843760009201919091525091949392602081019250359050600160201b8111156102b457600080fd5b8201836020820111156102c657600080fd5b803590602001918460018302840111600160201b831117156102e757600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561033957600080fd5b82018360208201111561034b57600080fd5b803590602001918460018302840111600160201b8311171561036c57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b8111156103be57600080fd5b8201836020820111156103d057600080fd5b803590602001918460018302840111600160201b831117156103f157600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561044357600080fd5b82018360208201111561045557600080fd5b803590602001918460018302840111600160201b8311171561047657600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b8111156104c857600080fd5b8201836020820111156104da57600080fd5b803590602001918460018302840111600160201b831117156104fb57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561054d57600080fd5b82018360208201111561055f57600080fd5b803590602001918460018302840111600160201b8311171561058057600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250506040805180820182529396959481810194935091506002908390839080828437600092019190915250506040805160a081810190925292959493818101939250906005908390839080828437600092019190915250919450611f7e9350505050565b005b34801561062457600080fd5b50610616600480360361030081101561063c57600080fd5b810190808060e001906007806020026040519081016040528092919082600760200280828437600092019190915250506040805160e081810190925292959493818101939250906007908390839080828437600092019190915250919460ff84358116956020860135821695604081013583169550606081013590921693509060a081019060800135600160201b8111156106d657600080fd5b8201836020820111156106e857600080fd5b803590602001918460018302840111600160201b8311171561070957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561075b57600080fd5b82018360208201111561076d57600080fd5b803590602001918460018302840111600160201b8311171561078e57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b8111156107e057600080fd5b8201836020820111156107f257600080fd5b803590602001918460018302840111600160201b8311171561081357600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505060ff8335169350505060208101359060400135612454565b34801561086e57600080fd5b506108b7600480360360e081101561088557600080fd5b5060ff813581169160208101359091169060408101359060608101359060808101359060a08101359060c00135612654565b60408051918252519081900360200190f35b3480156108d557600080fd5b50610616612673565b3480156108ea57600080fd5b506108b7600480360361056081101561090257600080fd5b81019080806101c00190600e806020026040519081016040528092919082600e6020028082843760009201919091525050604080516101c08181019092529295949381810193925090600e90839083908082843760009201919091525050604080516101008181019092529295949381810193925090600890839083908082843760009201919091525091949392602081019250359050600160201b8111156109aa57600080fd5b8201836020820111156109bc57600080fd5b803590602001918460018302840111600160201b831117156109dd57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b811115610a2f57600080fd5b820183602082011115610a4157600080fd5b803590602001918460018302840111600160201b83111715610a6257600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b811115610ab457600080fd5b820183602082011115610ac657600080fd5b803590602001918460018302840111600160201b83111715610ae757600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b811115610b3957600080fd5b820183602082011115610b4b57600080fd5b803590602001918460018302840111600160201b83111715610b6c57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b811115610bbe57600080fd5b820183602082011115610bd057600080fd5b803590602001918460018302840111600160201b83111715610bf157600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b811115610c4357600080fd5b820183602082011115610c5557600080fd5b803590602001918460018302840111600160201b83111715610c7657600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505091359250612736915050565b348015610cc557600080fd5b506101d9612b74565b348015610cda57600080fd5b50610f186004803603610300811015610cf257600080fd5b810190808060e001906007806020026040519081016040528092919082600760200280828437600092019190915250506040805160e081810190925292959493818101939250906007908390839080828437600092019190915250919460ff84358116956020860135821695604081013583169550606081013590921693509060a081019060800135600160201b811115610d8c57600080fd5b820183602082011115610d9e57600080fd5b803590602001918460018302840111600160201b83111715610dbf57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b811115610e1157600080fd5b820183602082011115610e2357600080fd5b803590602001918460018302840111600160201b83111715610e4457600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b811115610e9657600080fd5b820183602082011115610ea857600080fd5b803590602001918460018302840111600160201b83111715610ec957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505060ff8335169350505060208101359060400135612b83565b604080519115158252519081900360200190f35b348015610f3857600080fd5b50610f1860048036036020811015610f4f57600080fd5b5035612d86565b348015610f6257600080fd5b506108b760048036036102a0811015610f7a57600080fd5b810190808060e001906007806020026040519081016040528092919082600760200280828437600092019190915250506040805160e081810190925292959493818101939250906007908390839080828437600092019190915250919460ff84358116956020860135821695604081013583169550606081013590921693509060a081019060800135600160201b81111561101457600080fd5b82018360208201111561102657600080fd5b803590602001918460018302840111600160201b8311171561104757600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561109957600080fd5b8201836020820111156110ab57600080fd5b803590602001918460018302840111600160201b831117156110cc57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561111e57600080fd5b82018360208201111561113057600080fd5b803590602001918460018302840111600160201b8311171561115157600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550612d9b945050505050565b34801561119e57600080fd5b506101d9612f71565b3480156111b357600080fd5b506111d1600480360360208110156111ca57600080fd5b5035612f85565b60408051921515835260208301919091528051918290030190f35b3480156111f857600080fd5b5061061660048036036102c081101561121057600080fd5b810190808060e001906007806020026040519081016040528092919082600760200280828437600092019190915250506040805160e081810190925292959493818101939250906007908390839080828437600092019190915250919460ff84358116956020860135821695604081013583169550606081013590921693509060a081019060800135600160201b8111156112aa57600080fd5b8201836020820111156112bc57600080fd5b803590602001918460018302840111600160201b831117156112dd57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561132f57600080fd5b82018360208201111561134157600080fd5b803590602001918460018302840111600160201b8311171561136257600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b8111156113b457600080fd5b8201836020820111156113c657600080fd5b803590602001918460018302840111600160201b831117156113e757600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505050503515159050612fa4565b34801561143657600080fd5b506108b760048036036102c081101561144e57600080fd5b810190808060e001906007806020026040519081016040528092919082600760200280828437600092019190915250506040805160e081810190925292959493818101939250906007908390839080828437600092019190915250919460ff84358116956020860135821695604081013583169550606081013590921693509060a081019060800135600160201b8111156114e857600080fd5b8201836020820111156114fa57600080fd5b803590602001918460018302840111600160201b8311171561151b57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561156d57600080fd5b82018360208201111561157f57600080fd5b803590602001918460018302840111600160201b831117156115a057600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b8111156115f257600080fd5b82018360208201111561160457600080fd5b803590602001918460018302840111600160201b8311171561162557600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550509135925061311a915050565b34801561167457600080fd5b50610f1860048036036102a081101561168c57600080fd5b810190808060e001906007806020026040519081016040528092919082600760200280828437600092019190915250506040805160e081810190925292959493818101939250906007908390839080828437600092019190915250919460ff84358116956020860135821695604081013583169550606081013590921693509060a081019060800135600160201b81111561172657600080fd5b82018360208201111561173857600080fd5b803590602001918460018302840111600160201b8311171561175957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b8111156117ab57600080fd5b8201836020820111156117bd57600080fd5b803590602001918460018302840111600160201b831117156117de57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561183057600080fd5b82018360208201111561184257600080fd5b803590602001918460018302840111600160201b8311171561186357600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506132f2945050505050565b3480156118b057600080fd5b506101d9613469565b3480156118c557600080fd5b506108b7613478565b3480156118da57600080fd5b506108b760048036036102a08110156118f257600080fd5b810190808060e001906007806020026040519081016040528092919082600760200280828437600092019190915250506040805160e081810190925292959493818101939250906007908390839080828437600092019190915250919460ff84358116956020860135821695604081013583169550606081013590921693509060a081019060800135600160201b81111561198c57600080fd5b82018360208201111561199e57600080fd5b803590602001918460018302840111600160201b831117156119bf57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b811115611a1157600080fd5b820183602082011115611a2357600080fd5b803590602001918460018302840111600160201b83111715611a4457600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b811115611a9657600080fd5b820183602082011115611aa857600080fd5b803590602001918460018302840111600160201b83111715611ac957600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061347e945050505050565b348015611b1657600080fd5b50610f186004803603610540811015611b2e57600080fd5b81019080806101c00190600e806020026040519081016040528092919082600e6020028082843760009201919091525050604080516101c08181019092529295949381810193925090600e90839083908082843760009201919091525050604080516101008181019092529295949381810193925090600890839083908082843760009201919091525091949392602081019250359050600160201b811115611bd657600080fd5b820183602082011115611be857600080fd5b803590602001918460018302840111600160201b83111715611c0957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b811115611c5b57600080fd5b820183602082011115611c6d57600080fd5b803590602001918460018302840111600160201b83111715611c8e57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b811115611ce057600080fd5b820183602082011115611cf257600080fd5b803590602001918460018302840111600160201b83111715611d1357600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b811115611d6557600080fd5b820183602082011115611d7757600080fd5b803590602001918460018302840111600160201b83111715611d9857600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b811115611dea57600080fd5b820183602082011115611dfc57600080fd5b803590602001918460018302840111600160201b83111715611e1d57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b811115611e6f57600080fd5b820183602082011115611e8157600080fd5b803590602001918460018302840111600160201b83111715611ea257600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550613646945050505050565b348015611eef57600080fd5b50610f1860048036036020811015611f0657600080fd5b50356139cf565b348015611f1957600080fd5b5061061660048036036020811015611f3057600080fd5b50356001600160a01b03166139e4565b60405180604001604052806013815260200172506c617967726f756e642045786368616e676560681b81525081565b6002546001600160a01b031681565b612447604051806102a001604052808d6000600e8110611f9a57fe5b60200201516001600160a01b031681526020018d6001600e8110611fba57fe5b60200201516001600160a01b031681526020018d6002600e8110611fda57fe5b60200201516001600160a01b031681526020018c6000600e8110611ffa57fe5b602002015181526020018c6001600e811061201157fe5b602002015181526020018d6003600e811061202857fe5b60200201516001600160a01b031681526020018b60006008811061204857fe5b602002015160ff16600181111561205b57fe5b600181111561206657fe5b81526020018b6001602002015160ff16600181111561208157fe5b600181111561208c57fe5b81526020018b6002602002015160ff1660018111156120a757fe5b60018111156120b257fe5b815260808e01516001600160a01b031660208201526040018b6003602002015160ff1660018111156120e057fe5b60018111156120eb57fe5b8152602081018b90526040810189905260a0808f01516001600160a01b0316606083015260808201889052018d600660200201516001600160a01b031681526020018c6002600e811061213a57fe5b602002015181526020018c6003600e811061215157fe5b602002015181526020018c6004600e811061216857fe5b602002015181526020018c6005600e811061217f57fe5b602002015181526020018c6006600e811061219657fe5b6020908102919091015190915260408051606081018252865160ff168152855192810192909252810184600160200201519052604080516102a08101909152808f600760200201516001600160a01b031681526020018f6008600e81106121f957fe5b60200201516001600160a01b031681526020018f6009600e811061221957fe5b60200201516001600160a01b031681526020018e6007600e811061223957fe5b602002015181526020018e6008600e811061225057fe5b602002015181526020018f600a600e811061226757fe5b60200201516001600160a01b031681526020018d60046008811061228757fe5b602002015160ff16600181111561229a57fe5b60018111156122a557fe5b81526020018d6005602002015160ff1660018111156122c057fe5b60018111156122cb57fe5b81526020018d6006602002015160ff1660018111156122e657fe5b60018111156122f157fe5b81526020018f600b60200201516001600160a01b031681526020018d60076008811061231957fe5b602002015160ff16600181111561232c57fe5b600181111561233757fe5b8152602081018c9052604081018a90526060018f600c60200201516001600160a01b031681526020018781526020018f600d600e811061237357fe5b60200201516001600160a01b031681526020018e6009600e811061239357fe5b602002015181526020018e600a600e81106123aa57fe5b602002015181526020018e600b600e81106123c157fe5b602002015181526020018e600c600e81106123d857fe5b602002015181526020018e600d600e81106123ef57fe5b60200201519052604080516060810190915280876001602002015160ff1681526020018660026005811061241f57fe5b602002015181526020018660036005811061243657fe5b602002015190526080860151613b03565b5050505050505050505050565b612646604051806102a001604052808e60006007811061247057fe5b60200201516001600160a01b031681526020018e60016007811061249057fe5b60200201516001600160a01b031681526020018e6002600781106124b057fe5b60200201516001600160a01b031681526020018d6000600781106124d057fe5b602002015181526020018d6001600781106124e757fe5b602002015181526020018e6003600781106124fe57fe5b60200201516001600160a01b031681526020018c600181111561251d57fe5b81526020018b600181111561252e57fe5b81526020018a600181111561253f57fe5b815260808f01516001600160a01b0316602082015260400189600181111561256357fe5b815260208101899052604081018890526060018e600560200201516001600160a01b031681526020018681526020018e60066007811061259f57fe5b60200201516001600160a01b031681526020018d6002600781106125bf57fe5b602002015181526020018d6003600781106125d657fe5b602002015181526020018d6004600781106125ed57fe5b602002015181526020018d60056007811061260457fe5b602002015181526020018d60066007811061261b57fe5b602002015181525060405180606001604052808660ff16815260200185815260200184815250613ec5565b505050505050505050505050565b600061266588888888888888613f48565b90505b979650505050505050565b61267b613fed565b6001600160a01b031661268c612f71565b6001600160a01b0316146126e7576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516101009091046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a360008054610100600160a81b0319169055565b60006127406155c0565b604080516102a081019091528c516001600160a01b03168152602081018d600160200201516001600160a01b031681526020018d6002600e811061278057fe5b60200201516001600160a01b031681526020018c6000600e81106127a057fe5b602002015181526020018c6001600e81106127b757fe5b602002015181526020018d6003600e81106127ce57fe5b60200201516001600160a01b031681526020018b6000600881106127ee57fe5b602002015160ff16600181111561280157fe5b600181111561280c57fe5b81526020018b6001602002015160ff16600181111561282757fe5b600181111561283257fe5b81526020018b6002602002015160ff16600181111561284d57fe5b600181111561285857fe5b815260808e01516001600160a01b031660208201526040018b6003602002015160ff16600181111561288657fe5b600181111561289157fe5b8152602081018b90526040810189905260a0808f01516001600160a01b0316606083015260808201889052018d600660200201516001600160a01b031681526020018c6002600e81106128e057fe5b602002015181526020018c6003600e81106128f757fe5b602002015181526020018c6004600e811061290e57fe5b602002015181526020018c6005600e811061292557fe5b602002015181526020018c6006600e811061293c57fe5b60200201519052905061294d6155c0565b604080516102a0810190915260e08e01516001600160a01b03168152602081018e600860200201516001600160a01b031681526020018e6009600e811061299057fe5b60200201516001600160a01b031681526020018d6007600e81106129b057fe5b602002015181526020018d6008600e81106129c757fe5b602002015181526020018e600a600e81106129de57fe5b60200201516001600160a01b031681526020018c6004600881106129fe57fe5b602002015160ff166001811115612a1157fe5b6001811115612a1c57fe5b81526020018c6005602002015160ff166001811115612a3757fe5b6001811115612a4257fe5b81526020018c6006602002015160ff166001811115612a5d57fe5b6001811115612a6857fe5b81526101608f01516001600160a01b031660208201526040018c6007602002015160ff166001811115612a9757fe5b6001811115612aa257fe5b8152602081018b9052604081018990526101808f01516001600160a01b031660608201526080810187905260a0018e600d60200201516001600160a01b031681526020018d6009600e8110612af357fe5b602002015181526020018d600a600e8110612b0a57fe5b602002015181526020018d600b600e8110612b2157fe5b602002015181526020018d600c600e8110612b3857fe5b602002015181526020018d600d600e8110612b4f57fe5b602002015190529050612b63828286613ff1565b9d9c50505050505050505050505050565b6001546001600160a01b031681565b6000612b8d6155c0565b604080516102a081019091528e516001600160a01b03168152602081018f600160200201516001600160a01b031681526020018f600260078110612bcd57fe5b60200201516001600160a01b031681526020018e600060078110612bed57fe5b602002015181526020018e600160078110612c0457fe5b602002015181526020018f600360078110612c1b57fe5b60200201516001600160a01b031681526020018d6001811115612c3a57fe5b81526020018c6001811115612c4b57fe5b81526020018b6001811115612c5c57fe5b81526020018f600460200201516001600160a01b031681526020018a6001811115612c8357fe5b8152602081018a9052604081018990526060018f600560200201516001600160a01b031681526020018781526020018f600660078110612cbf57fe5b60200201516001600160a01b031681526020018e600260078110612cdf57fe5b602002015181526020018e600360078110612cf657fe5b602002015181526020018e600460078110612d0d57fe5b602002015181526020018e600560078110612d2457fe5b602002015181526020018e600660078110612d3b57fe5b602002015190529050612d74612d5082614085565b8260405180606001604052808960ff168152602001888152602001878152506140be565b9e9d5050505050505050505050505050565b60056020526000908152604090205460ff1681565b6000612f63604051806102a001604052808c600060078110612db957fe5b60200201516001600160a01b031681526020018c600160078110612dd957fe5b60200201516001600160a01b031681526020018c600260078110612df957fe5b60200201516001600160a01b031681526020018b600060078110612e1957fe5b602002015181526020018b600160078110612e3057fe5b602002015181526020018c600360078110612e4757fe5b60200201516001600160a01b031681526020018a6001811115612e6657fe5b8152602001896001811115612e7757fe5b8152602001886001811115612e8857fe5b815260808d01516001600160a01b03166020820152604001876001811115612eac57fe5b8152602081018790526040810186905260a0808e01516001600160a01b0316606083015260808201869052018c600660200201516001600160a01b031681526020018b600260078110612efb57fe5b602002015181526020018b600360078110612f1257fe5b602002015181526020018b600460078110612f2957fe5b602002015181526020018b600560078110612f4057fe5b602002015181526020018b600660078110612f5757fe5b60200201519052614085565b9a9950505050505050505050565b60005461010090046001600160a01b031690565b6004602052600090815260409020805460019091015460ff9091169082565b612fac6155c0565b604080516102a0810182528c516001600160a01b0390811682526020808f01518216818401528e840151909116928201929092528b516060820152908b0151608082015260a081018c600360200201516001600160a01b031681526020018a600181111561301657fe5b815260200189600181111561302757fe5b815260200188600181111561303857fe5b815260808d01516001600160a01b0316602082015260400187600181111561305c57fe5b8152602081018790526040810186905260a0808e01516001600160a01b0316606083015260808201869052018c600660200201516001600160a01b031681526020018b6002600781106130ab57fe5b602002015181526020018b6003600781106130c257fe5b602002015181526020018b6004600781106130d957fe5b602002015181526020018b6005600781106130f057fe5b602002015181526020018b60066007811061310757fe5b602002015190529050612447818361419d565b60006132e3604051806102a001604052808d60006007811061313857fe5b60200201516001600160a01b031681526020018d60016007811061315857fe5b60200201516001600160a01b031681526020018d60026007811061317857fe5b60200201516001600160a01b031681526020018c60006007811061319857fe5b602002015181526020018c6001600781106131af57fe5b602002015181526020018d6003600781106131c657fe5b60200201516001600160a01b031681526020018b60018111156131e557fe5b81526020018a60018111156131f657fe5b815260200189600181111561320757fe5b815260808e01516001600160a01b0316602082015260400188600181111561322b57fe5b8152602081018890526040810187905260a0808f01516001600160a01b0316606083015260808201879052018d600660200201516001600160a01b031681526020018c60026007811061327a57fe5b602002015181526020018c60036007811061329157fe5b602002015181526020018c6004600781106132a857fe5b602002015181526020018c6005600781106132bf57fe5b602002015181526020018c6006600781106132d657fe5b602002015190528361431c565b9b9a5050505050505050505050565b60006132fc6155c0565b604080516102a0810182528c516001600160a01b0390811682526020808f01518216818401528e840151909116928201929092528b516060820152908b0151608082015260a081018c600360200201516001600160a01b031681526020018a600181111561336657fe5b815260200189600181111561337757fe5b815260200188600181111561338857fe5b815260808d01516001600160a01b031660208201526040018760018111156133ac57fe5b8152602081018790526040810186905260a0808e01516001600160a01b0316606083015260808201869052018c600660200201516001600160a01b031681526020018b6002600781106133fb57fe5b602002015181526020018b60036007811061341257fe5b602002015181526020018b60046007811061342957fe5b602002015181526020018b60056007811061344057fe5b602002015181526020018b60066007811061345757fe5b6020020151905290506132e381614353565b6003546001600160a01b031681565b61271081565b6000612f63604051806102a001604052808c60006007811061349c57fe5b60200201516001600160a01b031681526020018c6001600781106134bc57fe5b60200201516001600160a01b031681526020018c6002600781106134dc57fe5b60200201516001600160a01b031681526020018b6000600781106134fc57fe5b602002015181526020018b60016007811061351357fe5b602002015181526020018c60036007811061352a57fe5b60200201516001600160a01b031681526020018a600181111561354957fe5b815260200189600181111561355a57fe5b815260200188600181111561356b57fe5b815260808d01516001600160a01b0316602082015260400187600181111561358f57fe5b8152602081018790526040810186905260a0808e01516001600160a01b0316606083015260808201869052018c600660200201516001600160a01b031681526020018b6002600781106135de57fe5b602002015181526020018b6003600781106135f557fe5b602002015181526020018b60046007811061360c57fe5b602002015181526020018b60056007811061362357fe5b602002015181526020018b60066007811061363a57fe5b60200201519052614397565b60006136506155c0565b604080516102a0810182528c516001600160a01b0390811682526020808f01518216818401528e8401518216938301939093528c51606080840191909152928d01516080830152918d015190911660a0820152895160c082019060ff1660018111156136b857fe5b60018111156136c357fe5b81526020018a6001602002015160ff1660018111156136de57fe5b60018111156136e957fe5b81526020018a6002602002015160ff16600181111561370457fe5b600181111561370f57fe5b815260808d01516001600160a01b031660208201526040018a6003602002015160ff16600181111561373d57fe5b600181111561374857fe5b8152602081018a90526040810188905260a0808e01516001600160a01b0316606083015260808201879052018c600660200201516001600160a01b031681526020018b6002600e811061379757fe5b602002015181526020018b6003600e81106137ae57fe5b602002015181526020018b6004600e81106137c557fe5b602002015181526020018b6005600e81106137dc57fe5b602002015181526020018b6006600e81106137f357fe5b6020020151905290506138046155c0565b604080516102a08101825260e08e01516001600160a01b0390811682526101008f0151811660208301526101208f01511691810191909152606081018c6007602002015181526020018c6008600e811061385a57fe5b602002015181526020018d600a600e811061387157fe5b60200201516001600160a01b031681526020018b60046008811061389157fe5b602002015160ff1660018111156138a457fe5b60018111156138af57fe5b81526020018b6005602002015160ff1660018111156138ca57fe5b60018111156138d557fe5b81526020018b6006602002015160ff1660018111156138f057fe5b60018111156138fb57fe5b81526101608e01516001600160a01b031660208201526040018b6007602002015160ff16600181111561392a57fe5b600181111561393557fe5b8152602081018a9052604081018890526101808e01516001600160a01b039081166060830152608082018790526101a08f01511660a08201526101208d81015160c08301526101408e015160e08301526101608e0151610100830152018c600c602002015181526020018c600d600e81106139ac57fe5b6020020151905290506139bf8282614575565b9c9b505050505050505050505050565b60066020526000908152604090205460ff1681565b6139ec613fed565b6001600160a01b03166139fd612f71565b6001600160a01b031614613a58576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038116613a9d5760405162461bcd60e51b8152600401808060200182810382526026815260200180615b8c6026913960400191505060405180910390fd5b600080546040516001600160a01b038085169361010090930416917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b60005460ff1615613b51576040805162461bcd60e51b81526020600482015260136024820152721499595b9d1c985b98de4819195d1958dd1959606a1b604482015290519081900360640190fd5b6000805460ff19166001179055613b66615675565b6000613b7185614397565b90506000613b7e88614397565b60208901519091506001600160a01b0316331415613bad57613b9f88614353565b613ba857600080fd5b613bba565b613bb7888861474b565b83525b60208601516001600160a01b0316331415613be657613bd886614353565b613be157600080fd5b613bf6565b613bf0868661474b565b60208401525b613c008887614575565b613c255760405162461bcd60e51b8152600401613c1c90615a2d565b60405180910390fd5b610120860151803b9081613c3857600080fd5b610160880151602001516001806001600160e01b031983166309390beb60e11b1480613c745750637921219560e11b6001600160e01b03198416145b80613c8f575063aba3003760e01b6001600160e01b03198416145b80613caa575063e8a568db60e01b6001600160e01b03198416145b15613cd357613ccd8d8c63e8a568db60e01b6001600160e01b0319871614614780565b90925090505b6101808d01515115613cf957613cf98d61016001518c61016001518f6101800151614887565b6101808b01515115613d1f57613d1f8b61016001518e61016001518d6101800151614887565b613d338d61016001518c6101600151614a3d565b613d3c57600080fd5b8c602001516001600160a01b0316336001600160a01b031614613d755787516000908152600560205260409020805460ff191660011790555b8a602001516001600160a01b0316336001600160a01b031614158015613d985750815b15613dbd576020808901516000908152600590915260409020805460ff191660011790555b613df58b639f6ed25f60e01b6001600160e01b031986161480613df0575063e8a568db60e01b6001600160e01b03198616145b614aa1565b506101608b015160440151613e0c8e8d8484614dc0565b8960800181815250508d6020015189604001906001600160a01b031690816001600160a01b0316815250508b6020015189606001906001600160a01b031690816001600160a01b031681525050897fe7a1db1f6ecefcc453c6281929883772b09e803260cad416021d547dd2f0d02f888a8c604001518d606001518e60800151878c8a604051613ea398979695949392919061591b565b60405180910390a250506000805460ff19169055505050505050505050505050565b6000613ed083614397565b90506000613ede848461474b565b905083602001516001600160a01b0316336001600160a01b031614613f0257600080fd5b600081815260056020526040808220805460ff191660011790555183917f5152abf959f6564662358c2e52b702259b78bac5ee7842a0f01937e670efcc7d91a250505050565b600080876001811115613f5757fe5b1415613f6e57613f6786836152fc565b9050612668565b6001876001811115613f7c57fe5b1415612668576000613fa9613f9a87613f954289615355565b6152fc565b613fa48688615355565b6153b2565b90506001896001811115613fb957fe5b1415613fda57613fd2613fcc88856152fc565b82615355565b915050612668565b613fd2613fe788856152fc565b82615419565b3390565b6000806140208460e0015185610100015186610200015187610220015188610240015189610260015189613f48565b905060006140508660e001518761010001518861020001518961022001518a61024001518b61026001518a613f48565b90508181101561405f57600080fd5b60a08501516001600160a01b03166140775780614079565b815b925050505b9392505050565b600061409082614397565b6040516020016140a091906157e5565b6040516020818303038152906040528051906020012090505b919050565b60006140c983614353565b6140d55750600061407e565b60008481526005602052604090205460ff16156140f45750600061407e565b60008481526006602052604090205460ff16156141135750600161407e565b82602001516001600160a01b031660018584600001518560200151866040015160405160008152602001604052604051614150949392919061595d565b6020604051602081039080840390855afa158015614172573d6000803e3d6000fd5b505050602060405103516001600160a01b031614156141935750600161407e565b5060009392505050565b81602001516001600160a01b0316336001600160a01b0316146141bf57600080fd5b60006141ca83614085565b60008181526006602052604090205490915060ff16156141e957600080fd5b60016006600083815260200190815260200160002060006101000a81548160ff0219169083151502179055508260a001516001600160a01b031683602001516001600160a01b0316827f9527c050ae65b9188e21083193300cf58effa30739e47513d42d12b56f00b9c186600001518760400151886060015189608001518a60c001518b60e001518c61010001518d6101200151604051614291989796959493929190615854565b60405180910390a4807f57d34cb565121afd87a9e65f8e633848d02ca86728a9fb7b0666a9e52e573b24846101400151856101600151866101a00151876101c00151886101e001518961020001518a61022001518b61024001518c61026001518d61028001518d60405161430f9b9a9998979695949392919061597b565b60405180910390a2505050565b600061434a8360e0015184610100015185610200015186610220015187610240015188610260015188613f48565b90505b92915050565b80516000906001600160a01b0316301461436f575060006140b9565b614383826101000151836102600151615473565b61438f575060006140b9565b506001919050565b6000806143a383615491565b905060608167ffffffffffffffff811180156143be57600080fd5b506040519080825280601f01601f1916602001820160405280156143e9576020820181803683370190505b50845190915060208201906143ff9082906154b1565b905061440f8186602001516154b1565b905061441f8186604001516154b1565b905061442f8186606001516154cb565b905061443f8186608001516154cb565b905061444f818660a001516154b1565b905061446a818660c00151600181111561446557fe5b6154d3565b9050614480818660e00151600181111561446557fe5b905061449781866101000151600181111561446557fe5b90506144a8818661012001516154b1565b90506144bf81866101400151600181111561446557fe5b90506144d0818661016001516154e0565b90506144e1818661018001516154e0565b90506144f281866101a001516154b1565b905061450381866101c001516154e0565b905061451481866101e001516154b1565b9050614525818661020001516154cb565b9050614536818661022001516154cb565b9050614547818661024001516154cb565b9050614558818661026001516154cb565b9050614569818661028001516154cb565b50506020012092915050565b6000808360e00151600181111561458857fe5b1480156145a4575060018260e0015160018111156145a257fe5b145b80156145cd57508160c0015160018111156145bb57fe5b8360c0015160018111156145cb57fe5b145b80156145f45750816101e001516001600160a01b0316836101e001516001600160a01b0316145b801561462e575060408201516001600160a01b0316158061462e575082602001516001600160a01b031682604001516001600160a01b0316145b8015614668575060408301516001600160a01b03161580614668575081602001516001600160a01b031683604001516001600160a01b0316145b80156146c3575060a08201516001600160a01b0316158015614696575060a08301516001600160a01b031615155b806146c3575060a08201516001600160a01b0316158015906146c3575060a08301516001600160a01b0316155b80156146ea57508161012001516001600160a01b03168361012001516001600160a01b0316145b80156147155750816101400151600181111561470257fe5b836101400151600181111561471357fe5b145b80156147305750614730836102400151846102600151615523565b801561434a575061434a826102400151836102600151615523565b60008061475784614085565b90506147648185856140be565b61434a5760405162461bcd60e51b8152600401613c1c90615a01565b60008060008060008061479288614085565b6000818152600460205260408120919250886147af5760046147b2565b60035b6101608b810151908d0151604482015160046020850292830181015192909301909201518554919950975090955090915060ff166147fd57815460ff19166001908117835582018590555b600061480d836001015488615355565b101561482b5760405162461bcd60e51b8152600401613c1c90615af3565b614839826001015487615355565b600183018190556148725750506000908152600460205260408120805460ff19168155600190810191909155945091925061487f915050565b5060009650939450505050505b935093915050565b81518351146148dd576040805162461bcd60e51b815260206004820152601d60248201527f417272617973206861766520646966666572656e74206c656e67746873000000604482015290519081900360640190fd5b805183511461491d5760405162461bcd60e51b8152600401808060200182810382526025815260200180615bb26025913960400191505060405180910390fd5b6000602084518161492a57fe5b0490506020808202908104821461493d57fe5b60005b8281101561496c5760010160208102848101518682015191880180519282169119909216179052614940565b82156149995782905080600101602002808501518187015181168289015182191617828901525050614a35565b50805b8551811015614a35578481815181106149b157fe5b602001015160f81c60f81b8482815181106149c857fe5b602001015160f81c60f81b168682815181106149e057fe5b602001015160f81c60f81b8583815181106149f757fe5b602001015160f81c60f81b60ff60f81b181617868281518110614a1657fe5b60200101906001600160f81b031916908160001a90535060010161499c565b505050505050565b815181516000916001918114808314614a595760009250614a97565b600160208701838101602088015b600284838510011415614a92578051835114614a865760009650600093505b60209283019201614a67565b505050505b5090949350505050565b60608115614b3c57600060608461012001516001600160a01b0316856101600151604051614acf91906157c9565b6000604051808303816000865af19150503d8060008114614b0c576040519150601f19603f3d011682016040523d82523d6000602084013e614b11565b606091505b509150915081614b335760405162461bcd60e51b8152600401613c1c90615aaa565b915061434d9050565b600154602084015160405163c455279160e01b81526000926001600160a01b03169163c455279191614b719190600401615816565b60206040518083038186803b158015614b8957600080fd5b505afa158015614b9d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614bc191906156a3565b90506001600160a01b038116614be95760405162461bcd60e51b8152600401613c1c90615a73565b600160009054906101000a90046001600160a01b03166001600160a01b03166397204d8e6040518163ffffffff1660e01b815260040160206040518083038186803b158015614c3757600080fd5b505afa158015614c4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614c6f91906156a3565b6001600160a01b0316816001600160a01b0316635c60da1b6040518163ffffffff1660e01b815260040160206040518083038186803b158015614cb157600080fd5b505afa158015614cc5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614ce991906156a3565b6001600160a01b031614614cfc57600080fd5b60006060826001600160a01b0316631b0f7ba98761012001518861014001518961016001516040518463ffffffff1660e01b8152600401614d3f939291906158c0565b600060405180830381600087803b158015614d5957600080fd5b505af1158015614d6d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052614d9591908101906156ec565b9150915081614db65760405162461bcd60e51b8152600401613c1c90615aaa565b925061434d915050565b6101e08301516000906001600160a01b031615614de2573415614de257600080fd5b6000614def868686613ff1565b9050600081118015614e0e57506101e08501516001600160a01b031615155b15614e2c57614e2c856101e00151876020015187602001518461553f565b60a0850151819081906001600160a01b031615614ff257876080015187608001511115614e5857600080fd5b60018760c001516001811115614e6a57fe5b1415614fb357606087015115614f13576000614e95614e8d8960600151866152fc565b6127106153b2565b6101e08901519091506001600160a01b0316614ef857614eb58382615355565b60a08901516040519194506001600160a01b03169082156108fc029083906000818181858888f19350505050158015614ef2573d6000803e3d6000fd5b50614f11565b614f11886101e0015189602001518a60a001518461553f565b505b608087015115614fae576000614f30614e8d8960800151866152fc565b6101e08901519091506001600160a01b0316614f9357614f508282615419565b60a08901516040519193506001600160a01b03169082156108fc029083906000818181858888f19350505050158015614f8d573d6000803e3d6000fd5b50614fac565b614fac886101e001518a602001518a60a001518461553f565b505b614fed565b614fd0876101e0015188602001518960a001518a606001516155b4565b614fed876101e0015189602001518960a001518a608001516155b4565b6150e9565b86608001518860800151111561500757600080fd5b60018760c00151600181111561501957fe5b14156150af576101e08701516001600160a01b031661503757600080fd5b606088015115615071576000615054614e8d8a60600151866152fc565b905061506f886101e001518a602001518b60a001518461553f565b505b608088015115614fed57600061508e614e8d8a60800151866152fc565b90506150a9886101e0015189602001518b60a001518461553f565b506150e9565b6150cc876101e0015189602001518a60a001518b606001516155b4565b6150e9876101e0015188602001518a60a001518b608001516155b4565b6003546101208801516040516329c5eaf560e11b815260009283926001600160a01b039091169163538bd5ea916151269189908c906004016158fa565b604080518083038186803b15801561513d57600080fd5b505afa158015615151573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061517591906156bf565b90925090506001600160a01b0382161580159061519157508015155b1561523b576151a08482615355565b6101e08a01519094506001600160a01b03166151ee576040516001600160a01b0383169082156108fc029083906000818181858888f193505050501580156151ec573d6000803e3d6000fd5b505b6101e08901516001600160a01b0316158015906152215750816001600160a01b031689602001516001600160a01b031614155b1561523b5761523b896101e001518a60200151848461553f565b50506101e08701516001600160a01b03166152f0578034101561525d57600080fd5b86602001516001600160a01b03166108fc839081150290604051600060405180830381858888f1935050505015801561529a573d6000803e3d6000fd5b5060006152a73483615355565b905080156152ee5788602001516001600160a01b03166108fc829081150290604051600060405180830381858888f193505050501580156152ec573d6000803e3d6000fd5b505b505b50909695505050505050565b60008261530b5750600061434d565b8282028284828161531857fe5b041461434a5760405162461bcd60e51b8152600401808060200182810382526021815260200180615bd76021913960400191505060405180910390fd5b6000828211156153ac576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b6000808211615408576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b81838161541157fe5b049392505050565b60008282018381101561434a576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60008083600181111561548257fe5b148061434a5750501515919050565b6101c081015151610180820151516101608301515101016101b001919050565b60601b6bffffffffffffffffffffffff1916815260140190565b815260200190565b6000818353505060010190565b80516000901561551c57815180602001830160208401855b600183831014156155135781518152602091820191016154f8565b50505092909201915b5090919050565b6000428310801561434a575081158061434a5750504210919050565b80156155ae57600254604051630aed65f560e11b81526001600160a01b03909116906315dacbea9061557b90879087908790879060040161582a565b600060405180830381600087803b15801561559557600080fd5b505af11580156155a9573d6000803e3d6000fd5b505050505b50505050565b6155ae8484848461553f565b604080516102a081018252600080825260208201819052918101829052606081018290526080810182905260a081018290529060c0820190815260200160008152602001600081526000602082018190526040909101908152602001606081526020016060815260200160006001600160a01b031681526020016060815260200160006001600160a01b0316815260200160008152602001600081526020016000815260200160008152602001600081525090565b6040805160a08101825260008082526020820181905291810182905260608101829052608081019190915290565b6000602082840312156156b4578081fd5b815161434a81615b76565b600080604083850312156156d1578081fd5b82516156dc81615b76565b6020939093015192949293505050565b600080604083850312156156fe578182fd5b8251801515811461570d578283fd5b602084015190925067ffffffffffffffff8082111561572a578283fd5b818501915085601f83011261573d578283fd5b81518181111561574957fe5b604051601f8201601f19168101602001838111828210171561576757fe5b60405281815283820160200188101561577e578485fd5b61578f826020830160208701615b3d565b809450505050509250929050565b600081518084526157b5816020860160208601615b3d565b601f01601f19169290920160200192915050565b600082516157db818460208701615b3d565b9190910192915050565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b6001600160a01b0391909116815260200190565b6001600160a01b039485168152928416602084015292166040820152606081019190915260800190565b6001600160a01b0389811682528881166020830152604082018890526060820187905261010082019061588687615b69565b86608084015261589586615b69565b8560a08401526158a485615b69565b8460c084015280841660e0840152509998505050505050505050565b6001600160a01b038416815260006158d784615b69565b836020830152606060408301526158f1606083018461579d565b95945050505050565b6001600160a01b039390931683526020830191909152604082015260600190565b97885260208801969096526001600160a01b0394851660408801529284166060870152608086019190915260a08501521660c083015260e08201526101000190565b93845260ff9290921660208401526040830152606082015260800190565b60006101606159898e615b69565b8d835280602084015261599e8184018e61579d565b6001600160a01b038d8116604086015284820360608601529091506159c3828d61579d565b9a166080840152505060a081019690965260c086019490945260e0850192909252610100840152610120830152151561014090910152949350505050565b6020808252601290820152710929cac82989288be9ea4888aa4be9082a6960731b604082015260600190565b60208082526026908201527f506c617967726f756e6445786368616e67653a3a204f72646572206e6f74206d604082015265185d18da195960d21b606082015260800190565b6020808252601c908201527f55736572206e6f742072656769737465642070726f7879207965742100000000604082015260600190565b60208082526029908201527f45786368616e67653a3a4661696c6564207768656e2063616c6c206f746865726040820152680818dbdb9d1c9858dd60ba1b606082015260800190565b6020808252602a908201527f45786368616e67653a3a455243313135352072656d61696e696e67206973206e6040820152696f7420656e6f7567682160b01b606082015260800190565b60005b83811015615b58578181015183820152602001615b40565b838111156155ae5750506000910152565b60028110615b7357fe5b50565b6001600160a01b0381168114615b7357600080fdfe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373417272617920616e64206d61736b206861766520646966666572656e74206c656e67746873536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a2646970667358221220800981201b07cec4fefa5ce56ea0174e2dce5195e38656448834ad259e287ef764736f6c63430007050033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000d6a0aa0fde8b4511cd81fd3cbf7c47367f44efa20000000000000000000000005356cbb70c40edfa6e31f5d6839df231de8a10a400000000000000000000000016ef34d96247141c75439e629637678d9eb1cea0

-----Decoded View---------------
Arg [0] : registryAddress (address): 0xD6A0AA0FdE8b4511Cd81FD3cbf7c47367F44efa2
Arg [1] : tokenTransferProxyAddress (address): 0x5356cbB70C40EdFa6e31F5d6839dF231de8a10a4
Arg [2] : royaltyFeeRegistryAddress (address): 0x16EF34D96247141C75439E629637678d9EB1cEA0

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000d6a0aa0fde8b4511cd81fd3cbf7c47367f44efa2
Arg [1] : 0000000000000000000000005356cbb70c40edfa6e31f5d6839df231de8a10a4
Arg [2] : 00000000000000000000000016ef34d96247141c75439e629637678d9eb1cea0


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Txn Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]
[ Download: CSV Export  ]

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