Feature Tip: Add private address tag to any address under My Name Tag !
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
0x60c06040 | 19673128 | 126 days ago | IN | 0 ETH | 0.05729035 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
ERC721OrdersFeature
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: Apache-2.0 /* Modifications Copyright 2022 Element.Market Copyright 2021 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.8.17; import "../../fixins/FixinERC721Spender.sol"; import "../../storage/LibCommonNftOrdersStorage.sol"; import "../../storage/LibERC721OrdersStorage.sol"; import "../interfaces/IOwnableFeature.sol"; import "../interfaces/IERC721OrdersFeature.sol"; import "../libs/LibTypeHash.sol"; import "../libs/LibMultiCall.sol"; import "./NFTOrders.sol"; /// @dev Feature for interacting with ERC721 orders. contract ERC721OrdersFeature is IERC721OrdersFeature, FixinERC721Spender, NFTOrders { using LibNFTOrder for LibNFTOrder.NFTBuyOrder; /// @dev The magic return value indicating the success of a `onERC721Received`. bytes4 private constant ERC721_RECEIVED_MAGIC_BYTES = this.onERC721Received.selector; bytes4 private constant SELL_ERC721_SELECTOR = this.sellERC721.selector; uint256 private constant ORDER_NONCE_MASK = (1 << 184) - 1; constructor(IEtherToken weth) NFTOrders(weth) { } function setPersonalSignState(uint256 state) external { require(msg.sender == IOwnableFeature(address(this)).owner(), "Only owner"); if (LibCommonNftOrdersStorage.getStorage().personalSignState != state) { LibCommonNftOrdersStorage.getStorage().personalSignState = state; } else { revert("No state need to be set"); } } function getPersonalSignState() external view returns (uint256) { return LibCommonNftOrdersStorage.getStorage().personalSignState; } function setOracleSignState(bytes32 state) external { require(msg.sender == IOwnableFeature(address(this)).owner(), "Only owner"); if (LibCommonNftOrdersStorage.getStorage().oracleSignState != state) { LibCommonNftOrdersStorage.getStorage().oracleSignState = state; } else { revert("No state need to be set"); } } function getOracleSignState() external view returns (bytes32) { return LibCommonNftOrdersStorage.getStorage().oracleSignState; } /// @dev Sells an ERC721 asset to fill the given order. /// @param buyOrder The ERC721 buy order. /// @param signature The order signature from the maker. /// @param erc721TokenId The ID of the ERC721 asset being /// sold. If the given order specifies properties, /// the asset must satisfy those properties. Otherwise, /// it must equal the tokenId in the order. /// @param unwrapNativeToken If this parameter is true and the /// ERC20 token of the order is e.g. WETH, unwraps the /// token before transferring it to the taker. function sellERC721( LibNFTOrder.NFTBuyOrder memory buyOrder, LibSignature.Signature memory signature, uint256 erc721TokenId, bool unwrapNativeToken, bytes memory takerData ) external override { _sellERC721(buyOrder, signature, erc721TokenId, unwrapNativeToken, msg.sender, msg.sender, takerData); } function batchSellERC721s(bytes[] calldata datas, bool revertIfIncomplete) external override { LibMultiCall._multiCall( _implementation, SELL_ERC721_SELECTOR, SELL_ERC721_SELECTOR, datas, revertIfIncomplete ); } function buyERC721Ex( LibNFTOrder.NFTSellOrder memory sellOrder, LibSignature.Signature memory signature, address taker, bytes memory takerData ) external override payable { uint256 ethBalanceBefore = address(this).balance - msg.value; _buyERC721(sellOrder, signature, taker, takerData); if (address(this).balance != ethBalanceBefore) { // Refund _transferEth(payable(msg.sender), address(this).balance - ethBalanceBefore); } } /// @dev Cancel a single ERC721 order by its nonce. The caller /// should be the maker of the order. Silently succeeds if /// an order with the same nonce has already been filled or /// cancelled. /// @param orderNonce The order nonce. function cancelERC721Order(uint256 orderNonce) public override { // Mark order as cancelled _setOrderStatusBit(msg.sender, orderNonce); emit ERC721OrderCancelled(msg.sender, orderNonce); } /// @dev Cancel multiple ERC721 orders by their nonces. The caller /// should be the maker of the orders. Silently succeeds if /// an order with the same nonce has already been filled or /// cancelled. /// @param orderNonces The order nonces. function batchCancelERC721Orders(uint256[] calldata orderNonces) external override { for (uint256 i = 0; i < orderNonces.length; i++) { cancelERC721Order(orderNonces[i]); } } function batchBuyERC721sEx( LibNFTOrder.NFTSellOrder[] memory sellOrders, LibSignature.Signature[] memory signatures, address[] calldata takers, bytes[] memory takerDatas, bool revertIfIncomplete ) external override payable returns (bool[] memory successes) { // All array length must match. uint256 length = sellOrders.length; require( length == signatures.length && length == takers.length && length == takerDatas.length, "ARRAY_LENGTH_MISMATCH" ); successes = new bool[](length); uint256 ethBalanceBefore = address(this).balance - msg.value; bool someSuccess = false; if (revertIfIncomplete) { for (uint256 i; i < length; ) { // Will revert if _buyERC721 reverts. _buyERC721(sellOrders[i], signatures[i], takers[i], takerDatas[i]); successes[i] = true; someSuccess = true; unchecked { i++; } } } else { for (uint256 i; i < length; ) { // Delegatecall `buyERC721FromProxy` to swallow reverts while // preserving execution context. (successes[i], ) = _implementation.delegatecall( abi.encodeWithSelector( this.buyERC721FromProxy.selector, sellOrders[i], signatures[i], takers[i], takerDatas[i] ) ); if (successes[i]) { someSuccess = true; } unchecked { i++; } } } require(someSuccess, "batchBuyERC721sEx/NO_ORDER_FILLED"); // Refund _transferEth(payable(msg.sender), address(this).balance - ethBalanceBefore); } // @Note `buyERC721FromProxy` is a external function, must call from an external Exchange Proxy, // but should not be registered in the Exchange Proxy. function buyERC721FromProxy( LibNFTOrder.NFTSellOrder memory sellOrder, LibSignature.Signature memory signature, address taker, bytes memory takerData ) external payable { require(_implementation != address(this), "MUST_CALL_FROM_PROXY"); _buyERC721(sellOrder, signature, taker, takerData); } /// @dev Matches a pair of complementary orders that have /// a non-negative spread. Each order is filled at /// their respective price, and the matcher receives /// a profit denominated in the ERC20 token. /// @param sellOrder Order selling an ERC721 asset. /// @param buyOrder Order buying an ERC721 asset. /// @param sellOrderSignature Signature for the sell order. /// @param buyOrderSignature Signature for the buy order. /// @return profit The amount of profit earned by the caller /// of this function (denominated in the ERC20 token /// of the matched orders). function matchERC721Order( LibNFTOrder.NFTSellOrder memory sellOrder, LibNFTOrder.NFTBuyOrder memory buyOrder, LibSignature.Signature memory sellOrderSignature, LibSignature.Signature memory buyOrderSignature, bytes memory sellTakerData, bytes memory buyTakerData ) external override returns (uint256 profit) { // The ERC721 tokens must match require(sellOrder.nft == buyOrder.nft, "ERC721_TOKEN_MISMATCH_ERROR"); LibNFTOrder.OrderInfoV2 memory sellOrderInfo = _getOrderInfo(sellOrder); LibNFTOrder.OrderInfoV2 memory buyOrderInfo = _getOrderInfo(buyOrder); _validateSellOrder(sellOrder, sellOrderSignature, sellOrderInfo, buyOrder.maker, 1, sellTakerData); _validateBuyOrder(buyOrder, buyOrderSignature, buyOrderInfo, sellOrder.maker, sellOrder.nftId, 1, buyTakerData); // Reset buyOrder.erc20TokenAmount buyOrder.erc20TokenAmount = buyOrder.erc20TokenAmount / buyOrderInfo.orderAmount; // English Auction if (sellOrder.expiry >> 252 == LibStructure.ORDER_KIND_ENGLISH_AUCTION) { _resetEnglishAuctionERC20AmountAndFees(sellOrder, buyOrder.erc20TokenAmount, 1, 1); } // The difference in ERC20 token amounts is the spread. uint256 spread = buyOrder.erc20TokenAmount - sellOrder.erc20TokenAmount; // Transfer the ERC721 asset from seller to buyer. _transferERC721AssetFrom(sellOrder.nft, sellOrder.maker, buyOrder.maker, sellOrder.nftId); // Handle the ERC20 side of the order: if (address(sellOrder.erc20Token) == NATIVE_TOKEN_ADDRESS && buyOrder.erc20Token == WETH) { // The sell order specifies ETH, while the buy order specifies WETH. // The orders are still compatible with one another, but we'll have // to unwrap the WETH on behalf of the buyer. // Step 1: Transfer WETH from the buyer to the EP. // Note that we transfer `buyOrder.erc20TokenAmount`, which // is the amount the buyer signaled they are willing to pay // for the ERC721 asset, which may be more than the seller's // ask. _transferERC20TokensFrom(address(WETH), buyOrder.maker, address(this), buyOrder.erc20TokenAmount); // Step 2: Unwrap the WETH into ETH. We unwrap the entire // `buyOrder.erc20TokenAmount`. // The ETH will be used for three purposes: // - To pay the seller // - To pay fees for the sell order // - Any remaining ETH will be sent to // `msg.sender` as profit. WETH.withdraw(buyOrder.erc20TokenAmount); // Step 3: Pay the seller (in ETH). _transferEth(payable(sellOrder.maker), sellOrder.erc20TokenAmount); // Step 4: Pay fees for the buy order. Note that these are paid // in _WETH_ by the _buyer_. By signing the buy order, the // buyer signals that they are willing to spend a total // of `erc20TokenAmount` _plus_ fees, all denominated in // the `erc20Token`, which in this case is WETH. _payFees(buyOrder.asNFTSellOrder(), buyOrder.maker, 1, buyOrderInfo.orderAmount, false); // Step 5: Pay fees for the sell order. The `erc20Token` of the // sell order is ETH, so the fees are paid out in ETH. // There should be `spread` wei of ETH remaining in the // EP at this point, which we will use ETH to pay the // sell order fees. uint256 sellOrderFees = _payFees(sellOrder, address(this), 1, 1, true); // Step 6: The spread less the sell order fees is the amount of ETH // remaining in the EP that can be sent to `msg.sender` as // the profit from matching these two orders. profit = spread - sellOrderFees; if (profit > 0) { _transferEth(payable(msg.sender), profit); } } else { // ERC20 tokens must match require(sellOrder.erc20Token == buyOrder.erc20Token, "ERC20_TOKEN_MISMATCH_ERROR"); // Step 1: Transfer the ERC20 token from the buyer to the seller. // Note that we transfer `sellOrder.erc20TokenAmount`, which // is at most `buyOrder.erc20TokenAmount`. _transferERC20TokensFrom(address(buyOrder.erc20Token), buyOrder.maker, sellOrder.maker, sellOrder.erc20TokenAmount); // Step 2: Pay fees for the buy order. Note that these are paid // by the buyer. By signing the buy order, the buyer signals // that they are willing to spend a total of // `buyOrder.erc20TokenAmount` _plus_ `buyOrder.fees`. _payFees(buyOrder.asNFTSellOrder(), buyOrder.maker, 1, buyOrderInfo.orderAmount, false); // Step 3: Pay fees for the sell order. These are paid by the buyer // as well. After paying these fees, we may have taken more // from the buyer than they agreed to in the buy order. If // so, we revert in the following step. uint256 sellOrderFees = _payFees(sellOrder, buyOrder.maker, 1, 1, false); // Step 4: We calculate the profit as: // profit = buyOrder.erc20TokenAmount - sellOrder.erc20TokenAmount - sellOrderFees // = spread - sellOrderFees // I.e. the buyer would've been willing to pay up to `profit` // more to buy the asset, so instead that amount is sent to // `msg.sender` as the profit from matching these two orders. profit = spread - sellOrderFees; if (profit > 0) { _transferERC20TokensFrom(address(buyOrder.erc20Token), buyOrder.maker, msg.sender, profit); } } _emitEventSellOrderFilled( sellOrder, buyOrder.maker, sellOrderInfo.orderHash ); _emitEventBuyOrderFilled( buyOrder, sellOrder.maker, sellOrder.nftId, buyOrderInfo.orderHash ); } /// @dev Callback for the ERC721 `safeTransferFrom` function. /// This callback can be used to sell an ERC721 asset if /// a valid ERC721 order, signature and `unwrapNativeToken` /// are encoded in `data`. This allows takers to sell their /// ERC721 asset without first calling `setApprovalForAll`. /// @param operator The address which called `safeTransferFrom`. /// @param tokenId The ID of the asset being transferred. /// @param data Additional data with no specified format. If a /// valid ERC721 order, signature and `unwrapNativeToken` /// are encoded in `data`, this function will try to fill /// the order using the received asset. /// @return success The selector of this function (0x150b7a02), /// indicating that the callback succeeded. function onERC721Received(address operator, address /* from */, uint256 tokenId, bytes calldata data) external override returns (bytes4 success) { // Decode the order, signature, and `unwrapNativeToken` from // `data`. If `data` does not encode such parameters, this // will throw. ( LibNFTOrder.NFTBuyOrder memory buyOrder, LibSignature.Signature memory signature, bool unwrapNativeToken, bytes memory takerData ) = abi.decode(data, (LibNFTOrder.NFTBuyOrder, LibSignature.Signature, bool, bytes)); // `onERC721Received` is called by the ERC721 token contract. // Check that it matches the ERC721 token in the order. require(msg.sender == buyOrder.nft, "ERC721_TOKEN_MISMATCH_ERROR"); // operator taker // address(this) owner (we hold the NFT currently) _sellERC721(buyOrder, signature, tokenId, unwrapNativeToken, operator, address(this), takerData); return ERC721_RECEIVED_MAGIC_BYTES; } // Core settlement logic for selling an ERC721 asset. // Used by `sellERC721` and `onERC721Received`. function _sellERC721( LibNFTOrder.NFTBuyOrder memory buyOrder, LibSignature.Signature memory signature, uint256 erc721TokenId, bool unwrapNativeToken, address taker, address currentNftOwner, bytes memory takerData ) internal { LibNFTOrder.OrderInfoV2 memory orderInfo = _getOrderInfo(buyOrder); buyOrder.erc20TokenAmount = _sellNFT( buyOrder, signature, orderInfo, SellParams(1, erc721TokenId, unwrapNativeToken, taker, currentNftOwner, takerData) ); _emitEventBuyOrderFilled( buyOrder, taker, erc721TokenId, orderInfo.orderHash ); } // Core settlement logic for buying an ERC721 asset. function _buyERC721( LibNFTOrder.NFTSellOrder memory sellOrder, LibSignature.Signature memory signature, address taker, bytes memory takerData ) internal { require(taker != address(this), "_buyERC721/TAKER_CANNOT_SELF"); if (taker == address(0)) { taker = msg.sender; } LibNFTOrder.OrderInfoV2 memory orderInfo = _getOrderInfo(sellOrder); sellOrder.erc20TokenAmount = _buyNFT(sellOrder, signature, orderInfo, 1, taker, takerData); _emitEventSellOrderFilled( sellOrder, taker, orderInfo.orderHash ); } function _emitEventSellOrderFilled( LibNFTOrder.NFTSellOrder memory sellOrder, address taker, bytes32 orderHash ) internal { LibStructure.Fee[] memory fees = new LibStructure.Fee[](sellOrder.fees.length); for (uint256 i; i < fees.length; ) { fees[i].recipient = sellOrder.fees[i].recipient; fees[i].amount = sellOrder.fees[i].amount; sellOrder.erc20TokenAmount += fees[i].amount; unchecked { ++i; } } emit ERC721SellOrderFilled( orderHash, sellOrder.maker, taker, sellOrder.nonce, sellOrder.erc20Token, sellOrder.erc20TokenAmount, fees, sellOrder.nft, sellOrder.nftId ); } function _emitEventBuyOrderFilled( LibNFTOrder.NFTBuyOrder memory buyOrder, address taker, uint256 nftId, bytes32 orderHash ) internal { uint256 orderAmount = (buyOrder.expiry >> 252 == LibStructure.ORDER_KIND_BATCH_OFFER_ERC721S) ? ((buyOrder.expiry >> 64) & 0xffffffff) : 1; LibStructure.Fee[] memory fees = new LibStructure.Fee[](buyOrder.fees.length); for (uint256 i; i < fees.length; ) { fees[i].recipient = buyOrder.fees[i].recipient; unchecked { fees[i].amount = buyOrder.fees[i].amount / orderAmount; } buyOrder.erc20TokenAmount += fees[i].amount; unchecked { ++i; } } emit ERC721BuyOrderFilled( orderHash, buyOrder.maker, taker, buyOrder.nonce, buyOrder.erc20Token, buyOrder.erc20TokenAmount, fees, buyOrder.nft, nftId ); } /// @dev Checks whether the given signature is valid for the /// the given ERC721 sell order. Reverts if not. /// @param order The ERC721 sell order. /// @param signature The signature to validate. function validateERC721SellOrderSignature(LibNFTOrder.NFTSellOrder memory order, LibSignature.Signature memory signature) external override view { _validateOrderSignature(getERC721SellOrderHash(order), signature, order.maker); } /// @dev Checks whether the given signature is valid for the /// the given ERC721 sell order. Reverts if not. /// @param order The ERC721 sell order. /// @param signature The signature to validate. function validateERC721SellOrderSignature( LibNFTOrder.NFTSellOrder calldata order, LibSignature.Signature calldata signature, bytes calldata takerData ) external override view { if ( signature.signatureType == LibSignature.SignatureType.EIP712_BULK || signature.signatureType == LibSignature.SignatureType.EIP712_BULK_1271 || signature.signatureType == LibSignature.SignatureType.ETHEREUM_PERSONAL_SIGN_BULK_1271 || signature.signatureType == LibSignature.SignatureType.BITCOIN_PERSONAL_SIGN_BULK_1271 || signature.signatureType == LibSignature.SignatureType.BITCOIN_PERSONAL_SIGN_BULK_173 ) { (bytes32 hash, ) = _getBulkValidateHashAndExtraData(false, _getSellOrderStructHash(order), takerData); _validateOrderSignature(hash, signature, order.maker); } else { _validateOrderSignature(getERC721SellOrderHash(order), signature, order.maker); } } /// @dev Checks whether the given signature is valid for the /// the given ERC721 buy order. Reverts if not. /// @param order The ERC721 buy order. /// @param signature The signature to validate. function validateERC721BuyOrderSignature( LibNFTOrder.NFTBuyOrder memory order, LibSignature.Signature memory signature ) external override view { _validateOrderSignature(getERC721BuyOrderHash(order), signature, order.maker); } /// @dev Checks whether the given signature is valid for the /// the given ERC721 buy order. Reverts if not. /// @param order The ERC721 buy order. /// @param signature The signature to validate. function validateERC721BuyOrderSignature( LibNFTOrder.NFTBuyOrder memory order, LibSignature.Signature memory signature, bytes memory takerData ) external override view { if ( signature.signatureType == LibSignature.SignatureType.EIP712_BULK || signature.signatureType == LibSignature.SignatureType.EIP712_BULK_1271 || signature.signatureType == LibSignature.SignatureType.ETHEREUM_PERSONAL_SIGN_BULK_1271 || signature.signatureType == LibSignature.SignatureType.BITCOIN_PERSONAL_SIGN_BULK_1271 || signature.signatureType == LibSignature.SignatureType.BITCOIN_PERSONAL_SIGN_BULK_173 ) { (bytes32 hash, ) = _getBulkValidateHashAndExtraData(true, _getBuyOrderStructHash(order), takerData); _validateOrderSignature(hash, signature, order.maker); } else { _validateOrderSignature(getERC721BuyOrderHash(order), signature, order.maker); } } function _isOrderPreSigned(bytes32 orderHash, address maker) internal override view returns(bool) { return LibERC721OrdersStorage.getStorage().preSigned[orderHash] == LibCommonNftOrdersStorage.getStorage().hashNonces[maker] + 1; } /// @dev Transfers an NFT asset. /// @param token The address of the NFT contract. /// @param from The address currently holding the asset. /// @param to The address to transfer the asset to. /// @param tokenId The ID of the asset to transfer. function _transferNFTAssetFrom(address token, address from, address to, uint256 tokenId, uint256 /* amount */) internal override { _transferERC721AssetFrom(token, from, to, tokenId); } /// @dev Updates storage to indicate that the given order /// has been filled by the given amount. /// @param order The order that has been filled. function _updateOrderState(LibNFTOrder.NFTSellOrder memory order, bytes32 /* orderHash */, uint128 /* fillAmount */) internal override { _setOrderStatusBit(order.maker, order.nonce); } /// @dev Updates storage to indicate that the given order /// has been filled by the given amount. /// @param order The order that has been filled. function _updateOrderState(LibNFTOrder.NFTBuyOrder memory order, bytes32 orderHash, uint128 fillAmount) internal override { if (order.expiry >> 252 == LibStructure.ORDER_KIND_BATCH_OFFER_ERC721S) { LibERC721OrdersStorage.getStorage().filledAmount[orderHash] += fillAmount; } else { _setOrderStatusBit(order.maker, order.nonce); } } function _setOrderStatusBit(address maker, uint256 nonce) private { // Order status bit vectors are indexed by maker address and the // upper 248 bits of the order nonce. We define `nonceRange` to be // these 248 bits. uint248 nonceRange = uint248((nonce >> 8) & ORDER_NONCE_MASK); // The bitvector is indexed by the lower 8 bits of the nonce. uint256 flag = 1 << (nonce & 255); // Update order status bit vector to indicate that the given order // has been cancelled/filled by setting the designated bit to 1. LibERC721OrdersStorage.getStorage().orderStatusByMaker[maker][nonceRange] |= flag; } /// @dev Get the order info for an NFT sell order. /// @param order The NFT sell order. /// @return orderInfo Info about the order. function _getOrderInfo(LibNFTOrder.NFTSellOrder memory order) internal view returns (LibNFTOrder.OrderInfoV2 memory orderInfo) { orderInfo.structHash = _getSellOrderStructHash(order); orderInfo.orderHash = _getEIP712Hash(orderInfo.structHash); orderInfo.orderAmount = 1; // Check if the order has been filled or cancelled. if (_isOrderFilledOrCancelled(order.maker, order.nonce)) { orderInfo.status = LibNFTOrder.OrderStatus.UNFILLABLE; return orderInfo; } // The `remainingAmount` should be set to 1 if the order is not filled. orderInfo.remainingAmount = 1; // Check for listingTime. if ((order.expiry >> 32) & 0xffffffff > block.timestamp) { orderInfo.status = LibNFTOrder.OrderStatus.INVALID; return orderInfo; } // Check for expiryTime. if (order.expiry & 0xffffffff <= block.timestamp) { orderInfo.status = LibNFTOrder.OrderStatus.EXPIRED; return orderInfo; } orderInfo.status = LibNFTOrder.OrderStatus.FILLABLE; return orderInfo; } /// @dev Get the order info for an NFT buy order. /// @param order The NFT buy order. /// @return orderInfo Info about the order. function _getOrderInfo(LibNFTOrder.NFTBuyOrder memory order) internal view returns (LibNFTOrder.OrderInfoV2 memory orderInfo) { orderInfo.structHash = _getBuyOrderStructHash(order); orderInfo.orderHash = _getEIP712Hash(orderInfo.structHash); if (order.expiry >> 252 == LibStructure.ORDER_KIND_BATCH_OFFER_ERC721S) { orderInfo.orderAmount = uint128((order.expiry >> 64) & 0xffffffff); orderInfo.remainingAmount = orderInfo.orderAmount - LibERC721OrdersStorage.getStorage().filledAmount[orderInfo.orderHash]; // Check if the order has been filled or cancelled. if (orderInfo.remainingAmount == 0 || _isOrderFilledOrCancelled(order.maker, order.nonce)) { orderInfo.status = LibNFTOrder.OrderStatus.UNFILLABLE; return orderInfo; } // Sell multiple nfts requires `nftId` == 0 and `nftProperties.length` > 0. if (order.nftId != 0 || order.nftProperties.length == 0) { orderInfo.status = LibNFTOrder.OrderStatus.INVALID; return orderInfo; } } else { orderInfo.orderAmount = 1; // Check if the order has been filled or cancelled. if (_isOrderFilledOrCancelled(order.maker, order.nonce)) { orderInfo.status = LibNFTOrder.OrderStatus.UNFILLABLE; return orderInfo; } // The `remainingAmount` should be set to 1 if the order is not filled. orderInfo.remainingAmount = 1; // Only buy orders with `nftId` == 0 can be propertyorders. if (order.nftProperties.length > 0 && order.nftId != 0) { orderInfo.status = LibNFTOrder.OrderStatus.INVALID; return orderInfo; } } // Buy orders cannot use ETH as the ERC20 token if (address(order.erc20Token) == NATIVE_TOKEN_ADDRESS) { orderInfo.status = LibNFTOrder.OrderStatus.INVALID; return orderInfo; } // Check for listingTime. if ((order.expiry >> 32) & 0xffffffff > block.timestamp) { orderInfo.status = LibNFTOrder.OrderStatus.INVALID; return orderInfo; } // Check for expiryTime. if (order.expiry & 0xffffffff <= block.timestamp) { orderInfo.status = LibNFTOrder.OrderStatus.EXPIRED; return orderInfo; } orderInfo.status = LibNFTOrder.OrderStatus.FILLABLE; return orderInfo; } function _isOrderFilledOrCancelled(address maker, uint256 nonce) internal view returns(bool) { // Order status bit vectors are indexed by maker address and the // upper 248 bits of the order nonce. We define `nonceRange` to be // these 248 bits. uint248 nonceRange = uint248((nonce >> 8) & ORDER_NONCE_MASK); // `orderStatusByMaker` is indexed by maker and nonce. uint256 orderStatusBitVector = LibERC721OrdersStorage.getStorage().orderStatusByMaker[maker][nonceRange]; // The bitvector is indexed by the lower 8 bits of the nonce. uint256 flag = 1 << (nonce & 255); // If the designated bit is set, the order has been cancelled or // previously filled. return orderStatusBitVector & flag != 0; } function _getBuyOrderStructHash(LibNFTOrder.NFTBuyOrder memory order) internal view returns(bytes32) { return LibNFTOrder.getNFTBuyOrderStructHash( order, LibCommonNftOrdersStorage.getStorage().hashNonces[order.maker] ); } function _getSellOrderStructHash(LibNFTOrder.NFTSellOrder memory order) internal view returns(bytes32) { return LibNFTOrder.getNFTSellOrderStructHash( order, LibCommonNftOrdersStorage.getStorage().hashNonces[order.maker] ); } function _getBulkBuyOrderTypeHash(uint256 height) internal override pure returns (bytes32) { return LibTypeHash.getBulkERC721BuyOrderTypeHash(height); } function _getBulkSellOrderTypeHash(uint256 height) internal override pure returns (bytes32) { return LibTypeHash.getBulkERC721SellOrderTypeHash(height); } /// @dev Get the EIP-712 hash of an ERC721 sell order. /// @param order The ERC721 sell order. /// @return orderHash The order hash. function getERC721SellOrderHash(LibNFTOrder.NFTSellOrder memory order) public override view returns (bytes32) { return _getEIP712Hash(_getSellOrderStructHash(order)); } /// @dev Get the EIP-712 hash of an ERC721 buy order. /// @param order The ERC721 buy order. /// @return orderHash The order hash. function getERC721BuyOrderHash(LibNFTOrder.NFTBuyOrder memory order) public override view returns (bytes32) { return _getEIP712Hash(_getBuyOrderStructHash(order)); } /// @dev Get the current status of an ERC721 sell order. /// @param order The ERC721 sell order. /// @return status The status of the order. function getERC721SellOrderStatus(LibNFTOrder.NFTSellOrder memory order) external override view returns (LibNFTOrder.OrderStatus) { return _getOrderInfo(order).status; } /// @dev Get the current status of an ERC721 buy order. /// @param order The ERC721 buy order. /// @return status The status of the order. function getERC721BuyOrderStatus(LibNFTOrder.NFTBuyOrder memory order) external override view returns (LibNFTOrder.OrderStatus) { return _getOrderInfo(order).status; } /// @dev Get the order info for an ERC721 buy order. /// @param order The ERC721 buy order. /// @return orderInfo Infor about the order. function getERC721BuyOrderInfo(LibNFTOrder.NFTBuyOrder memory order) external view returns (LibNFTOrder.OrderInfo memory orderInfo) { LibNFTOrder.OrderInfoV2 memory info = _getOrderInfo(order); orderInfo.status = info.status; orderInfo.remainingAmount = info.remainingAmount; orderInfo.orderAmount = info.orderAmount; orderInfo.orderHash = info.orderHash; return orderInfo; } /// @dev Get the order status bit vector for the given /// maker address and nonce range. /// @param maker The maker of the order. /// @param nonceRange Order status bit vectors are indexed /// by maker address and the upper 248 bits of the /// order nonce. We define `nonceRange` to be these /// 248 bits. /// @return bitVector The order status bit vector for the /// given maker and nonce range. function getERC721OrderStatusBitVector(address maker, uint248 nonceRange) external override view returns (uint256) { uint248 range = uint248(nonceRange & ORDER_NONCE_MASK); return LibERC721OrdersStorage.getStorage().orderStatusByMaker[maker][range]; } function getHashNonce(address maker) external override view returns (uint256) { return LibCommonNftOrdersStorage.getStorage().hashNonces[maker]; } /// Increment a particular maker's nonce, thereby invalidating all orders that were not signed /// with the original nonce. function incrementHashNonce() external override { uint256 newHashNonce = ++LibCommonNftOrdersStorage.getStorage().hashNonces[msg.sender]; emit HashNonceIncremented(msg.sender, newHashNonce); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: Apache-2.0 /* Modifications Copyright 2022 Element.Market Copyright 2021 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.8.17; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../libs/LibNFTOrder.sol"; import "../libs/LibStructure.sol"; interface IERC721OrdersEvent { /// @dev Emitted whenever an `ERC721SellOrder` is filled. /// @param orderHash The `ERC721SellOrder` hash. /// @param maker The maker of the order. /// @param taker The taker of the order. /// @param erc20Token The address of the ERC20 token. /// @param erc20TokenAmount The amount of ERC20 token to sell. /// @param erc721Token The address of the ERC721 token. /// @param erc721TokenId The ID of the ERC721 asset. event ERC721SellOrderFilled( bytes32 orderHash, address maker, address taker, uint256 nonce, IERC20 erc20Token, uint256 erc20TokenAmount, LibStructure.Fee[] fees, address erc721Token, uint256 erc721TokenId ); /// @dev Emitted whenever an `ERC721BuyOrder` is filled. /// @param orderHash The `ERC721BuyOrder` hash. /// @param maker The maker of the order. /// @param taker The taker of the order. /// @param erc20Token The address of the ERC20 token. /// @param erc20TokenAmount The amount of ERC20 token to buy. /// @param erc721Token The address of the ERC721 token. /// @param erc721TokenId The ID of the ERC721 asset. event ERC721BuyOrderFilled( bytes32 orderHash, address maker, address taker, uint256 nonce, IERC20 erc20Token, uint256 erc20TokenAmount, LibStructure.Fee[] fees, address erc721Token, uint256 erc721TokenId ); /// @dev Emitted whenever an `ERC721Order` is cancelled. /// @param maker The maker of the order. /// @param nonce The nonce of the order that was cancelled. event ERC721OrderCancelled(address maker, uint256 nonce); /// @dev Emitted HashNonceIncremented. event HashNonceIncremented(address maker, uint256 newHashNonce); }
// SPDX-License-Identifier: Apache-2.0 /* Modifications Copyright 2022 Element.Market Copyright 2021 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.8.17; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../libs/LibNFTOrder.sol"; import "../libs/LibSignature.sol"; import "../libs/LibStructure.sol"; import "./IERC721OrdersEvent.sol"; /// @dev Feature for interacting with ERC721 orders. interface IERC721OrdersFeature is IERC721OrdersEvent { /// @dev Sells an ERC721 asset to fill the given order. /// @param buyOrder The ERC721 buy order. /// @param signature The order signature from the maker. /// @param erc721TokenId The ID of the ERC721 asset being /// sold. If the given order specifies properties, /// the asset must satisfy those properties. Otherwise, /// it must equal the tokenId in the order. /// @param unwrapNativeToken If this parameter is true and the /// ERC20 token of the order is e.g. WETH, unwraps the /// token before transferring it to the taker. function sellERC721( LibNFTOrder.NFTBuyOrder calldata buyOrder, LibSignature.Signature calldata signature, uint256 erc721TokenId, bool unwrapNativeToken, bytes calldata takerData ) external; /// @dev Sells multiple ERC721 assets by filling the /// given orders. /// @param datas The encoded `sellERC721` calldatas. /// @param revertIfIncomplete If true, reverts if this /// function fails to fill any individual order. function batchSellERC721s(bytes[] calldata datas, bool revertIfIncomplete) external; /// @dev Buys an ERC721 asset by filling the given order. /// @param sellOrder The ERC721 sell order. /// @param signature The order signature. /// @param taker The address to receive ERC721. If this parameter /// is zero, transfer ERC721 to `msg.sender`. function buyERC721Ex( LibNFTOrder.NFTSellOrder calldata sellOrder, LibSignature.Signature calldata signature, address taker, bytes calldata takerData ) external payable; /// @dev Cancel a single ERC721 order by its nonce. The caller /// should be the maker of the order. Silently succeeds if /// an order with the same nonce has already been filled or /// cancelled. /// @param orderNonce The order nonce. function cancelERC721Order(uint256 orderNonce) external; /// @dev Cancel multiple ERC721 orders by their nonces. The caller /// should be the maker of the orders. Silently succeeds if /// an order with the same nonce has already been filled or /// cancelled. /// @param orderNonces The order nonces. function batchCancelERC721Orders(uint256[] calldata orderNonces) external; /// @dev Buys multiple ERC721 assets by filling the /// given orders. /// @param sellOrders The ERC721 sell orders. /// @param signatures The order signatures. /// @param takers The address to receive ERC721. /// @param takerDatas The data (if any) to pass to the taker /// callback for each order. Refer to the `takerData` /// parameter to for `buyERC721`. /// @param revertIfIncomplete If true, reverts if this /// function fails to fill any individual order. /// @return successes An array of booleans corresponding to whether /// each order in `orders` was successfully filled. function batchBuyERC721sEx( LibNFTOrder.NFTSellOrder[] calldata sellOrders, LibSignature.Signature[] calldata signatures, address[] calldata takers, bytes[] calldata takerDatas, bool revertIfIncomplete ) external payable returns (bool[] memory successes); /// @dev Matches a pair of complementary orders that have /// a non-negative spread. Each order is filled at /// their respective price, and the matcher receives /// a profit denominated in the ERC20 token. /// @param sellOrder Order selling an ERC721 asset. /// @param buyOrder Order buying an ERC721 asset. /// @param sellOrderSignature Signature for the sell order. /// @param buyOrderSignature Signature for the buy order. /// @return profit The amount of profit earned by the caller /// of this function (denominated in the ERC20 token /// of the matched orders). function matchERC721Order( LibNFTOrder.NFTSellOrder calldata sellOrder, LibNFTOrder.NFTBuyOrder calldata buyOrder, LibSignature.Signature calldata sellOrderSignature, LibSignature.Signature calldata buyOrderSignature, bytes calldata sellTakerData, bytes calldata buyTakerData ) external returns (uint256 profit); /// @dev Callback for the ERC721 `safeTransferFrom` function. /// This callback can be used to sell an ERC721 asset if /// a valid ERC721 order, signature and `unwrapNativeToken` /// are encoded in `data`. This allows takers to sell their /// ERC721 asset without first calling `setApprovalForAll`. /// @param operator The address which called `safeTransferFrom`. /// @param from The address which previously owned the token. /// @param tokenId The ID of the asset being transferred. /// @param data Additional data with no specified format. If a /// valid ERC721 order, signature and `unwrapNativeToken` /// are encoded in `data`, this function will try to fill /// the order using the received asset. /// @return success The selector of this function (0x150b7a02), /// indicating that the callback succeeded. function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4 success); /// @dev Checks whether the given signature is valid for the /// the given ERC721 sell order. Reverts if not. /// @param order The ERC721 sell order. /// @param signature The signature to validate. function validateERC721SellOrderSignature( LibNFTOrder.NFTSellOrder calldata order, LibSignature.Signature calldata signature ) external view; /// @dev Checks whether the given signature is valid for the /// the given ERC721 sell order. Reverts if not. /// @param order The ERC721 sell order. /// @param signature The signature to validate. function validateERC721SellOrderSignature( LibNFTOrder.NFTSellOrder calldata order, LibSignature.Signature calldata signature, bytes calldata takerData ) external view; /// @dev Checks whether the given signature is valid for the /// the given ERC721 buy order. Reverts if not. /// @param order The ERC721 buy order. /// @param signature The signature to validate. function validateERC721BuyOrderSignature( LibNFTOrder.NFTBuyOrder calldata order, LibSignature.Signature calldata signature ) external view; /// @dev Checks whether the given signature is valid for the /// the given ERC721 buy order. Reverts if not. /// @param order The ERC721 buy order. /// @param signature The signature to validate. function validateERC721BuyOrderSignature( LibNFTOrder.NFTBuyOrder calldata order, LibSignature.Signature calldata signature, bytes calldata takerData ) external view; /// @dev Get the current status of an ERC721 sell order. /// @param order The ERC721 sell order. /// @return status The status of the order. function getERC721SellOrderStatus( LibNFTOrder.NFTSellOrder calldata order ) external view returns (LibNFTOrder.OrderStatus); /// @dev Get the current status of an ERC721 buy order. /// @param order The ERC721 buy order. /// @return status The status of the order. function getERC721BuyOrderStatus( LibNFTOrder.NFTBuyOrder calldata order ) external view returns (LibNFTOrder.OrderStatus); /// @dev Get the order info for an ERC721 buy order. /// @param order The ERC721 buy order. /// @return orderInfo Infor about the order. function getERC721BuyOrderInfo( LibNFTOrder.NFTBuyOrder calldata order ) external view returns (LibNFTOrder.OrderInfo memory); /// @dev Get the EIP-712 hash of an ERC721 sell order. /// @param order The ERC721 sell order. /// @return orderHash The order hash. function getERC721SellOrderHash( LibNFTOrder.NFTSellOrder calldata order ) external view returns (bytes32); /// @dev Get the EIP-712 hash of an ERC721 buy order. /// @param order The ERC721 buy order. /// @return orderHash The order hash. function getERC721BuyOrderHash( LibNFTOrder.NFTBuyOrder calldata order ) external view returns (bytes32); /// @dev Get the order status bit vector for the given /// maker address and nonce range. /// @param maker The maker of the order. /// @param nonceRange Order status bit vectors are indexed /// by maker address and the upper 248 bits of the /// order nonce. We define `nonceRange` to be these /// 248 bits. /// @return bitVector The order status bit vector for the /// given maker and nonce range. function getERC721OrderStatusBitVector(address maker, uint248 nonceRange) external view returns (uint256); function getHashNonce(address maker) external view returns (uint256); /// Increment a particular maker's nonce, thereby invalidating all orders that were not signed /// with the original nonce. function incrementHashNonce() external; }
// SPDX-License-Identifier: Apache-2.0 /* Modifications Copyright 2022 Element.Market Copyright 2020 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.8.13; // solhint-disable no-empty-blocks /// @dev Owner management and migration features. interface IOwnableFeature { /// @dev Emitted by Ownable when ownership is transferred. /// @param previousOwner The previous owner of the contract. /// @param newOwner The new owner of the contract. event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /// @dev Transfers ownership of the contract to a new address. /// @param newOwner The address that will become the owner. function transferOwnership(address newOwner) external; /// @dev The owner of this contract. /// @return ownerAddress The owner address. function owner() external view returns (address ownerAddress); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; library LibMultiCall { uint256 private constant SELECTOR_MASK = (0xffffffff << 224); function _multiCall( address impl, bytes4 targetSelector, bytes4 checkupSelector, bytes[] calldata datas, bool revertIfIncomplete ) internal { assembly { let someSuccess := 0 let ptrEnd := add(datas.offset, mul(datas.length, 0x20)) for { let ptr := datas.offset } lt(ptr, ptrEnd) { ptr := add(ptr, 0x20) } { let ptrData := add(datas.offset, calldataload(ptr)) // Check the data length let dataLength := calldataload(ptrData) if lt(dataLength, 0x4) { if revertIfIncomplete { _revertDatasError() } continue } let calldataSelector := and(calldataload(add(ptrData, 0x20)), SELECTOR_MASK) if eq(calldataSelector, checkupSelector) { // Copy calldata to memory mstore(0, targetSelector) calldatacopy(0x4, add(ptrData, 0x24), sub(dataLength, 0x4)) if delegatecall(gas(), impl, 0, dataLength, 0, 0) { someSuccess := 1 continue } if revertIfIncomplete { returndatacopy(0, 0, returndatasize()) revert(0, returndatasize()) } continue } if revertIfIncomplete { _revertSelectorMismatch() } } if iszero(someSuccess) { _revertNoCallSuccess() } function _revertDatasError() { // revert("_multiCall: data error") mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000) mstore(0x20, 0x0000002000000000000000000000000000000000000000000000000000000000) mstore(0x40, 0x000000165f6d756c746943616c6c3a2064617461206572726f72000000000000) mstore(0x60, 0) revert(0, 0x64) } function _revertSelectorMismatch() { // revert("_multiCall: selector mismatch") mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000) mstore(0x20, 0x0000002000000000000000000000000000000000000000000000000000000000) mstore(0x40, 0x0000001d5f6d756c746943616c6c3a2073656c6563746f72206d69736d617463) mstore(0x60, 0x6800000000000000000000000000000000000000000000000000000000000000) revert(0, 0x64) } function _revertNoCallSuccess() { // revert("_multiCall: all calls failed") mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000) mstore(0x20, 0x0000002000000000000000000000000000000000000000000000000000000000) mstore(0x40, 0x0000001c5f6d756c746943616c6c3a20616c6c2063616c6c73206661696c6564) mstore(0x60, 0) revert(0, 0x64) } } } }
// SPDX-License-Identifier: Apache-2.0 /* Modifications Copyright 2022 Element.Market Copyright 2021 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.8.17; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../../vendor/IPropertyValidator.sol"; /// @dev A library for common NFT order operations. library LibNFTOrder { enum OrderStatus { INVALID, FILLABLE, UNFILLABLE, EXPIRED } struct Property { IPropertyValidator propertyValidator; bytes propertyData; } struct Fee { address recipient; uint256 amount; bytes feeData; } struct NFTSellOrder { address maker; address taker; uint256 expiry; uint256 nonce; IERC20 erc20Token; uint256 erc20TokenAmount; Fee[] fees; address nft; uint256 nftId; } // All fields except `nftProperties` align // with those of NFTSellOrder struct NFTBuyOrder { address maker; address taker; uint256 expiry; uint256 nonce; IERC20 erc20Token; uint256 erc20TokenAmount; Fee[] fees; address nft; uint256 nftId; Property[] nftProperties; } // All fields except `erc1155TokenAmount` align // with those of NFTSellOrder struct ERC1155SellOrder { address maker; address taker; uint256 expiry; uint256 nonce; IERC20 erc20Token; uint256 erc20TokenAmount; Fee[] fees; address erc1155Token; uint256 erc1155TokenId; // End of fields shared with NFTOrder uint128 erc1155TokenAmount; } // All fields except `erc1155TokenAmount` align // with those of NFTBuyOrder struct ERC1155BuyOrder { address maker; address taker; uint256 expiry; uint256 nonce; IERC20 erc20Token; uint256 erc20TokenAmount; Fee[] fees; address erc1155Token; uint256 erc1155TokenId; Property[] erc1155TokenProperties; // End of fields shared with NFTOrder uint128 erc1155TokenAmount; } struct OrderInfo { bytes32 orderHash; OrderStatus status; // `orderAmount` is 1 for all ERC721Orders, and // `erc1155TokenAmount` for ERC1155Orders. uint128 orderAmount; // The remaining amount of the ERC721/ERC1155 asset // that can be filled for the order. uint128 remainingAmount; } struct OrderInfoV2 { bytes32 structHash; bytes32 orderHash; OrderStatus status; uint128 orderAmount; uint128 remainingAmount; } // The type hash for sell orders, which is: // keccak256(abi.encodePacked( // "NFTSellOrder(", // "address maker,", // "address taker,", // "uint256 expiry,", // "uint256 nonce,", // "address erc20Token,", // "uint256 erc20TokenAmount,", // "Fee[] fees,", // "address nft,", // "uint256 nftId,", // "uint256 hashNonce", // ")", // "Fee(", // "address recipient,", // "uint256 amount,", // "bytes feeData", // ")" // )) uint256 private constant _NFT_SELL_ORDER_TYPE_HASH = 0xed676c7f3e8232a311454799b1cf26e75b4abc90c9bf06c9f7e8e79fcc7fe14d; // The type hash for buy orders, which is: // keccak256(abi.encodePacked( // "NFTBuyOrder(", // "address maker,", // "address taker,", // "uint256 expiry,", // "uint256 nonce,", // "address erc20Token,", // "uint256 erc20TokenAmount,", // "Fee[] fees,", // "address nft,", // "uint256 nftId,", // "Property[] nftProperties,", // "uint256 hashNonce", // ")", // "Fee(", // "address recipient,", // "uint256 amount,", // "bytes feeData", // ")", // "Property(", // "address propertyValidator,", // "bytes propertyData", // ")" // )) uint256 private constant _NFT_BUY_ORDER_TYPE_HASH = 0xa525d336300f566329800fcbe82fd263226dc27d6c109f060d9a4a364281521c; // The type hash for ERC1155 sell orders, which is: // keccak256(abi.encodePacked( // "ERC1155SellOrder(", // "address maker,", // "address taker,", // "uint256 expiry,", // "uint256 nonce,", // "address erc20Token,", // "uint256 erc20TokenAmount,", // "Fee[] fees,", // "address erc1155Token,", // "uint256 erc1155TokenId,", // "uint128 erc1155TokenAmount,", // "uint256 hashNonce", // ")", // "Fee(", // "address recipient,", // "uint256 amount,", // "bytes feeData", // ")" // )) uint256 private constant _ERC_1155_SELL_ORDER_TYPE_HASH = 0x3529b5920cc48ecbceb24e9c51dccb50fefd8db2cf05d36e356aeb1754e19eda; // The type hash for ERC1155 buy orders, which is: // keccak256(abi.encodePacked( // "ERC1155BuyOrder(", // "address maker,", // "address taker,", // "uint256 expiry,", // "uint256 nonce,", // "address erc20Token,", // "uint256 erc20TokenAmount,", // "Fee[] fees,", // "address erc1155Token,", // "uint256 erc1155TokenId,", // "Property[] erc1155TokenProperties,", // "uint128 erc1155TokenAmount,", // "uint256 hashNonce", // ")", // "Fee(", // "address recipient,", // "uint256 amount,", // "bytes feeData", // ")", // "Property(", // "address propertyValidator,", // "bytes propertyData", // ")" // )) uint256 private constant _ERC_1155_BUY_ORDER_TYPE_HASH = 0x1a6eaae1fbed341e0974212ec17f035a9d419cadc3bf5154841cbf7fd605ba48; // keccak256(abi.encodePacked( // "Fee(", // "address recipient,", // "uint256 amount,", // "bytes feeData", // ")" // )) uint256 private constant _FEE_TYPE_HASH = 0xe68c29f1b4e8cce0bbcac76eb1334bdc1dc1f293a517c90e9e532340e1e94115; // keccak256(abi.encodePacked( // "Property(", // "address propertyValidator,", // "bytes propertyData", // ")" // )) uint256 private constant _PROPERTY_TYPE_HASH = 0x6292cf854241cb36887e639065eca63b3af9f7f70270cebeda4c29b6d3bc65e8; // keccak256(""); bytes32 private constant _EMPTY_ARRAY_KECCAK256 = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // keccak256(abi.encodePacked(keccak256(abi.encode( // _PROPERTY_TYPE_HASH, // address(0), // keccak256("") // )))); bytes32 private constant _NULL_PROPERTY_STRUCT_HASH = 0x720ee400a9024f6a49768142c339bf09d2dd9056ab52d20fbe7165faba6e142d; uint256 private constant ADDRESS_MASK = (1 << 160) - 1; function asNFTSellOrder(NFTBuyOrder memory nftBuyOrder) internal pure returns (NFTSellOrder memory order) { assembly { order := nftBuyOrder } } function asNFTSellOrder(ERC1155SellOrder memory erc1155SellOrder) internal pure returns (NFTSellOrder memory order) { assembly { order := erc1155SellOrder } } function asNFTSellOrder(ERC1155BuyOrder memory erc1155BuyOrder) internal pure returns (NFTSellOrder memory order) { assembly { order := erc1155BuyOrder } } function asNFTBuyOrder(ERC1155BuyOrder memory erc1155BuyOrder) internal pure returns (NFTBuyOrder memory order) { assembly { order := erc1155BuyOrder } } function asERC1155SellOrder(NFTSellOrder memory nftSellOrder) internal pure returns (ERC1155SellOrder memory order) { assembly { order := nftSellOrder } } function asERC1155BuyOrder(NFTBuyOrder memory nftBuyOrder) internal pure returns (ERC1155BuyOrder memory order) { assembly { order := nftBuyOrder } } // @dev Get the struct hash of an sell order. /// @param order The sell order. /// @return structHash The struct hash of the order. function getNFTSellOrderStructHash(NFTSellOrder memory order, uint256 hashNonce) internal pure returns (bytes32 structHash) { bytes32 feesHash = _feesHash(order.fees); // Hash in place, equivalent to: // return keccak256(abi.encode( // _NFT_SELL_ORDER_TYPE_HASH, // order.maker, // order.taker, // order.expiry, // order.nonce, // order.erc20Token, // order.erc20TokenAmount, // feesHash, // order.nft, // order.nftId, // hashNonce // )); assembly { if lt(order, 32) { invalid() } // Don't underflow memory. let typeHashPos := sub(order, 32) // order - 32 let feesHashPos := add(order, 192) // order + (32 * 6) let hashNoncePos := add(order, 288) // order + (32 * 9) let typeHashMemBefore := mload(typeHashPos) let feeHashMemBefore := mload(feesHashPos) let hashNonceMemBefore := mload(hashNoncePos) mstore(typeHashPos, _NFT_SELL_ORDER_TYPE_HASH) mstore(feesHashPos, feesHash) mstore(hashNoncePos, hashNonce) structHash := keccak256(typeHashPos, 352 /* 32 * 11 */ ) mstore(typeHashPos, typeHashMemBefore) mstore(feesHashPos, feeHashMemBefore) mstore(hashNoncePos, hashNonceMemBefore) } return structHash; } /// @dev Get the struct hash of an buy order. /// @param order The buy order. /// @return structHash The struct hash of the order. function getNFTBuyOrderStructHash(NFTBuyOrder memory order, uint256 hashNonce) internal pure returns (bytes32 structHash) { bytes32 propertiesHash = _propertiesHash(order.nftProperties); bytes32 feesHash = _feesHash(order.fees); // Hash in place, equivalent to: // return keccak256(abi.encode( // _NFT_BUY_ORDER_TYPE_HASH, // order.maker, // order.taker, // order.expiry, // order.nonce, // order.erc20Token, // order.erc20TokenAmount, // feesHash, // order.nft, // order.nftId, // propertiesHash, // hashNonce // )); assembly { if lt(order, 32) { invalid() } // Don't underflow memory. let typeHashPos := sub(order, 32) // order - 32 let feesHashPos := add(order, 192) // order + (32 * 6) let propertiesHashPos := add(order, 288) // order + (32 * 9) let hashNoncePos := add(order, 320) // order + (32 * 10) let typeHashMemBefore := mload(typeHashPos) let feeHashMemBefore := mload(feesHashPos) let propertiesHashMemBefore := mload(propertiesHashPos) let hashNonceMemBefore := mload(hashNoncePos) mstore(typeHashPos, _NFT_BUY_ORDER_TYPE_HASH) mstore(feesHashPos, feesHash) mstore(propertiesHashPos, propertiesHash) mstore(hashNoncePos, hashNonce) structHash := keccak256(typeHashPos, 384 /* 32 * 12 */ ) mstore(typeHashPos, typeHashMemBefore) mstore(feesHashPos, feeHashMemBefore) mstore(propertiesHashPos, propertiesHashMemBefore) mstore(hashNoncePos, hashNonceMemBefore) } return structHash; } /// @dev Get the struct hash of an ERC1155 sell order. /// @param order The ERC1155 sell order. /// @return structHash The struct hash of the order. function getERC1155SellOrderStructHash(ERC1155SellOrder memory order, uint256 hashNonce) internal pure returns (bytes32 structHash) { bytes32 feesHash = _feesHash(order.fees); // Hash in place, equivalent to: // return keccak256(abi.encode( // _ERC_1155_SELL_ORDER_TYPE_HASH, // order.maker, // order.taker, // order.expiry, // order.nonce, // order.erc20Token, // order.erc20TokenAmount, // feesHash, // order.erc1155Token, // order.erc1155TokenId, // order.erc1155TokenAmount, // hashNonce // )); assembly { if lt(order, 32) { invalid() } // Don't underflow memory. let typeHashPos := sub(order, 32) // order - 32 let feesHashPos := add(order, 192) // order + (32 * 6) let hashNoncePos := add(order, 320) // order + (32 * 10) let typeHashMemBefore := mload(typeHashPos) let feesHashMemBefore := mload(feesHashPos) let hashNonceMemBefore := mload(hashNoncePos) mstore(typeHashPos, _ERC_1155_SELL_ORDER_TYPE_HASH) mstore(feesHashPos, feesHash) mstore(hashNoncePos, hashNonce) structHash := keccak256(typeHashPos, 384 /* 32 * 12 */ ) mstore(typeHashPos, typeHashMemBefore) mstore(feesHashPos, feesHashMemBefore) mstore(hashNoncePos, hashNonceMemBefore) } return structHash; } /// @dev Get the struct hash of an ERC1155 buy order. /// @param order The ERC1155 buy order. /// @return structHash The struct hash of the order. function getERC1155BuyOrderStructHash(ERC1155BuyOrder memory order, uint256 hashNonce) internal pure returns (bytes32 structHash) { bytes32 propertiesHash = _propertiesHash(order.erc1155TokenProperties); bytes32 feesHash = _feesHash(order.fees); // Hash in place, equivalent to: // return keccak256(abi.encode( // _ERC_1155_BUY_ORDER_TYPE_HASH, // order.maker, // order.taker, // order.expiry, // order.nonce, // order.erc20Token, // order.erc20TokenAmount, // feesHash, // order.erc1155Token, // order.erc1155TokenId, // propertiesHash, // order.erc1155TokenAmount, // hashNonce // )); assembly { if lt(order, 32) { invalid() } // Don't underflow memory. let typeHashPos := sub(order, 32) // order - 32 let feesHashPos := add(order, 192) // order + (32 * 6) let propertiesHashPos := add(order, 288) // order + (32 * 9) let hashNoncePos := add(order, 352) // order + (32 * 11) let typeHashMemBefore := mload(typeHashPos) let feesHashMemBefore := mload(feesHashPos) let propertiesHashMemBefore := mload(propertiesHashPos) let hashNonceMemBefore := mload(hashNoncePos) mstore(typeHashPos, _ERC_1155_BUY_ORDER_TYPE_HASH) mstore(feesHashPos, feesHash) mstore(propertiesHashPos, propertiesHash) mstore(hashNoncePos, hashNonce) structHash := keccak256(typeHashPos, 416 /* 32 * 13 */ ) mstore(typeHashPos, typeHashMemBefore) mstore(feesHashPos, feesHashMemBefore) mstore(propertiesHashPos, propertiesHashMemBefore) mstore(hashNoncePos, hashNonceMemBefore) } return structHash; } // Hashes the `properties` array as part of computing the // EIP-712 hash of an `ERC721Order` or `ERC1155Order`. function _propertiesHash(Property[] memory properties) private pure returns (bytes32 propertiesHash) { uint256 numProperties = properties.length; // We give `properties.length == 0` and `properties.length == 1` // special treatment because we expect these to be the most common. if (numProperties == 0) { propertiesHash = _EMPTY_ARRAY_KECCAK256; } else if (numProperties == 1) { Property memory property = properties[0]; if (address(property.propertyValidator) == address(0) && property.propertyData.length == 0) { propertiesHash = _NULL_PROPERTY_STRUCT_HASH; } else { // propertiesHash = keccak256(abi.encodePacked(keccak256(abi.encode( // _PROPERTY_TYPE_HASH, // properties[0].propertyValidator, // keccak256(properties[0].propertyData) // )))); bytes32 dataHash = keccak256(property.propertyData); assembly { // Load free memory pointer let mem := mload(64) mstore(mem, _PROPERTY_TYPE_HASH) // property.propertyValidator mstore(add(mem, 32), and(ADDRESS_MASK, mload(property))) // keccak256(property.propertyData) mstore(add(mem, 64), dataHash) mstore(mem, keccak256(mem, 96)) propertiesHash := keccak256(mem, 32) } } } else { bytes32[] memory propertyStructHashArray = new bytes32[](numProperties); for (uint256 i = 0; i < numProperties; i++) { propertyStructHashArray[i] = keccak256(abi.encode( _PROPERTY_TYPE_HASH, properties[i].propertyValidator, keccak256(properties[i].propertyData))); } assembly { propertiesHash := keccak256(add(propertyStructHashArray, 32), mul(numProperties, 32)) } } } // Hashes the `fees` array as part of computing the // EIP-712 hash of an `ERC721Order` or `ERC1155Order`. function _feesHash(Fee[] memory fees) private pure returns (bytes32 feesHash) { uint256 numFees = fees.length; // We give `fees.length == 0` and `fees.length == 1` // special treatment because we expect these to be the most common. if (numFees == 0) { feesHash = _EMPTY_ARRAY_KECCAK256; } else if (numFees == 1) { // feesHash = keccak256(abi.encodePacked(keccak256(abi.encode( // _FEE_TYPE_HASH, // fees[0].recipient, // fees[0].amount, // keccak256(fees[0].feeData) // )))); Fee memory fee = fees[0]; bytes32 dataHash = keccak256(fee.feeData); assembly { // Load free memory pointer let mem := mload(64) mstore(mem, _FEE_TYPE_HASH) // fee.recipient mstore(add(mem, 32), and(ADDRESS_MASK, mload(fee))) // fee.amount mstore(add(mem, 64), mload(add(fee, 32))) // keccak256(fee.feeData) mstore(add(mem, 96), dataHash) mstore(mem, keccak256(mem, 128)) feesHash := keccak256(mem, 32) } } else { bytes32[] memory feeStructHashArray = new bytes32[](numFees); for (uint256 i = 0; i < numFees; i++) { feeStructHashArray[i] = keccak256(abi.encode(_FEE_TYPE_HASH, fees[i].recipient, fees[i].amount, keccak256(fees[i].feeData))); } assembly { feesHash := keccak256(add(feeStructHashArray, 32), mul(numFees, 32)) } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import "../../storage/LibCommonNftOrdersStorage.sol"; library LibOracleSignature { function isNeedValidateOracleSignature(uint256 expiry) internal pure returns(bool) { return (expiry >> 248) & 0x1 == 1; } function validateOracleSignature( bytes32 orderHash, address taker, bytes memory data ) internal view returns(bytes memory childData) { uint256 dataLength = data.length; require(dataLength >= 69, "Oracle signature error"); address oracleSigner = LibCommonNftOrdersStorage.getOracleSigner(); if (oracleSigner == address(0)) { assembly { // 32bytes[dataLength] + 4bytes[deadline] + 65bytes[signature] + [childData] childData := add(data, 69) mstore(childData, sub(dataLength, 69)) } return childData; } uint8 v; bytes32 r; bytes32 s; uint256 deadline; bytes32 hash; assembly { // 32bytes[dataLength] + 4bytes[deadline] + 65bytes[signature] + [childData] deadline := and(mload(add(data, 0x4)), 0xffffffff) r := mload(add(data, 0x24)) s := mload(add(data, 0x44)) v := and(mload(add(data, 0x45)), 0xff) let ptr := mload(0x40) mstore(ptr, chainid()) mstore(add(ptr, 0x20), address()) mstore(add(ptr, 0x40), orderHash) mstore(add(ptr, 0x60), taker) mstore(add(ptr, 0x80), deadline) hash := keccak256(ptr, 0xa0) childData := add(data, 69) mstore(childData, sub(dataLength, 69)) } require(block.timestamp < deadline, "Oracle deadline reached"); require(ecrecover(hash, v, r, s) == oracleSigner, "Invalid oracle signature"); return childData; } }
// SPDX-License-Identifier: Apache-2.0 /* Modifications Copyright 2022 Element.Market Copyright 2020 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.8.17; /// @dev A library for validating signatures. library LibSignature { /// @dev Allowed signature types. enum SignatureType { EIP712, // 0 PRESIGNED, // 1 EIP712_BULK,// 2 EIP712_1271,// 3 EIP712_BULK_1271, // 4 ETHEREUM_PERSONAL_SIGN_1271, // 5 ETHEREUM_PERSONAL_SIGN_BULK_1271,// 6 BITCOIN_PERSONAL_SIGN_1271, // 7 BITCOIN_PERSONAL_SIGN_BULK_1271, // 8 BITCOIN_PERSONAL_SIGN_173, // 9 BITCOIN_PERSONAL_SIGN_BULK_173 // 10 } /// @dev Encoded EC signature. struct Signature { // How to validate the signature. SignatureType signatureType; // EC Signature data. uint8 v; // EC Signature data. bytes32 r; // EC Signature data. bytes32 s; } bytes16 private constant HEX_DIGITS = "0123456789abcdef"; function bytes32ToHexBuffer(bytes32 data) internal pure returns(bytes memory buffer) { uint256 localValue = uint256(data); buffer = new bytes(66); buffer[0] = "0"; buffer[1] = "x"; unchecked { for (uint256 i = 65; i > 1; --i) { buffer[i] = HEX_DIGITS[localValue & 0xf]; localValue >>= 4; } } return buffer; } function toEthereumPersonalSignHash(bytes32 hash) internal pure returns(bytes32) { return keccak256( bytes.concat( "\x19Ethereum Signed Message:\n101Element.market listing/offer hash:\n", bytes32ToHexBuffer(hash) ) ); } function toBitcoinPersonalSignHash(bytes32 hash) internal pure returns(bytes32) { bytes32 tempHash = sha256( bytes.concat( "\x18Bitcoin Signed Message:\n\x65Element.market listing/offer hash:\n", bytes32ToHexBuffer(hash) ) ); // Convert bytes32 to bytes. bytes memory buffer = new bytes(32); assembly { mstore(add(buffer, 32), tempHash) } return sha256(buffer); } function isValidSignature1271( address aa, bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal view returns(bool) { bool isValid; assembly { if extcodesize(aa) { let ptr := mload(0x40) // free memory pointer // selector for `isValidSignature(bytes32,bytes)` mstore(ptr, 0x1626ba7e) mstore(add(ptr, 0x20), hash) mstore(add(ptr, 0x40), 0x40) mstore(add(ptr, 0x60), 0x41) mstore(add(ptr, 0x80), r) mstore(add(ptr, 0xa0), s) mstore(add(ptr, 0xc0), shl(248, v)) if staticcall(gas(), aa, add(ptr, 0x1c), 0xa5, ptr, 0x20) { if eq(mload(ptr), 0x1626ba7e00000000000000000000000000000000000000000000000000000000) { isValid := 1 } } } } return isValid; } uint256 constant private ADDRESS_LIMIT = 1 << 160; function isValidSignature173( address aa, bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal view returns(bool) { address owner; assembly { if extcodesize(aa) { let ptr := mload(0x40) // free memory pointer // selector for `owner()` mstore(ptr, 0x8da5cb5b) if staticcall(gas(), aa, add(ptr, 0x1c), 0x4, ptr, 0x20) { if lt(mload(ptr), ADDRESS_LIMIT) { owner := mload(ptr) } } } } return owner != address(0) && owner == ecrecover(hash, v, r, s); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; library LibStructure { uint256 constant ORDER_KIND_DUTCH_AUCTION = 1; uint256 constant ORDER_KIND_ENGLISH_AUCTION = 2; uint256 constant ORDER_KIND_BATCH_OFFER_ERC721S = 8; struct Fee { address recipient; uint256 amount; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; library LibTypeHash { //keccak256(abi.encodePacked( // "BulkOrder(", // "NFTSellOrder[2] tree" // ")", // "Fee(", // "address recipient,", // "uint256 amount,", // "bytes feeData", // ")", // "NFTSellOrder(", // "address maker,", // "address taker,", // "uint256 expiry,", // "uint256 nonce,", // "address erc20Token,", // "uint256 erc20TokenAmount,", // "Fee[] fees,", // "address nft,", // "uint256 nftId,", // "uint256 hashNonce", // ")" //)); bytes32 private constant _BULK_ERC721_SELL_ORDER_TYPE_HASH_H1 = 0xd34f03762ce1f357d7a826ecb4627841b188c269566aeb2a73e284d84cd78912; bytes32 private constant _BULK_ERC721_SELL_ORDER_TYPE_HASH_H2 = 0xbe8fa00d5b6a4c861c69d133d99ca46b741eb30c6909efbec15c237de29df561; bytes32 private constant _BULK_ERC721_SELL_ORDER_TYPE_HASH_H3 = 0xa4e6352852d88baa542528c5d7dd37687543ba5b2ee63f207a5e03fe4544415e; bytes32 private constant _BULK_ERC721_SELL_ORDER_TYPE_HASH_H4 = 0x65ba80d235ecf7aec7cb17b9ba7cae23869c6f5338039d07c01170985202f1fb; bytes32 private constant _BULK_ERC721_SELL_ORDER_TYPE_HASH_H5 = 0xb187dd134be01439b73639695a8858e0f1a24e73eb2b2a4cb0720b4dbda5ffd9; bytes32 private constant _BULK_ERC721_SELL_ORDER_TYPE_HASH_H6 = 0x698d310ab6eafea7429fc10c1541820159abd99d4f97b0ac55a280c6fa034862; bytes32 private constant _BULK_ERC721_SELL_ORDER_TYPE_HASH_H7 = 0x7d140482f96d81136b0473b9da1642229f2ace5516157987dd911fd86933752e; bytes32 private constant _BULK_ERC721_SELL_ORDER_TYPE_HASH_H8 = 0x43ddc7bd2b79f0fce3d28ffe218973cdfc75db4d262dc7e68e78c43ddb2139d5; bytes32 private constant _BULK_ERC721_SELL_ORDER_TYPE_HASH_H9 = 0xb2bb85f1bb297265004ee4385dfaa05cfc37266a01321161d983471d7e59d6f3; bytes32 private constant _BULK_ERC721_SELL_ORDER_TYPE_HASH_H10 = 0xa3796aeaba14ca1c62562b30874fa4418b6b722d3092259608f09eeba1df16e8; bytes32 private constant _BULK_ERC721_SELL_ORDER_TYPE_HASH_H11 = 0x3c9e717430c9ada5e01143f5e8a7c4a9285b0a8b818ae99cb471f764b6e432ea; bytes32 private constant _BULK_ERC721_SELL_ORDER_TYPE_HASH_H12 = 0x42a852d8385b94b31ae1f6c15cf66b195eafe58bf051f8a16c803876f55da687; bytes32 private constant _BULK_ERC721_SELL_ORDER_TYPE_HASH_H13 = 0xb793175426ec3a64dfc1ec27ca103f2368b0117fc08c4bbb1fa3b6ad133c2934; bytes32 private constant _BULK_ERC721_SELL_ORDER_TYPE_HASH_H14 = 0x4ccffbfa05cf55a8156a9a2d539974bc99a792b040f07f8bcb9da8a8c50496b1; bytes32 private constant _BULK_ERC721_SELL_ORDER_TYPE_HASH_H15 = 0xb19809e8a69fb92b9b3d5dcf8ed27878cebc770f6c81f317d4092f1d6ef38804; bytes32 private constant _BULK_ERC721_SELL_ORDER_TYPE_HASH_H16 = 0xa09a903f341da4dd111eff50adb9c12edb83525d28f67eca2891dddbdba73659; bytes32 private constant _BULK_ERC721_SELL_ORDER_TYPE_HASH_H17 = 0x9891e291bb672c5a78451aee982906c1cce43e4e5bc7397770c58fc4decd9039; bytes32 private constant _BULK_ERC721_SELL_ORDER_TYPE_HASH_H18 = 0xd7c0b9608ad661aa8a552e080abdbeb17b5d35a0c523f385f3b6575823940ef5; bytes32 private constant _BULK_ERC721_SELL_ORDER_TYPE_HASH_H19 = 0x8576b675cd395ceb837f22d2a7ecaa6de131eb69b16f017cee7c562896099bc0; bytes32 private constant _BULK_ERC721_SELL_ORDER_TYPE_HASH_H20 = 0x23b44e24d7f76cbaf701cc1e9f071db3bdb8a724bbcb88b18f8c5694b082dd9f; bytes32 private constant _BULK_ERC721_SELL_ORDER_TYPE_HASH_H21 = 0xc9ee72afde7c567fd7341fe62b02bca4ccf8705bcf6aac1e68ad25eed57fb755; bytes32 private constant _BULK_ERC721_SELL_ORDER_TYPE_HASH_H22 = 0xa3dd9c0bf81fb4bfb232fe287cf1f5ce8561446f2f2319231bc4db0b3a2441c8; bytes32 private constant _BULK_ERC721_SELL_ORDER_TYPE_HASH_H23 = 0x5309812ac587bdacbfd514f846f4bba837fe11edf3d82ec3338af8877192ffcd; bytes32 private constant _BULK_ERC721_SELL_ORDER_TYPE_HASH_H24 = 0x5379dceee9dc69ff1c99801b6c20a1933258d5e57119464510dff80bf19b529c; //keccak256(abi.encodePacked( // "BulkOrder(", // "NFTBuyOrder[2] tree" // ")", // "Fee(", // "address recipient,", // "uint256 amount,", // "bytes feeData", // ")", // "NFTBuyOrder(", // "address maker,", // "address taker,", // "uint256 expiry,", // "uint256 nonce,", // "address erc20Token,", // "uint256 erc20TokenAmount,", // "Fee[] fees,", // "address nft,", // "uint256 nftId,", // "Property[] nftProperties,", // "uint256 hashNonce", // ")", // "Property(", // "address propertyValidator,", // "bytes propertyData", // ")" //)); bytes32 private constant _BULK_ERC721_BUY_ORDER_TYPE_HASH_H1 = 0xb32e6b07ca7f956efdb96d28fed6462c6d478d4f66692a6773741b404ff85f74; bytes32 private constant _BULK_ERC721_BUY_ORDER_TYPE_HASH_H2 = 0x9f75ca91e1048cc22959b86e890a322468993b0042056da157f2b412c6448a67; bytes32 private constant _BULK_ERC721_BUY_ORDER_TYPE_HASH_H3 = 0x0b9237358bc0780db84404e8ac4354d9f65ad89d2f69ee36feef85323cc50e56; bytes32 private constant _BULK_ERC721_BUY_ORDER_TYPE_HASH_H4 = 0x1d7449e626c1883d0a685a1eda892c4ebbec2fee5314d96df22ec6075af7e6da; bytes32 private constant _BULK_ERC721_BUY_ORDER_TYPE_HASH_H5 = 0x3bd53d6120daeed6dfbe380dea0375dc8998073981bdb5b77d06c322e9f2d647; bytes32 private constant _BULK_ERC721_BUY_ORDER_TYPE_HASH_H6 = 0x5ee31cf4765667f4d0fb661820bbfe26e1583a3035f58a2fa02f1bba4e6fbd6c; bytes32 private constant _BULK_ERC721_BUY_ORDER_TYPE_HASH_H7 = 0xb608f4e4a9cd3cfd2c8cfccdad26888534996b0ae42be788464d9f617736ca9a; bytes32 private constant _BULK_ERC721_BUY_ORDER_TYPE_HASH_H8 = 0x46b6148f58b19871db49b6f83360c40fa5c1245310a5a68a58ebd575aa83ed13; bytes32 private constant _BULK_ERC721_BUY_ORDER_TYPE_HASH_H9 = 0xa8a9bda09e5a02cacb2dead999ab5f3a42c31378575a118d3610c7fcd0f5f589; bytes32 private constant _BULK_ERC721_BUY_ORDER_TYPE_HASH_H10 = 0x104d0c688b877378c48931b8ab8d4cd40b91a284864372a291f5f0781080320a; bytes32 private constant _BULK_ERC721_BUY_ORDER_TYPE_HASH_H11 = 0x566bb180c8b6c356458ac8ac2b1f94a344f13ad2cab2a0368fb5e0f63995271c; bytes32 private constant _BULK_ERC721_BUY_ORDER_TYPE_HASH_H12 = 0xea284288a7b9efcb7bfa8960c9fee47e83a928c769634a8ccd84de1f04ab5cca; bytes32 private constant _BULK_ERC721_BUY_ORDER_TYPE_HASH_H13 = 0x07f743265e8e61a1b890adf806926567cc011ebdfa491d5accc08a0c353056f2; bytes32 private constant _BULK_ERC721_BUY_ORDER_TYPE_HASH_H14 = 0x3cb41bc57327bfc80e77688d75fd37ae8d661f2d347e724e8f5e417022f9796f; bytes32 private constant _BULK_ERC721_BUY_ORDER_TYPE_HASH_H15 = 0xc79245b07759ae6288019cddb41b3cf90ca8ee2f5c8339d99b111efc6544a867; bytes32 private constant _BULK_ERC721_BUY_ORDER_TYPE_HASH_H16 = 0xacd68817a805cfc3b06f56b3bbb5fcbdf8e945abd065de4c81c580533f7a600a; bytes32 private constant _BULK_ERC721_BUY_ORDER_TYPE_HASH_H17 = 0xd57701e882860956e3f7872db1e179d6b8fc8e13a5398bb6af893a5e42e77839; bytes32 private constant _BULK_ERC721_BUY_ORDER_TYPE_HASH_H18 = 0x2f3ed58d4e1d0a4c76f70032ee82f302118bfbadf3b0c39721868115a2bb020b; bytes32 private constant _BULK_ERC721_BUY_ORDER_TYPE_HASH_H19 = 0x185fae4db124d03654cdc4beefd2f59ae93e9cc2f04eda3d86eefc6ad69fb653; bytes32 private constant _BULK_ERC721_BUY_ORDER_TYPE_HASH_H20 = 0x8284117e9b7752fa6a09985a8ad343a0f36e4399dc23841b852b06f61c494944; bytes32 private constant _BULK_ERC721_BUY_ORDER_TYPE_HASH_H21 = 0x4645af7b9f125b178e9090156cc187c311456985f773afde066dad652981a8db; bytes32 private constant _BULK_ERC721_BUY_ORDER_TYPE_HASH_H22 = 0x15c4e80ebf08449122359b63924db2ae4aefad40b75bef4b6a4325cf2f72ce9c; bytes32 private constant _BULK_ERC721_BUY_ORDER_TYPE_HASH_H23 = 0xa18f3d5fd85a19d6b8db5ebd2d5e31db3fb730b2d30a046b473c0137a2fc8056; bytes32 private constant _BULK_ERC721_BUY_ORDER_TYPE_HASH_H24 = 0x637175f391c9fa3e7d2456fc5f4d663cb628d453586604ba35d7a0f2d89f958b; //keccak256(abi.encodePacked( // "BulkOrder(", // "ERC1155BuyOrder[2] tree", // ")", // "ERC1155BuyOrder(", // "address maker,", // "address taker,", // "uint256 expiry,", // "uint256 nonce,", // "address erc20Token,", // "uint256 erc20TokenAmount,", // "Fee[] fees,", // "address erc1155Token,", // "uint256 erc1155TokenId,", // "Property[] erc1155TokenProperties,", // "uint128 erc1155TokenAmount,", // "uint256 hashNonce", // ")", // "Fee(", // "address recipient,", // "uint256 amount,", // "bytes feeData", // ")", // "Property(", // "address propertyValidator,", // "bytes propertyData", // ")" //)); bytes32 private constant _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H1 = 0x06ebd50d9a0478e933167ddd59b33aad59b9601007b8ab0644d5317274fa477c; bytes32 private constant _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H2 = 0x4332f3188d5bb5242a3a339824172cfb862da9a98bdf15d2f3848f8783766dd5; bytes32 private constant _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H3 = 0x87b864a12bd96bac99659ad9646f04c0f6c39acb3483c86a40a47827ef897335; bytes32 private constant _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H4 = 0x42515109fd2a179614d2a474ec133d28e5bce67542bbef6a1b1fb62b25da339f; bytes32 private constant _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H5 = 0xaa709ab5849d659b0353cb57d3c90683b42e2b8e62557bb8e223575b36a29193; bytes32 private constant _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H6 = 0x93111c998b9ec794d3f7f9f78520127bdb0c6bda5828c2d7635acd22950e6a37; bytes32 private constant _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H7 = 0xb3ca47945f9f0e15d66c40ea7e058f536b2786ad1dd0092e38b818c9c103ddf4; bytes32 private constant _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H8 = 0x56dacd6541283724269fe4e1e594041051c468721515df149e93087f9f08d366; bytes32 private constant _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H9 = 0x00eb4936508848784f84148e6991b8871b33b7294b5244fba02750707efb3b59; bytes32 private constant _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H10 = 0x1714ec693e1151b0d729959f2cea29a73169e92f732ea954aa1b34a268bc0a87; bytes32 private constant _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H11 = 0x65114dd56a2f51a81c23d9e3a188eb19f23fbd857cf8b82b07628097cb996c0f; bytes32 private constant _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H12 = 0x12ea41af8949c9b9a1ff2f736c9f66f9f73d951d3fcc82fbc259bcd209b44cc8; bytes32 private constant _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H13 = 0x4f9a50789d3b21f7488444c8cd2127cd053f392bf178b58c30ec77626b771b2c; bytes32 private constant _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H14 = 0xd123519b5ba947f405714106adf05c84cf33d1f4fabdf6b8b0d39bc019cbfdc3; bytes32 private constant _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H15 = 0xbda87bfa1b02253d1a998f3573de8dcba18f231b599dc8d2274ad5704cb1d38c; bytes32 private constant _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H16 = 0xcd80c0f13a214422a206fabdaa05d589907caba334846313f26a8d232877a5f4; bytes32 private constant _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H17 = 0xb1a57f9ea04d4ce6d097926804b8a8093ae1a2f8f548cc514ae40770c871de7e; bytes32 private constant _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H18 = 0x6d7c4ff60fce4c988ada572ff5447cfd4115329b5d98772281a5e8384e9d113d; bytes32 private constant _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H19 = 0x5f36116fda20ab7b32eb8caf91980ccefa90ef7a3f0bbfe050288fb8d003e84d; bytes32 private constant _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H20 = 0xfae6e9c50581dae3168b4d985e5d97e7e2c9230247637dc61b2259d889a0d383; bytes32 private constant _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H21 = 0x6dcc44cb1bc3ba7c371b85bdedc36c93946f2b76443e1162f193c3f6f6921ba5; bytes32 private constant _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H22 = 0x3175465e5d744b6896e381eda137c21e735b1d28df7df35b8c99b1d1313b2221; bytes32 private constant _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H23 = 0xdbd25fdd09ccad35a5d6f9f4b983752a7db2bcc81d60b7a5042abb6a557b5ec0; bytes32 private constant _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H24 = 0x951ea5e5cd28bc4be27643958417c4d76f998d804c5dd114174e944d60ea7d80; //keccak256(abi.encodePacked( // "BulkOrder(", // "ERC1155SellOrder[2] tree", // ")", // "ERC1155SellOrder(", // "address maker,", // "address taker,", // "uint256 expiry,", // "uint256 nonce,", // "address erc20Token,", // "uint256 erc20TokenAmount,", // "Fee[] fees,", // "address erc1155Token,", // "uint256 erc1155TokenId,", // "uint128 erc1155TokenAmount,", // "uint256 hashNonce", // ")", // "Fee(", // "address recipient,", // "uint256 amount,", // "bytes feeData", // ")" //)); bytes32 private constant _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H1 = 0x98ecfe335964f1c75a9fbc1ac09d96f38f4b76ef34bc91e020753da9f53842db; bytes32 private constant _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H2 = 0x68140a04e66c153b96cc3550581d3c4d4fe676083a450663d2cb6cb8fc6049e3; bytes32 private constant _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H3 = 0xcc351e5ce3ce59e09411444fb47a0ed5c81d167385f80329025fa9847f3809bd; bytes32 private constant _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H4 = 0x7d835ba6b53caf45cff44b32c90a2f43c9641194bce2af0e8f6ab5fd51603e80; bytes32 private constant _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H5 = 0x4b27d7de68e63c133276559cc95ce5b9f2418c437ab2e4b7e4ce02cfe7ca8cc5; bytes32 private constant _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H6 = 0x0c46e3bf3dbac98caa1e79b1cb24de788a81830a6e30810409723ba7e1a1820a; bytes32 private constant _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H7 = 0x041ffd89cad44d5f041ae3166443fdd24ec1f890e7f64cd642185de4363da859; bytes32 private constant _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H8 = 0xfd925040fdc34d1b50bcef1115dae86e54fa5b1c6e89a659238bfa74b2395eb1; bytes32 private constant _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H9 = 0x4b6378efc359f95cbfe7c37a7fca3cd34f57dcb7ce1f721c964d089531977885; bytes32 private constant _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H10 = 0xa4a65c47d8a899d136c581a5c57ec4fb5b4329042754936f70d4fff7af51837b; bytes32 private constant _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H11 = 0xfc5ae170f6e44d4ad79f7d94f322bf4fd9fc0b41d0bb0fb1fb2b6dfd563dd964; bytes32 private constant _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H12 = 0x3fb3022fda65abb26316b0c72c3d2f962c800868753a27beabace6efcdd8334a; bytes32 private constant _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H13 = 0xde54bd845f838a6c5599548857be4589d75ba88d68e82bcf8d89962bacc4f6cf; bytes32 private constant _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H14 = 0x52308297d15ed521cafe62c0945ff9af8a62b888debc2b879e6f9cc3896e592d; bytes32 private constant _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H15 = 0x8fee599ac99cbbf0795116166352544be9516045cce3643818ae72e1d1ad24bb; bytes32 private constant _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H16 = 0x051605fd459d5d59ab7873250cb2b004789a911b52e0f55ad32195d0bc4f5b62; bytes32 private constant _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H17 = 0x1d29a58d82356bdf924acc53b9f890ac7efa738fd59cb3f16b70e86aa5e0a25a; bytes32 private constant _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H18 = 0x1963a1fcdd9b3fc88a6cc3bd53127ee988baaa8ea0a7fabf325d11a60344f9f8; bytes32 private constant _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H19 = 0x675063352969ab8c1c71721e93dcb69bd3de91fdf9748e02e8a1212810f2ada7; bytes32 private constant _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H20 = 0x7650bef40c048ceb24dc5711910f6632f103ebc4a5e9a6c4741e8b7dd7f75a84; bytes32 private constant _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H21 = 0x222f8eab7ad36e71989d876c302c6a33fd83b7436e350388bd52462f898742c4; bytes32 private constant _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H22 = 0x897b52e5b5e2f870b8c69ff86065cd777f10944c933bd37faff29c35f77c5908; bytes32 private constant _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H23 = 0xa28cb7f810ce8e8a9d81a9d48764417ec6b03b271d5074210c56c1e2f1f8e084; bytes32 private constant _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H24 = 0xeb15c282d3dd0d3bb6bc268a4d8b652628a8e1ec03a1019d0ec66f15511c6817; function getBulkERC721SellOrderTypeHash(uint256 height) internal pure returns (bytes32) { if (height < 7) { if (height == 2) { return _BULK_ERC721_SELL_ORDER_TYPE_HASH_H2; } if (height == 3) { return _BULK_ERC721_SELL_ORDER_TYPE_HASH_H3; } if (height == 4) { return _BULK_ERC721_SELL_ORDER_TYPE_HASH_H4; } if (height == 5) { return _BULK_ERC721_SELL_ORDER_TYPE_HASH_H5; } if (height == 1) { return _BULK_ERC721_SELL_ORDER_TYPE_HASH_H1; } if (height == 6) { return _BULK_ERC721_SELL_ORDER_TYPE_HASH_H6; } } if (height < 13) { if (height == 7) { return _BULK_ERC721_SELL_ORDER_TYPE_HASH_H7; } if (height == 8) { return _BULK_ERC721_SELL_ORDER_TYPE_HASH_H8; } if (height == 9) { return _BULK_ERC721_SELL_ORDER_TYPE_HASH_H9; } if (height == 10) { return _BULK_ERC721_SELL_ORDER_TYPE_HASH_H10; } if (height == 11) { return _BULK_ERC721_SELL_ORDER_TYPE_HASH_H11; } if (height == 12) { return _BULK_ERC721_SELL_ORDER_TYPE_HASH_H12; } } if (height < 19) { if (height == 13) { return _BULK_ERC721_SELL_ORDER_TYPE_HASH_H13; } if (height == 14) { return _BULK_ERC721_SELL_ORDER_TYPE_HASH_H14; } if (height == 15) { return _BULK_ERC721_SELL_ORDER_TYPE_HASH_H15; } if (height == 16) { return _BULK_ERC721_SELL_ORDER_TYPE_HASH_H16; } if (height == 17) { return _BULK_ERC721_SELL_ORDER_TYPE_HASH_H17; } if (height == 18) { return _BULK_ERC721_SELL_ORDER_TYPE_HASH_H18; } } if (height == 19) { return _BULK_ERC721_SELL_ORDER_TYPE_HASH_H19; } if (height == 20) { return _BULK_ERC721_SELL_ORDER_TYPE_HASH_H20; } if (height == 21) { return _BULK_ERC721_SELL_ORDER_TYPE_HASH_H21; } if (height == 22) { return _BULK_ERC721_SELL_ORDER_TYPE_HASH_H22; } if (height == 23) { return _BULK_ERC721_SELL_ORDER_TYPE_HASH_H23; } if (height == 24) { return _BULK_ERC721_SELL_ORDER_TYPE_HASH_H24; } revert("getBulkERC721SellOrderTypeHash error"); } function getBulkERC721BuyOrderTypeHash(uint256 height) internal pure returns (bytes32) { if (height < 7) { if (height == 2) { return _BULK_ERC721_BUY_ORDER_TYPE_HASH_H2; } if (height == 3) { return _BULK_ERC721_BUY_ORDER_TYPE_HASH_H3; } if (height == 4) { return _BULK_ERC721_BUY_ORDER_TYPE_HASH_H4; } if (height == 5) { return _BULK_ERC721_BUY_ORDER_TYPE_HASH_H5; } if (height == 1) { return _BULK_ERC721_BUY_ORDER_TYPE_HASH_H1; } if (height == 6) { return _BULK_ERC721_BUY_ORDER_TYPE_HASH_H6; } } if (height < 13) { if (height == 7) { return _BULK_ERC721_BUY_ORDER_TYPE_HASH_H7; } if (height == 8) { return _BULK_ERC721_BUY_ORDER_TYPE_HASH_H8; } if (height == 9) { return _BULK_ERC721_BUY_ORDER_TYPE_HASH_H9; } if (height == 10) { return _BULK_ERC721_BUY_ORDER_TYPE_HASH_H10; } if (height == 11) { return _BULK_ERC721_BUY_ORDER_TYPE_HASH_H11; } if (height == 12) { return _BULK_ERC721_BUY_ORDER_TYPE_HASH_H12; } } if (height < 19) { if (height == 13) { return _BULK_ERC721_BUY_ORDER_TYPE_HASH_H13; } if (height == 14) { return _BULK_ERC721_BUY_ORDER_TYPE_HASH_H14; } if (height == 15) { return _BULK_ERC721_BUY_ORDER_TYPE_HASH_H15; } if (height == 16) { return _BULK_ERC721_BUY_ORDER_TYPE_HASH_H16; } if (height == 17) { return _BULK_ERC721_BUY_ORDER_TYPE_HASH_H17; } if (height == 18) { return _BULK_ERC721_BUY_ORDER_TYPE_HASH_H18; } } if (height == 19) { return _BULK_ERC721_BUY_ORDER_TYPE_HASH_H19; } if (height == 20) { return _BULK_ERC721_BUY_ORDER_TYPE_HASH_H20; } if (height == 21) { return _BULK_ERC721_BUY_ORDER_TYPE_HASH_H21; } if (height == 22) { return _BULK_ERC721_BUY_ORDER_TYPE_HASH_H22; } if (height == 23) { return _BULK_ERC721_BUY_ORDER_TYPE_HASH_H23; } if (height == 24) { return _BULK_ERC721_BUY_ORDER_TYPE_HASH_H24; } revert("getBulkERC721BuyOrderTypeHash error"); } function getBulkERC1155SellOrderTypeHash(uint256 height) internal pure returns (bytes32) { if (height < 7) { if (height == 2) { return _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H2; } if (height == 3) { return _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H3; } if (height == 4) { return _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H4; } if (height == 5) { return _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H5; } if (height == 1) { return _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H1; } if (height == 6) { return _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H6; } } if (height < 13) { if (height == 7) { return _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H7; } if (height == 8) { return _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H8; } if (height == 9) { return _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H9; } if (height == 10) { return _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H10; } if (height == 11) { return _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H11; } if (height == 12) { return _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H12; } } if (height < 19) { if (height == 13) { return _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H13; } if (height == 14) { return _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H14; } if (height == 15) { return _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H15; } if (height == 16) { return _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H16; } if (height == 17) { return _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H17; } if (height == 18) { return _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H18; } } if (height == 19) { return _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H19; } if (height == 20) { return _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H20; } if (height == 21) { return _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H21; } if (height == 22) { return _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H22; } if (height == 23) { return _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H23; } if (height == 24) { return _BULK_ERC1155_SELL_ORDER_TYPE_HASH_H24; } revert("getBulkERC1155SellOrderTypeHash error"); } function getBulkERC1155BuyOrderTypeHash(uint256 height) internal pure returns (bytes32) { if (height < 7) { if (height == 2) { return _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H2; } if (height == 3) { return _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H3; } if (height == 4) { return _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H4; } if (height == 5) { return _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H5; } if (height == 1) { return _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H1; } if (height == 6) { return _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H6; } } if (height < 13) { if (height == 7) { return _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H7; } if (height == 8) { return _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H8; } if (height == 9) { return _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H9; } if (height == 10) { return _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H10; } if (height == 11) { return _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H11; } if (height == 12) { return _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H12; } } if (height < 19) { if (height == 13) { return _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H13; } if (height == 14) { return _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H14; } if (height == 15) { return _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H15; } if (height == 16) { return _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H16; } if (height == 17) { return _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H17; } if (height == 18) { return _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H18; } } if (height == 19) { return _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H19; } if (height == 20) { return _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H20; } if (height == 21) { return _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H21; } if (height == 22) { return _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H22; } if (height == 23) { return _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H23; } if (height == 24) { return _BULK_ERC1155_BUY_ORDER_TYPE_HASH_H24; } revert("getBulkERC1155BuyOrderTypeHash error"); } }
// SPDX-License-Identifier: Apache-2.0 /* Modifications Copyright 2022 Element.Market Copyright 2021 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.8.17; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../../fixins/FixinEIP712.sol"; import "../../fixins/FixinTokenSpender.sol"; import "../../vendor/IEtherToken.sol"; import "../../vendor/IPropertyValidator.sol"; import "../../vendor/IFeeRecipient.sol"; import "../../storage/LibCommonNftOrdersStorage.sol"; import "../libs/LibSignature.sol"; import "../libs/LibNFTOrder.sol"; import "../libs/LibStructure.sol"; import "../libs/LibOracleSignature.sol"; /// @dev Abstract base contract inherited by ERC721OrdersFeature and NFTOrders abstract contract NFTOrders is FixinEIP712, FixinTokenSpender { using LibNFTOrder for LibNFTOrder.NFTBuyOrder; /// @dev Native token pseudo-address. address constant internal NATIVE_TOKEN_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; /// @dev The WETH token contract. IEtherToken internal immutable WETH; /// @dev The implementation address of this feature. address internal immutable _implementation; /// @dev The magic return value indicating the success of a `validateProperty`. bytes4 private constant PROPERTY_CALLBACK_MAGIC_BYTES = IPropertyValidator.validateProperty.selector; /// @dev The magic return value indicating the success of a `receiveZeroExFeeCallback`. bytes4 private constant FEE_CALLBACK_MAGIC_BYTES = IFeeRecipient.receiveZeroExFeeCallback.selector; constructor(IEtherToken weth) { require(address(weth) != address(0), "WETH_ADDRESS_ERROR"); WETH = weth; // Remember this feature's original address. _implementation = address(this); } struct SellParams { uint128 sellAmount; uint256 tokenId; bool unwrapNativeToken; address taker; address currentNftOwner; bytes takerData; } // Core settlement logic for selling an NFT asset. function _sellNFT( LibNFTOrder.NFTBuyOrder memory buyOrder, LibSignature.Signature memory signature, LibNFTOrder.OrderInfoV2 memory orderInfo, SellParams memory params ) internal returns (uint256 erc20FillAmount) { // Check that the order can be filled. _validateBuyOrder(buyOrder, signature, orderInfo, params.taker, params.tokenId, params.sellAmount, params.takerData); // Calculate erc20 pay amount. erc20FillAmount = (params.sellAmount == orderInfo.orderAmount) ? buyOrder.erc20TokenAmount : buyOrder.erc20TokenAmount * params.sellAmount / orderInfo.orderAmount; if (params.unwrapNativeToken && buyOrder.erc20Token == WETH) { // Transfer the WETH from the maker to the Exchange Proxy // so we can unwrap it before sending it to the seller. _transferERC20TokensFrom(address(WETH), buyOrder.maker, address(this), erc20FillAmount); // Unwrap WETH into ETH. WETH.withdraw(erc20FillAmount); // Send ETH to the seller. _transferEth(payable(params.taker), erc20FillAmount); } else { // Transfer the ERC20 token from the buyer to the seller. _transferERC20TokensFrom(address(buyOrder.erc20Token), buyOrder.maker, params.taker, erc20FillAmount); } // Transfer the NFT asset to the buyer. // If this function is called from the // `onNFTReceived` callback the Exchange Proxy // holds the asset. Otherwise, transfer it from // the seller. _transferNFTAssetFrom(buyOrder.nft, params.currentNftOwner, buyOrder.maker, params.tokenId, params.sellAmount); // The buyer pays the order fees. _payFees(buyOrder.asNFTSellOrder(), buyOrder.maker, params.sellAmount, orderInfo.orderAmount, false); } // Core settlement logic for buying an NFT asset. function _buyNFT( LibNFTOrder.NFTSellOrder memory sellOrder, LibSignature.Signature memory signature, LibNFTOrder.OrderInfoV2 memory orderInfo, uint128 buyAmount, address taker, bytes memory takerData ) internal returns (uint256 erc20FillAmount) { // Check that the order can be filled. _validateSellOrder(sellOrder, signature, orderInfo, taker, buyAmount, takerData); // Calculate erc20 pay amount. erc20FillAmount = (buyAmount == orderInfo.orderAmount) ? sellOrder.erc20TokenAmount : _ceilDiv(sellOrder.erc20TokenAmount * buyAmount, orderInfo.orderAmount); // Transfer the NFT asset to the buyer. _transferNFTAssetFrom(sellOrder.nft, sellOrder.maker, taker, sellOrder.nftId, buyAmount); if (address(sellOrder.erc20Token) == NATIVE_TOKEN_ADDRESS) { // Transfer ETH to the seller. _transferEth(payable(sellOrder.maker), erc20FillAmount); // Fees are paid from the EP's current balance of ETH. _payFees(sellOrder, address(this), buyAmount, orderInfo.orderAmount, true); } else { // Transfer ERC20 token from the buyer to the seller. _transferERC20TokensFrom(address(sellOrder.erc20Token), msg.sender, sellOrder.maker, erc20FillAmount); // The buyer pays fees. _payFees(sellOrder, msg.sender, buyAmount, orderInfo.orderAmount, false); } } function _validateSellOrder( LibNFTOrder.NFTSellOrder memory sellOrder, LibSignature.Signature memory signature, LibNFTOrder.OrderInfoV2 memory orderInfo, address taker, uint128 buyAmount, bytes memory takerData ) internal { // Taker must match the order taker, if one is specified. require(sellOrder.taker == address(0) || sellOrder.taker == taker, "_validateOrder/ONLY_TAKER"); // Check that the order is valid and has not expired, been cancelled, // or been filled. require(orderInfo.status == LibNFTOrder.OrderStatus.FILLABLE, "_validateOrder/ORDER_NOT_FILL"); // Check amount. require(buyAmount <= orderInfo.remainingAmount, "_validateOrder/EXCEEDS_REMAINING_AMOUNT"); // Update the order state. _updateOrderState(sellOrder, orderInfo.orderHash, buyAmount); // Validate the oracle signature if needed. if (LibOracleSignature.isNeedValidateOracleSignature(sellOrder.expiry)) { takerData = LibOracleSignature.validateOracleSignature(orderInfo.orderHash, taker, takerData); } // Check the signature. if ( signature.signatureType == LibSignature.SignatureType.EIP712_BULK || signature.signatureType == LibSignature.SignatureType.EIP712_BULK_1271 || signature.signatureType == LibSignature.SignatureType.ETHEREUM_PERSONAL_SIGN_BULK_1271 || signature.signatureType == LibSignature.SignatureType.BITCOIN_PERSONAL_SIGN_BULK_1271 || signature.signatureType == LibSignature.SignatureType.BITCOIN_PERSONAL_SIGN_BULK_173 ) { (bytes32 validateHash, ) = _getBulkValidateHashAndExtraData(false, orderInfo.structHash, takerData); _validateOrderSignature(validateHash, signature, sellOrder.maker); } else { _validateOrderSignature(orderInfo.orderHash, signature, sellOrder.maker); } } function _validateBuyOrder( LibNFTOrder.NFTBuyOrder memory buyOrder, LibSignature.Signature memory signature, LibNFTOrder.OrderInfoV2 memory orderInfo, address taker, uint256 tokenId, uint128 sellAmount, bytes memory takerData ) internal { // The ERC20 token cannot be ETH. require(address(buyOrder.erc20Token) != NATIVE_TOKEN_ADDRESS, "_validateOrder/TOKEN_MISMATCH"); // Taker must match the order taker, if one is specified. require(buyOrder.taker == address(0) || buyOrder.taker == taker, "_validateOrder/ONLY_TAKER"); // Check that the order is valid and has not expired, been cancelled, // or been filled. require(orderInfo.status == LibNFTOrder.OrderStatus.FILLABLE, "_validateOrder/ORDER_NOT_FILL"); // Check amount. require(sellAmount <= orderInfo.remainingAmount, "_validateOrder/EXCEEDS_REMAINING_AMOUNT"); // Update the order state. _updateOrderState(buyOrder, orderInfo.orderHash, sellAmount); // Validate the oracle signature if needed. if (LibOracleSignature.isNeedValidateOracleSignature(buyOrder.expiry)) { takerData = LibOracleSignature.validateOracleSignature(orderInfo.orderHash, taker, takerData); } if ( signature.signatureType == LibSignature.SignatureType.EIP712_BULK || signature.signatureType == LibSignature.SignatureType.EIP712_BULK_1271 || signature.signatureType == LibSignature.SignatureType.ETHEREUM_PERSONAL_SIGN_BULK_1271 || signature.signatureType == LibSignature.SignatureType.BITCOIN_PERSONAL_SIGN_BULK_1271 || signature.signatureType == LibSignature.SignatureType.BITCOIN_PERSONAL_SIGN_BULK_173 ) { (bytes32 validateHash, bytes memory extraData) = _getBulkValidateHashAndExtraData(true, orderInfo.structHash, takerData); // Validate properties. _validateOrderProperties(buyOrder, orderInfo.orderHash, tokenId, extraData); // Check the signature. _validateOrderSignature(validateHash, signature, buyOrder.maker); } else { // Validate properties. _validateOrderProperties(buyOrder, orderInfo.orderHash, tokenId, takerData); // Check the signature. _validateOrderSignature(orderInfo.orderHash, signature, buyOrder.maker); } } function _resetEnglishAuctionERC20AmountAndFees( LibNFTOrder.NFTSellOrder memory sellOrder, uint256 buyERC20Amount, uint256 fillAmount, uint256 orderAmount ) internal pure { uint256 sellOrderFees = _calcTotalFeesPaid(sellOrder.fees, fillAmount, orderAmount); uint256 sellTotalAmount = sellOrderFees + sellOrder.erc20TokenAmount; if (buyERC20Amount != sellTotalAmount) { uint256 spread = buyERC20Amount - sellTotalAmount; uint256 sum; // Reset fees if (sellTotalAmount > 0) { for (uint256 i = 0; i < sellOrder.fees.length; i++) { uint256 diff = spread * sellOrder.fees[i].amount / sellTotalAmount; sellOrder.fees[i].amount += diff; sum += diff; } } // Reset erc20TokenAmount sellOrder.erc20TokenAmount += spread - sum; } } function _ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // ceil(a / b) = floor((a + b - 1) / b) return (a + b - 1) / b; } function _calcTotalFeesPaid(LibNFTOrder.Fee[] memory fees, uint256 fillAmount, uint256 orderAmount) private pure returns (uint256 totalFeesPaid) { if (fillAmount == orderAmount) { for (uint256 i = 0; i < fees.length; i++) { totalFeesPaid += fees[i].amount; } } else { for (uint256 i = 0; i < fees.length; i++) { totalFeesPaid += fees[i].amount * fillAmount / orderAmount; } } return totalFeesPaid; } function _payFees( LibNFTOrder.NFTSellOrder memory order, address payer, uint128 fillAmount, uint128 orderAmount, bool useNativeToken ) internal returns (uint256 totalFeesPaid) { for (uint256 i; i < order.fees.length; ) { LibNFTOrder.Fee memory fee = order.fees[i]; uint256 feeFillAmount = (fillAmount == orderAmount) ? fee.amount : fee.amount * fillAmount / orderAmount; if (useNativeToken) { // Transfer ETH to the fee recipient. _transferEth(payable(fee.recipient), feeFillAmount); } else { if (feeFillAmount > 0) { // Transfer ERC20 token from payer to recipient. _transferERC20TokensFrom(address(order.erc20Token), payer, fee.recipient, feeFillAmount); } } // Note that the fee callback is _not_ called if zero // `feeData` is provided. If `feeData` is provided, we assume // the fee recipient is a contract that implements the // `IFeeRecipient` interface. if (fee.feeData.length > 0) { require(fee.recipient.code.length != 0, "_payFees/INVALID_FEE_RECIPIENT"); // Invoke the callback bytes4 callbackResult = IFeeRecipient(fee.recipient).receiveZeroExFeeCallback( useNativeToken ? NATIVE_TOKEN_ADDRESS : address(order.erc20Token), feeFillAmount, fee.feeData ); // Check for the magic success bytes require(callbackResult == FEE_CALLBACK_MAGIC_BYTES, "_payFees/CALLBACK_FAILED"); } // Sum the fees paid totalFeesPaid += feeFillAmount; unchecked { i++; } } return totalFeesPaid; } function _validateOrderProperties( LibNFTOrder.NFTBuyOrder memory order, bytes32 orderHash, uint256 tokenId, bytes memory data ) internal view { // If no properties are specified, check that the given // `tokenId` matches the one specified in the order. if (order.nftProperties.length == 0) { require(tokenId == order.nftId, "_validateProperties/TOKEN_ID_ERR"); } else { // Validate each property for (uint256 i; i < order.nftProperties.length; ) { LibNFTOrder.Property memory property = order.nftProperties[i]; // `address(0)` is interpreted as a no-op. Any token ID // will satisfy a property with `propertyValidator == address(0)`. if (address(property.propertyValidator) != address(0)) { require(address(property.propertyValidator).code.length != 0, "INVALID_PROPERTY_VALIDATOR"); // Call the property validator and throw a descriptive error // if the call reverts. bytes4 result = property.propertyValidator.validateProperty( order.nft, tokenId, orderHash, property.propertyData, data ); // Check for the magic success bytes require(result == PROPERTY_CALLBACK_MAGIC_BYTES, "PROPERTY_VALIDATION_FAILED"); } unchecked { i++; } } } } function _getBulkValidateHashAndExtraData( bool isBuyOrder, bytes32 leaf, bytes memory takerData ) internal view returns( bytes32 validateHash, bytes memory data ) { uint256 proofsLength; bytes32 root = leaf; assembly { // takerData = 32bytes[length] + 32bytes[head] + [proofsData] + [data] let ptrHead := add(takerData, 0x20) // head = 4bytes[dataLength] + 1bytes[proofsLength] + 24bytes[unused] + 3bytes[proofsKey] let head := mload(ptrHead) let dataLength := shr(224, head) proofsLength := byte(4, head) let proofsKey := and(head, 0xffffff) // require(proofsLength != 0) if iszero(proofsLength) { _revertTakerDataError() } // require(32 + proofsLength * 32 + dataLength == takerData.length) if iszero(eq(add(0x20, add(shl(5, proofsLength), dataLength)), mload(takerData))) { _revertTakerDataError() } // Compute remaining proofs. let ptrAfterHead := add(ptrHead, 0x20) let ptrProofNode := ptrAfterHead for { let i } lt(i, proofsLength) { i := add(i, 1) } { // Check if the current bit of the key is set. switch and(shr(i, proofsKey), 0x1) case 0 { mstore(ptrHead, root) mstore(ptrAfterHead, mload(ptrProofNode)) } case 1 { mstore(ptrHead, mload(ptrProofNode)) mstore(ptrAfterHead, root) } root := keccak256(ptrHead, 0x40) ptrProofNode := add(ptrProofNode, 0x20) } data := sub(ptrProofNode, 0x20) mstore(data, dataLength) function _revertTakerDataError() { // revert("TakerData error") mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000) mstore(0x20, 0x0000002000000000000000000000000000000000000000000000000000000000) mstore(0x40, 0x0000000f54616b657244617461206572726f7200000000000000000000000000) mstore(0x60, 0) revert(0, 0x64) } } if (isBuyOrder) { validateHash = _getEIP712Hash( keccak256(abi.encode(_getBulkBuyOrderTypeHash(proofsLength), root)) ); } else { validateHash = _getEIP712Hash( keccak256(abi.encode(_getBulkSellOrderTypeHash(proofsLength), root)) ); } return (validateHash, data); } function _isOrderPreSigned(bytes32 orderHash, address maker) internal virtual view returns(bool); function _validateOrderSignature( bytes32 hash, LibSignature.Signature memory signature, address maker ) internal view { if ( signature.signatureType == LibSignature.SignatureType.EIP712 || signature.signatureType == LibSignature.SignatureType.EIP712_BULK ) { require(maker != address(0), "INVALID_SIGNER"); require(maker == ecrecover(hash, signature.v, signature.r, signature.s), "INVALID_SIGNATURE"); } else if ( signature.signatureType == LibSignature.SignatureType.EIP712_1271 || signature.signatureType == LibSignature.SignatureType.EIP712_BULK_1271 ) { require( LibSignature.isValidSignature1271(maker, hash, signature.v, signature.r, signature.s), "INVALID_SIGNATURE" ); } else if ( signature.signatureType == LibSignature.SignatureType.ETHEREUM_PERSONAL_SIGN_1271 || signature.signatureType == LibSignature.SignatureType.ETHEREUM_PERSONAL_SIGN_BULK_1271 ) { require(LibCommonNftOrdersStorage.isEnableEthereumPersonalSign(), "EthereumPersonalSign is disabled"); bytes32 validateHash = LibSignature.toEthereumPersonalSignHash(hash); require( LibSignature.isValidSignature1271(maker, validateHash, signature.v, signature.r, signature.s), "INVALID_SIGNATURE" ); }else if ( signature.signatureType == LibSignature.SignatureType.BITCOIN_PERSONAL_SIGN_1271 || signature.signatureType == LibSignature.SignatureType.BITCOIN_PERSONAL_SIGN_BULK_1271 ) { require(LibCommonNftOrdersStorage.isEnableBitcoinPersonalSign(), "BitcoinPersonalSign is disabled"); bytes32 validateHash = LibSignature.toBitcoinPersonalSignHash(hash); require( LibSignature.isValidSignature1271(maker, validateHash, signature.v, signature.r, signature.s), "INVALID_SIGNATURE" ); } else if ( signature.signatureType == LibSignature.SignatureType.BITCOIN_PERSONAL_SIGN_173 || signature.signatureType == LibSignature.SignatureType.BITCOIN_PERSONAL_SIGN_BULK_173 ) { require(LibCommonNftOrdersStorage.isEnableBitcoinPersonalSign173(), "BitcoinPersonalSign173 is disabled"); bytes32 validateHash = LibSignature.toBitcoinPersonalSignHash(hash); require( LibSignature.isValidSignature173(maker, validateHash, signature.v, signature.r, signature.s), "INVALID_SIGNATURE" ); } else if (signature.signatureType == LibSignature.SignatureType.PRESIGNED) { require(maker != address(0), "INVALID_SIGNER"); require(_isOrderPreSigned(hash, maker), "PRESIGNED_INVALID_SIGNER"); } else { revert("INVALID_SIGNATURE_TYPE"); } } /// @dev Transfers an NFT asset. /// @param token The address of the NFT contract. /// @param from The address currently holding the asset. /// @param to The address to transfer the asset to. /// @param tokenId The ID of the asset to transfer. /// @param amount The amount of the asset to transfer. Always /// 1 for ERC721 assets. function _transferNFTAssetFrom(address token, address from, address to, uint256 tokenId, uint256 amount) internal virtual; /// @dev Updates storage to indicate that the given order /// has been filled by the given amount. /// @param order The order that has been filled. /// @param orderHash The hash of `order`. /// @param fillAmount The amount (denominated in the NFT asset) /// that the order has been filled by. function _updateOrderState(LibNFTOrder.NFTSellOrder memory order, bytes32 orderHash, uint128 fillAmount) internal virtual; /// @dev Updates storage to indicate that the given order /// has been filled by the given amount. /// @param order The order that has been filled. /// @param orderHash The hash of `order`. /// @param fillAmount The amount (denominated in the NFT asset) /// that the order has been filled by. function _updateOrderState(LibNFTOrder.NFTBuyOrder memory order, bytes32 orderHash, uint128 fillAmount) internal virtual; function _getBulkBuyOrderTypeHash(uint256 height) internal virtual pure returns (bytes32); function _getBulkSellOrderTypeHash(uint256 height) internal virtual pure returns (bytes32); }
// SPDX-License-Identifier: Apache-2.0 /* Modifications Copyright 2022 Element.Market Copyright 2020 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.8.17; /// @dev EIP712 helpers for features. abstract contract FixinEIP712 { bytes32 private constant DOMAIN = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); bytes32 private constant NAME = keccak256("ElementEx"); bytes32 private constant VERSION = keccak256("1.0.0"); function _getEIP712Hash(bytes32 structHash) internal view returns (bytes32) { return keccak256(abi.encodePacked(hex"1901", keccak256(abi.encode(DOMAIN, NAME, VERSION, block.chainid, address(this))), structHash)); } }
// SPDX-License-Identifier: Apache-2.0 /* Modifications Copyright 2022 Element.Market Copyright 2020 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.8.17; /// @dev Helpers for moving ERC721 assets around. abstract contract FixinERC721Spender { // Mask of the lower 20 bytes of a bytes32. uint256 constant private ADDRESS_MASK = (1 << 160) - 1; /// @dev Transfer an ERC721 asset from `owner` to `to`. /// @param token The address of the ERC721 token contract. /// @param owner The owner of the asset. /// @param to The recipient of the asset. /// @param tokenId The token ID of the asset to transfer. function _transferERC721AssetFrom(address token, address owner, address to, uint256 tokenId) internal { require(token.code.length != 0, "_transferERC721/INVALID_TOKEN"); uint256 success; assembly { let ptr := mload(0x40) // free memory pointer let toAddress := and(to, ADDRESS_MASK) // selector for transferFrom(address,address,uint256) mstore(ptr, 0x23b872dd00000000000000000000000000000000000000000000000000000000) mstore(add(ptr, 0x04), and(owner, ADDRESS_MASK)) mstore(add(ptr, 0x24), toAddress) mstore(add(ptr, 0x44), tokenId) if call(gas(), token, 0, ptr, 0x64, 0, 0) { // selector for ownerOf(uint256) mstore(ptr, 0x6352211e00000000000000000000000000000000000000000000000000000000) mstore(add(ptr, 0x04), tokenId) if staticcall(gas(), token, ptr, 0x24, ptr, 0x20) { if eq(returndatasize(), 0x20) { if eq(mload(ptr), toAddress) { success := 1 } } } } } require(success != 0, "_transferERC721/TRANSFER_FAILED"); } }
// SPDX-License-Identifier: Apache-2.0 /* Modifications Copyright 2022 Element.Market Copyright 2020 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.8.17; /// @dev Helpers for moving tokens around. abstract contract FixinTokenSpender { // Mask of the lower 20 bytes of a bytes32. uint256 constant private ADDRESS_MASK = (1 << 160) - 1; /// @dev Transfers ERC20 tokens from `owner` to `to`. /// @param token The token to spend. /// @param owner The owner of the tokens. /// @param to The recipient of the tokens. /// @param amount The amount of `token` to transfer. function _transferERC20TokensFrom(address token, address owner, address to, uint256 amount) internal { if (amount == 0) { return; } require(token.code.length != 0, "_transferERC20/INVALID_TOKEN"); uint256 success; assembly { let ptr := mload(0x40) // free memory pointer // selector for transferFrom(address,address,uint256) mstore(ptr, 0x23b872dd00000000000000000000000000000000000000000000000000000000) mstore(add(ptr, 0x04), and(owner, ADDRESS_MASK)) mstore(add(ptr, 0x24), and(to, ADDRESS_MASK)) mstore(add(ptr, 0x44), amount) success := call(gas(), token, 0, ptr, 0x64, ptr, 32) let rdsize := returndatasize() // Check for ERC20 success. ERC20 tokens should return a boolean, // but some don't. We accept 0-length return data as success, or at // least 32 bytes that starts with a 32-byte boolean true. success := and( success, // call itself succeeded or( iszero(rdsize), // no return data, or and( iszero(lt(rdsize, 32)), // at least 32 bytes eq(mload(ptr), 1) // starts with uint256(1) ) ) ) } require(success != 0, "_transferERC20/TRANSFER_FAILED"); } /// @dev Transfers some amount of ETH to the given recipient and /// reverts if the transfer fails. /// @param recipient The recipient of the ETH. /// @param amount The amount of ETH to transfer. function _transferEth(address payable recipient, uint256 amount) internal { if (amount > 0) { (bool success,) = recipient.call{value: amount}(""); require(success, "_transferEth/TRANSFER_FAILED"); } } }
// SPDX-License-Identifier: Apache-2.0 /* Copyright 2022 Element.Market Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.8.17; import "./LibStorage.sol"; library LibCommonNftOrdersStorage { uint256 internal constant MASK_160 = (1 << 160) - 1; /// @dev Storage bucket for this feature. struct Storage { /* Track per-maker nonces that can be incremented by the maker to cancel orders in bulk. */ // The current nonce for the maker represents the only valid nonce that can be signed by the maker // If a signature was signed with a nonce that's different from the one stored in nonces, it // will fail validation. mapping(address => uint256) hashNonces; // The personal sign state. uint256 personalSignState; // The oracle sign state. bytes32 oracleSignState; } /// @dev Get the storage bucket for this contract. function getStorage() internal pure returns (Storage storage stor) { uint256 storageSlot = LibStorage.STORAGE_ID_COMMON_NFT_ORDERS; // Dip into assembly to change the slot pointed to by the local // variable `stor`. // See https://solidity.readthedocs.io/en/v0.6.8/assembly.html?highlight=slot#access-to-external-variables-functions-and-libraries assembly { stor.slot := storageSlot } } function isEnableEthereumPersonalSign() internal view returns(bool) { return (getStorage().personalSignState & 0x1) != 0; } function isEnableBitcoinPersonalSign() internal view returns(bool) { return (getStorage().personalSignState & 0x2) != 0; } function isEnableBitcoinPersonalSign173() internal view returns(bool) { return (getStorage().personalSignState & 0x4) != 0; } function getOracleSigner() internal view returns(address signer) { bytes32 oracleSignState = getStorage().oracleSignState; assembly { signer := and(oracleSignState, MASK_160) } } }
// SPDX-License-Identifier: Apache-2.0 /* Modifications Copyright 2022 Element.Market Copyright 2020 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.8.17; import "./LibStorage.sol"; /// @dev Storage helpers for `ERC721OrdersFeature`. library LibERC721OrdersStorage { /// @dev Storage bucket for this feature. struct Storage { // maker => nonce range => order status bit vector mapping(address => mapping(uint248 => uint256)) orderStatusByMaker; // order hash => preSigned mapping(bytes32 => uint256) preSigned; // order hash => filledAmount mapping(bytes32 => uint128) filledAmount; } /// @dev Get the storage bucket for this contract. function getStorage() internal pure returns (Storage storage stor) { uint256 storageSlot = LibStorage.STORAGE_ID_ERC721_ORDERS; // Dip into assembly to change the slot pointed to by the local // variable `stor`. // See https://solidity.readthedocs.io/en/v0.6.8/assembly.html?highlight=slot#access-to-external-variables-functions-and-libraries assembly { stor.slot := storageSlot } } }
// SPDX-License-Identifier: Apache-2.0 /* Modifications Copyright 2022 Element.Market Copyright 2020 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.8.17; /// @dev Common storage helpers library LibStorage { /// @dev What to bit-shift a storage ID by to get its slot. /// This gives us a maximum of 2**128 inline fields in each bucket. uint256 constant STORAGE_ID_PROXY = 1 << 128; uint256 constant STORAGE_ID_SIMPLE_FUNCTION_REGISTRY = 2 << 128; uint256 constant STORAGE_ID_OWNABLE = 3 << 128; uint256 constant STORAGE_ID_COMMON_NFT_ORDERS = 4 << 128; uint256 constant STORAGE_ID_ERC721_ORDERS = 5 << 128; uint256 constant STORAGE_ID_ERC1155_ORDERS = 6 << 128; uint256 constant STORAGE_ID_REENTRANCY_GUARD = 7 << 128; }
// SPDX-License-Identifier: Apache-2.0 /* Copyright 2022 Element.Market Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.8.17; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IEtherToken is IERC20 { /// @dev Wrap ether. function deposit() external payable; /// @dev Unwrap ether. function withdraw(uint256 amount) external; }
// SPDX-License-Identifier: Apache-2.0 /* Modifications Copyright 2022 Element.Market Copyright 2021 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.8.17; interface IFeeRecipient { /// @dev A callback function invoked in the ERC721Feature for each ERC721 /// order fee that get paid. Integrators can make use of this callback /// to implement arbitrary fee-handling logic, e.g. splitting the fee /// between multiple parties. /// @param tokenAddress The address of the token in which the received fee is /// denominated. `0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE` indicates /// that the fee was paid in the native token (e.g. ETH). /// @param amount The amount of the given token received. /// @param feeData Arbitrary data encoded in the `Fee` used by this callback. /// @return success The selector of this function (0x0190805e), /// indicating that the callback succeeded. function receiveZeroExFeeCallback(address tokenAddress, uint256 amount, bytes calldata feeData) external returns (bytes4 success); }
// SPDX-License-Identifier: Apache-2.0 /* Modifications Copyright 2022 Element.Market Copyright 2021 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.8.17; interface IPropertyValidator { /// @dev Checks that the given ERC721/ERC1155 asset satisfies the properties encoded in `propertyData`. /// Should revert if the asset does not satisfy the specified properties. /// @param tokenAddress The ERC721/ERC1155 token contract address. /// @param tokenId The ERC721/ERC1155 tokenId of the asset to check. /// @param orderHash The order hash. /// @param propertyData Encoded properties or auxiliary data needed to perform the check. function validateProperty( address tokenAddress, uint256 tokenId, bytes32 orderHash, bytes calldata propertyData, bytes calldata takerData ) external view returns(bytes4); }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"contract IEtherToken","name":"weth","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"orderHash","type":"bytes32"},{"indexed":false,"internalType":"address","name":"maker","type":"address"},{"indexed":false,"internalType":"address","name":"taker","type":"address"},{"indexed":false,"internalType":"uint256","name":"nonce","type":"uint256"},{"indexed":false,"internalType":"contract IERC20","name":"erc20Token","type":"address"},{"indexed":false,"internalType":"uint256","name":"erc20TokenAmount","type":"uint256"},{"components":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"indexed":false,"internalType":"struct LibStructure.Fee[]","name":"fees","type":"tuple[]"},{"indexed":false,"internalType":"address","name":"erc721Token","type":"address"},{"indexed":false,"internalType":"uint256","name":"erc721TokenId","type":"uint256"}],"name":"ERC721BuyOrderFilled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"maker","type":"address"},{"indexed":false,"internalType":"uint256","name":"nonce","type":"uint256"}],"name":"ERC721OrderCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"orderHash","type":"bytes32"},{"indexed":false,"internalType":"address","name":"maker","type":"address"},{"indexed":false,"internalType":"address","name":"taker","type":"address"},{"indexed":false,"internalType":"uint256","name":"nonce","type":"uint256"},{"indexed":false,"internalType":"contract IERC20","name":"erc20Token","type":"address"},{"indexed":false,"internalType":"uint256","name":"erc20TokenAmount","type":"uint256"},{"components":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"indexed":false,"internalType":"struct LibStructure.Fee[]","name":"fees","type":"tuple[]"},{"indexed":false,"internalType":"address","name":"erc721Token","type":"address"},{"indexed":false,"internalType":"uint256","name":"erc721TokenId","type":"uint256"}],"name":"ERC721SellOrderFilled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"maker","type":"address"},{"indexed":false,"internalType":"uint256","name":"newHashNonce","type":"uint256"}],"name":"HashNonceIncremented","type":"event"},{"inputs":[{"components":[{"internalType":"address","name":"maker","type":"address"},{"internalType":"address","name":"taker","type":"address"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"contract IERC20","name":"erc20Token","type":"address"},{"internalType":"uint256","name":"erc20TokenAmount","type":"uint256"},{"components":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"feeData","type":"bytes"}],"internalType":"struct LibNFTOrder.Fee[]","name":"fees","type":"tuple[]"},{"internalType":"address","name":"nft","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"}],"internalType":"struct LibNFTOrder.NFTSellOrder[]","name":"sellOrders","type":"tuple[]"},{"components":[{"internalType":"enum LibSignature.SignatureType","name":"signatureType","type":"uint8"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct LibSignature.Signature[]","name":"signatures","type":"tuple[]"},{"internalType":"address[]","name":"takers","type":"address[]"},{"internalType":"bytes[]","name":"takerDatas","type":"bytes[]"},{"internalType":"bool","name":"revertIfIncomplete","type":"bool"}],"name":"batchBuyERC721sEx","outputs":[{"internalType":"bool[]","name":"successes","type":"bool[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"orderNonces","type":"uint256[]"}],"name":"batchCancelERC721Orders","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"datas","type":"bytes[]"},{"internalType":"bool","name":"revertIfIncomplete","type":"bool"}],"name":"batchSellERC721s","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"maker","type":"address"},{"internalType":"address","name":"taker","type":"address"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"contract IERC20","name":"erc20Token","type":"address"},{"internalType":"uint256","name":"erc20TokenAmount","type":"uint256"},{"components":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"feeData","type":"bytes"}],"internalType":"struct LibNFTOrder.Fee[]","name":"fees","type":"tuple[]"},{"internalType":"address","name":"nft","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"}],"internalType":"struct LibNFTOrder.NFTSellOrder","name":"sellOrder","type":"tuple"},{"components":[{"internalType":"enum LibSignature.SignatureType","name":"signatureType","type":"uint8"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct LibSignature.Signature","name":"signature","type":"tuple"},{"internalType":"address","name":"taker","type":"address"},{"internalType":"bytes","name":"takerData","type":"bytes"}],"name":"buyERC721Ex","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"maker","type":"address"},{"internalType":"address","name":"taker","type":"address"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"contract IERC20","name":"erc20Token","type":"address"},{"internalType":"uint256","name":"erc20TokenAmount","type":"uint256"},{"components":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"feeData","type":"bytes"}],"internalType":"struct LibNFTOrder.Fee[]","name":"fees","type":"tuple[]"},{"internalType":"address","name":"nft","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"}],"internalType":"struct LibNFTOrder.NFTSellOrder","name":"sellOrder","type":"tuple"},{"components":[{"internalType":"enum LibSignature.SignatureType","name":"signatureType","type":"uint8"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct LibSignature.Signature","name":"signature","type":"tuple"},{"internalType":"address","name":"taker","type":"address"},{"internalType":"bytes","name":"takerData","type":"bytes"}],"name":"buyERC721FromProxy","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"orderNonce","type":"uint256"}],"name":"cancelERC721Order","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"maker","type":"address"},{"internalType":"address","name":"taker","type":"address"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"contract IERC20","name":"erc20Token","type":"address"},{"internalType":"uint256","name":"erc20TokenAmount","type":"uint256"},{"components":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"feeData","type":"bytes"}],"internalType":"struct LibNFTOrder.Fee[]","name":"fees","type":"tuple[]"},{"internalType":"address","name":"nft","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"},{"components":[{"internalType":"contract IPropertyValidator","name":"propertyValidator","type":"address"},{"internalType":"bytes","name":"propertyData","type":"bytes"}],"internalType":"struct LibNFTOrder.Property[]","name":"nftProperties","type":"tuple[]"}],"internalType":"struct LibNFTOrder.NFTBuyOrder","name":"order","type":"tuple"}],"name":"getERC721BuyOrderHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"maker","type":"address"},{"internalType":"address","name":"taker","type":"address"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"contract IERC20","name":"erc20Token","type":"address"},{"internalType":"uint256","name":"erc20TokenAmount","type":"uint256"},{"components":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"feeData","type":"bytes"}],"internalType":"struct LibNFTOrder.Fee[]","name":"fees","type":"tuple[]"},{"internalType":"address","name":"nft","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"},{"components":[{"internalType":"contract IPropertyValidator","name":"propertyValidator","type":"address"},{"internalType":"bytes","name":"propertyData","type":"bytes"}],"internalType":"struct LibNFTOrder.Property[]","name":"nftProperties","type":"tuple[]"}],"internalType":"struct LibNFTOrder.NFTBuyOrder","name":"order","type":"tuple"}],"name":"getERC721BuyOrderInfo","outputs":[{"components":[{"internalType":"bytes32","name":"orderHash","type":"bytes32"},{"internalType":"enum LibNFTOrder.OrderStatus","name":"status","type":"uint8"},{"internalType":"uint128","name":"orderAmount","type":"uint128"},{"internalType":"uint128","name":"remainingAmount","type":"uint128"}],"internalType":"struct LibNFTOrder.OrderInfo","name":"orderInfo","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"maker","type":"address"},{"internalType":"address","name":"taker","type":"address"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"contract IERC20","name":"erc20Token","type":"address"},{"internalType":"uint256","name":"erc20TokenAmount","type":"uint256"},{"components":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"feeData","type":"bytes"}],"internalType":"struct LibNFTOrder.Fee[]","name":"fees","type":"tuple[]"},{"internalType":"address","name":"nft","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"},{"components":[{"internalType":"contract IPropertyValidator","name":"propertyValidator","type":"address"},{"internalType":"bytes","name":"propertyData","type":"bytes"}],"internalType":"struct LibNFTOrder.Property[]","name":"nftProperties","type":"tuple[]"}],"internalType":"struct LibNFTOrder.NFTBuyOrder","name":"order","type":"tuple"}],"name":"getERC721BuyOrderStatus","outputs":[{"internalType":"enum LibNFTOrder.OrderStatus","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"maker","type":"address"},{"internalType":"uint248","name":"nonceRange","type":"uint248"}],"name":"getERC721OrderStatusBitVector","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"maker","type":"address"},{"internalType":"address","name":"taker","type":"address"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"contract IERC20","name":"erc20Token","type":"address"},{"internalType":"uint256","name":"erc20TokenAmount","type":"uint256"},{"components":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"feeData","type":"bytes"}],"internalType":"struct LibNFTOrder.Fee[]","name":"fees","type":"tuple[]"},{"internalType":"address","name":"nft","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"}],"internalType":"struct LibNFTOrder.NFTSellOrder","name":"order","type":"tuple"}],"name":"getERC721SellOrderHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"maker","type":"address"},{"internalType":"address","name":"taker","type":"address"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"contract IERC20","name":"erc20Token","type":"address"},{"internalType":"uint256","name":"erc20TokenAmount","type":"uint256"},{"components":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"feeData","type":"bytes"}],"internalType":"struct LibNFTOrder.Fee[]","name":"fees","type":"tuple[]"},{"internalType":"address","name":"nft","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"}],"internalType":"struct LibNFTOrder.NFTSellOrder","name":"order","type":"tuple"}],"name":"getERC721SellOrderStatus","outputs":[{"internalType":"enum LibNFTOrder.OrderStatus","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"maker","type":"address"}],"name":"getHashNonce","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getOracleSignState","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPersonalSignState","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"incrementHashNonce","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"maker","type":"address"},{"internalType":"address","name":"taker","type":"address"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"contract IERC20","name":"erc20Token","type":"address"},{"internalType":"uint256","name":"erc20TokenAmount","type":"uint256"},{"components":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"feeData","type":"bytes"}],"internalType":"struct LibNFTOrder.Fee[]","name":"fees","type":"tuple[]"},{"internalType":"address","name":"nft","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"}],"internalType":"struct LibNFTOrder.NFTSellOrder","name":"sellOrder","type":"tuple"},{"components":[{"internalType":"address","name":"maker","type":"address"},{"internalType":"address","name":"taker","type":"address"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"contract IERC20","name":"erc20Token","type":"address"},{"internalType":"uint256","name":"erc20TokenAmount","type":"uint256"},{"components":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"feeData","type":"bytes"}],"internalType":"struct LibNFTOrder.Fee[]","name":"fees","type":"tuple[]"},{"internalType":"address","name":"nft","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"},{"components":[{"internalType":"contract IPropertyValidator","name":"propertyValidator","type":"address"},{"internalType":"bytes","name":"propertyData","type":"bytes"}],"internalType":"struct LibNFTOrder.Property[]","name":"nftProperties","type":"tuple[]"}],"internalType":"struct LibNFTOrder.NFTBuyOrder","name":"buyOrder","type":"tuple"},{"components":[{"internalType":"enum LibSignature.SignatureType","name":"signatureType","type":"uint8"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct LibSignature.Signature","name":"sellOrderSignature","type":"tuple"},{"components":[{"internalType":"enum LibSignature.SignatureType","name":"signatureType","type":"uint8"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct LibSignature.Signature","name":"buyOrderSignature","type":"tuple"},{"internalType":"bytes","name":"sellTakerData","type":"bytes"},{"internalType":"bytes","name":"buyTakerData","type":"bytes"}],"name":"matchERC721Order","outputs":[{"internalType":"uint256","name":"profit","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"success","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"maker","type":"address"},{"internalType":"address","name":"taker","type":"address"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"contract IERC20","name":"erc20Token","type":"address"},{"internalType":"uint256","name":"erc20TokenAmount","type":"uint256"},{"components":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"feeData","type":"bytes"}],"internalType":"struct LibNFTOrder.Fee[]","name":"fees","type":"tuple[]"},{"internalType":"address","name":"nft","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"},{"components":[{"internalType":"contract IPropertyValidator","name":"propertyValidator","type":"address"},{"internalType":"bytes","name":"propertyData","type":"bytes"}],"internalType":"struct LibNFTOrder.Property[]","name":"nftProperties","type":"tuple[]"}],"internalType":"struct LibNFTOrder.NFTBuyOrder","name":"buyOrder","type":"tuple"},{"components":[{"internalType":"enum LibSignature.SignatureType","name":"signatureType","type":"uint8"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct LibSignature.Signature","name":"signature","type":"tuple"},{"internalType":"uint256","name":"erc721TokenId","type":"uint256"},{"internalType":"bool","name":"unwrapNativeToken","type":"bool"},{"internalType":"bytes","name":"takerData","type":"bytes"}],"name":"sellERC721","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"state","type":"bytes32"}],"name":"setOracleSignState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"state","type":"uint256"}],"name":"setPersonalSignState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"maker","type":"address"},{"internalType":"address","name":"taker","type":"address"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"contract IERC20","name":"erc20Token","type":"address"},{"internalType":"uint256","name":"erc20TokenAmount","type":"uint256"},{"components":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"feeData","type":"bytes"}],"internalType":"struct LibNFTOrder.Fee[]","name":"fees","type":"tuple[]"},{"internalType":"address","name":"nft","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"},{"components":[{"internalType":"contract IPropertyValidator","name":"propertyValidator","type":"address"},{"internalType":"bytes","name":"propertyData","type":"bytes"}],"internalType":"struct LibNFTOrder.Property[]","name":"nftProperties","type":"tuple[]"}],"internalType":"struct LibNFTOrder.NFTBuyOrder","name":"order","type":"tuple"},{"components":[{"internalType":"enum LibSignature.SignatureType","name":"signatureType","type":"uint8"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct LibSignature.Signature","name":"signature","type":"tuple"},{"internalType":"bytes","name":"takerData","type":"bytes"}],"name":"validateERC721BuyOrderSignature","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"maker","type":"address"},{"internalType":"address","name":"taker","type":"address"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"contract IERC20","name":"erc20Token","type":"address"},{"internalType":"uint256","name":"erc20TokenAmount","type":"uint256"},{"components":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"feeData","type":"bytes"}],"internalType":"struct LibNFTOrder.Fee[]","name":"fees","type":"tuple[]"},{"internalType":"address","name":"nft","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"},{"components":[{"internalType":"contract IPropertyValidator","name":"propertyValidator","type":"address"},{"internalType":"bytes","name":"propertyData","type":"bytes"}],"internalType":"struct LibNFTOrder.Property[]","name":"nftProperties","type":"tuple[]"}],"internalType":"struct LibNFTOrder.NFTBuyOrder","name":"order","type":"tuple"},{"components":[{"internalType":"enum LibSignature.SignatureType","name":"signatureType","type":"uint8"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct LibSignature.Signature","name":"signature","type":"tuple"}],"name":"validateERC721BuyOrderSignature","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"maker","type":"address"},{"internalType":"address","name":"taker","type":"address"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"contract IERC20","name":"erc20Token","type":"address"},{"internalType":"uint256","name":"erc20TokenAmount","type":"uint256"},{"components":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"feeData","type":"bytes"}],"internalType":"struct LibNFTOrder.Fee[]","name":"fees","type":"tuple[]"},{"internalType":"address","name":"nft","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"}],"internalType":"struct LibNFTOrder.NFTSellOrder","name":"order","type":"tuple"},{"components":[{"internalType":"enum LibSignature.SignatureType","name":"signatureType","type":"uint8"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct LibSignature.Signature","name":"signature","type":"tuple"}],"name":"validateERC721SellOrderSignature","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"maker","type":"address"},{"internalType":"address","name":"taker","type":"address"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"contract IERC20","name":"erc20Token","type":"address"},{"internalType":"uint256","name":"erc20TokenAmount","type":"uint256"},{"components":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"feeData","type":"bytes"}],"internalType":"struct LibNFTOrder.Fee[]","name":"fees","type":"tuple[]"},{"internalType":"address","name":"nft","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"}],"internalType":"struct LibNFTOrder.NFTSellOrder","name":"order","type":"tuple"},{"components":[{"internalType":"enum LibSignature.SignatureType","name":"signatureType","type":"uint8"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct LibSignature.Signature","name":"signature","type":"tuple"},{"internalType":"bytes","name":"takerData","type":"bytes"}],"name":"validateERC721SellOrderSignature","outputs":[],"stateMutability":"view","type":"function"}]
Contract Creation Code
60c06040523480156200001157600080fd5b506040516200602f3803806200602f83398101604081905262000034916200009c565b806001600160a01b038116620000855760405162461bcd60e51b81526020600482015260126024820152712ba2aa242fa0a2222922a9a9afa2a92927a960711b604482015260640160405180910390fd5b6001600160a01b0316608052503060a052620000ce565b600060208284031215620000af57600080fd5b81516001600160a01b0381168114620000c757600080fd5b9392505050565b60805160a051615f0a62000125600039600081816106e601528181610c760152610d4a015260008181610fdb0152818161101d01528181611068015281816131180152818161315a015261319b0152615f0a6000f3fe6080604052600436106101665760003560e01c8063689d44a1116100d1578063af3de1551161008a578063be167b9d11610064578063be167b9d1461043d578063c67a89111461045d578063e2f5f5721461047d578063f70ae5031461049d57600080fd5b8063af3de155146103dd578063b18d619f146103fd578063bc3f61651461041057600080fd5b8063689d44a11461032f5780636e74f68a1461034257806386219940146103625780638971a1f714610382578063993cbd97146103a2578063a8809485146103bd57600080fd5b8063150b7a0211610123578063150b7a02146102425780631ef3c3a61461027b578063287846681461029b578063330c0c39146102bb5780633cdad7ce146102db5780635e725186146102f657600080fd5b8063030b27301461016b578063050505d61461019e578063053c23f1146101b5578063078e6b33146101d557806310a1ea2b146101f55780631291e27814610222575b600080fd5b34801561017757600080fd5b5061018b610186366004614a62565b6104bd565b6040519081526020015b60405180910390f35b3480156101aa57600080fd5b506101b36104f4565b005b6101c86101c3366004614f66565b610558565b6040516101959190615091565b3480156101e157600080fd5b5061018b6101f036600461527f565b6108e5565b34801561020157600080fd5b506102156102103660046152b3565b6108f8565b6040516101959190615311565b34801561022e57600080fd5b506101b361023d36600461531f565b61090d565b34801561024e57600080fd5b5061026261025d366004615379565b610a21565b6040516001600160e01b03199091168152602001610195565b34801561028757600080fd5b506101b36102963660046153eb565b610ac5565b3480156102a757600080fd5b5061018b6102b63660046152b3565b610b9c565b3480156102c757600080fd5b506101b36102d636600461531f565b610baa565b3480156102e757600080fd5b506001600160821b015461018b565b34801561030257600080fd5b5061018b61031136600461545f565b6001600160a01b03166000908152600160821b602052604090205490565b6101b361033d36600461547c565b610c73565b34801561034e57600080fd5b506101b361035d366004615505565b610cee565b34801561036e57600080fd5b506101b361037d366004615553565b610d07565b34801561038e57600080fd5b506101b361039d366004615594565b610d45565b3480156103ae57600080fd5b506002600160821b015461018b565b3480156103c957600080fd5b506101b36103d83660046155e7565b610d7a565b3480156103e957600080fd5b506102156103f836600461527f565b610d90565b6101b361040b36600461547c565b610d9b565b34801561041c57600080fd5b5061043061042b36600461527f565b610dca565b6040516101959190615677565b34801561044957600080fd5b506101b361045836600461531f565b610e3d565b34801561046957600080fd5b506101b36104783660046156bc565b610e7d565b34801561048957600080fd5b5061018b6104983660046156f1565b610e89565b3480156104a957600080fd5b506101b36104b83660046157c2565b61122e565b6001600160a01b0382166000908152600560801b602090815260408083206001600160b81b03851684529091529020545b92915050565b336000908152600160821b602052604081208054829061051390615864565b918290555060408051338152602081018390529192507f4cf3e8a83c6bf8a510613208458629675b4ae99b8029e3ab6cb6a86e5f01fd3191015b60405180910390a150565b85518551606091908114801561056d57508085145b80156105795750835181145b6105c25760405162461bcd60e51b8152602060048201526015602482015274082a4a482b2be988a9c8ea890be9a92a69a82a8869605b1b60448201526064015b60405180910390fd5b806001600160401b038111156105da576105da614aa7565b604051908082528060200260200182016040528015610603578160200160208202803683370190505b5091506000610612344761587d565b9050600084156106d95760005b838110156106d3576106a48b828151811061063c5761063c615890565b60200260200101518b838151811061065657610656615890565b60200260200101518b8b8581811061067057610670615890565b9050602002016020810190610685919061545f565b8a858151811061069757610697615890565b60200260200101516113a0565b60018582815181106106b8576106b8615890565b9115156020928302919091019091015260019150810161061f565b5061086e565b60005b8381101561086c577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663689d44a160e01b8c838151811061072857610728615890565b60200260200101518c848151811061074257610742615890565b60200260200101518c8c8681811061075c5761075c615890565b9050602002016020810190610771919061545f565b8b868151811061078357610783615890565b602002602001015160405160240161079e94939291906159aa565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199094169390931790925290516107dc9190615a8e565b600060405180830381855af49150503d8060008114610817576040519150601f19603f3d011682016040523d82523d6000602084013e61081c565b606091505b505085828151811061083057610830615890565b6020026020010181151515158152505084818151811061085257610852615890565b60200260200101511561086457600191505b6001016106dc565b505b806108c55760405162461bcd60e51b815260206004820152602160248201527f62617463684275794552433732317345782f4e4f5f4f524445525f46494c4c456044820152601160fa1b60648201526084016105b9565b6108d8336108d3844761587d565b61143d565b5050509695505050505050565b60006104ee6108f3836114e6565b61150e565b6000610903826115eb565b6040015192915050565b306001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561094b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061096f9190615aaa565b6001600160a01b0316336001600160a01b0316146109bc5760405162461bcd60e51b815260206004820152600a60248201526927b7363c9037bbb732b960b11b60448201526064016105b9565b6002600160821b015481146109d6576002600160821b0155565b60405162461bcd60e51b815260206004820152601760248201527f4e6f207374617465206e65656420746f2062652073657400000000000000000060448201526064016105b9565b50565b600080808080610a3386880188615ac7565b93509350935093508360e001516001600160a01b0316336001600160a01b031614610aa05760405162461bcd60e51b815260206004820152601b60248201527f4552433732315f544f4b454e5f4d49534d415443485f4552524f52000000000060448201526064016105b9565b610aaf84848a858e30876116a0565b50630a85bd0160e11b9998505050505050505050565b60028251600a811115610ada57610ada6152e7565b1480610af8575060048251600a811115610af657610af66152e7565b145b80610b15575060068251600a811115610b1357610b136152e7565b145b80610b32575060088251600a811115610b3057610b306152e7565b145b80610b4f5750600a8251600a811115610b4d57610b4d6152e7565b145b15610b82576000610b6a6001610b64866114e6565b84611726565b509050610b7c81848660000151611864565b50505050565b610b97610b8e846108e5565b84518490611864565b505050565b60006104ee6108f383611d0e565b306001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610be8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0c9190615aaa565b6001600160a01b0316336001600160a01b031614610c595760405162461bcd60e51b815260206004820152600a60248201526927b7363c9037bbb732b960b11b60448201526064016105b9565b6001600160821b015481146109d6576001600160821b0155565b307f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031603610ce25760405162461bcd60e51b81526020600482015260146024820152734d5553545f43414c4c5f46524f4d5f50524f585960601b60448201526064016105b9565b610b7c848484846113a0565b610d03610cfa83610b9c565b83518390611864565b5050565b60005b81811015610b9757610d33838383818110610d2757610d27615890565b90506020020135610e3d565b80610d3d81615864565b915050610d0a565b610b977f000000000000000000000000000000000000000000000000000000000000000063a880948560e01b80868686611d36565b610d89858585853333876116a0565b5050505050565b600061090382611eb6565b6000610da7344761587d565b9050610db5858585856113a0565b804714610d8957610d89336108d3834761587d565b610dd26149f3565b6000610ddd83611eb6565b9050806040015182602001906003811115610dfa57610dfa6152e7565b90816003811115610e0d57610e0d6152e7565b90525060808101516001600160801b03908116606080850191909152820151166040830152602001518152919050565b610e47338261204a565b60408051338152602081018390527fa015ad2dc32f266993958a0fd9884c746b971b254206f3478bc43e2f125c7b9e910161054d565b610d03610cfa836108e5565b60008560e001516001600160a01b03168760e001516001600160a01b031614610ef45760405162461bcd60e51b815260206004820152601b60248201527f4552433732315f544f4b454e5f4d49534d415443485f4552524f52000000000060448201526064016105b9565b6000610eff886115eb565b90506000610f0c88611eb6565b9050610f218988848b6000015160018a612093565b610f3a8887838c600001518d610100015160018a61229e565b80606001516001600160801b03168860a00151610f579190615b49565b60a0890152604089015160fc1c60011901610f7d57610f7d898960a00151600180612554565b60008960a001518960a00151610f93919061587d565b60e08b01518b518b516101008e0151939450610fae93612660565b60808a01516001600160a01b031673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14801561101357507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031689608001516001600160a01b0316145b156111315761104c7f00000000000000000000000000000000000000000000000000000000000000008a60000151308c60a00151612783565b60a0890151604051632e1a7d4d60e01b815260048101919091527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632e1a7d4d90602401600060405180830381600087803b1580156110b457600080fd5b505af11580156110c8573d6000803e3d6000fd5b505050506110de8a600001518b60a0015161143d565b6110fb6110ea8a612888565b8a51606085015160019060006128cf565b50600061110d8b3060018060016128cf565b9050611119818361587d565b9450841561112b5761112b338661143d565b50611202565b88608001516001600160a01b03168a608001516001600160a01b03161461119a5760405162461bcd60e51b815260206004820152601a60248201527f45524332305f544f4b454e5f4d49534d415443485f4552524f5200000000000060448201526064016105b9565b6111b689608001518a600001518c600001518d60a00151612783565b6111c26110ea8a612888565b5060006111d88b8b6000015160018060006128cf565b90506111e4818361587d565b94508415611200576112008a608001518b600001513388612783565b505b6112158a8a600001518560200151612b11565b6108d8898b600001518c61010001518560200151612cb6565b600261123d6020850185615b6b565b600a81111561124e5761124e6152e7565b1480611277575060046112646020850185615b6b565b600a811115611275576112756152e7565b145b8061129f5750600661128c6020850185615b6b565b600a81111561129d5761129d6152e7565b145b806112c7575060086112b46020850185615b6b565b600a8111156112c5576112c56152e7565b145b806112ef5750600a6112dc6020850185615b6b565b600a8111156112ed576112ed6152e7565b145b156113755760006113478161130b61130688615b86565b611d0e565b85858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061172692505050565b50905061136f8161135d36879003870187615b92565b61136a602089018961545f565b611864565b50610b7c565b610b7c6113846102b686615b86565b61139336869003860186615b92565b61136a602088018861545f565b306001600160a01b038316036113f85760405162461bcd60e51b815260206004820152601c60248201527f5f6275794552433732312f54414b45525f43414e4e4f545f53454c460000000060448201526064016105b9565b6001600160a01b03821661140a573391505b6000611415856115eb565b905061142685858360018787612e9d565b60a08601526020810151610d899086908590612b11565b8015610d03576000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611490576040519150601f19603f3d011682016040523d82523d6000602084013e611495565b606091505b5050905080610b975760405162461bcd60e51b815260206004820152601c60248201527f5f7472616e736665724574682f5452414e534645525f4641494c45440000000060448201526064016105b9565b80516001600160a01b03166000908152600160821b60205260408120546104ee908390612fb0565b604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f27b14c20196091d9cd90ca9c473d3ad1523b00ddf487a9b7452a8a119a16b98c918101919091527f06c015bd22b4c69690933c1058878ebdfef31f9aaae40bbe86d8a09fe1b2972c60608201524660808201523060a082015260009060c00160408051601f1981840301815290829052805160209182012061190160f01b918301919091526022820152604281018390526062015b604051602081830303815290604052805190602001209050919050565b6115f3614a1d565b6115fc82611d0e565b8082526116089061150e565b60208201526001606080830191909152825190830151611628919061303f565b1561164f576040810160025b90816003811115611647576116476152e7565b905250919050565b6001608082015260408201514260209190911c63ffffffff16111561167957604081016000611634565b42826040015163ffffffff161161169557604081016003611634565b604081016001611634565b60006116ab88611eb6565b90506117038888836040518060c0016040528060016001600160801b031681526020018b81526020018a15158152602001896001600160a01b03168152602001886001600160a01b0316815260200187815250613086565b8860a001818152505061171c8885888460200151612cb6565b5050505050505050565b602081018051600091606091600481901a91869162ffffff81169060e01c84611751576117516117cf565b8751818660051b0160200114611769576117696117cf565b602083018060005b878110156117bc5784811c6001168015611792576001811461179e576117a6565b878752825184526117a6565b825187528784525b5060408620965060209190910190600101611771565b50601f1901918252509450611803915050565b62461bcd60e51b600052600160e51b6020526f07aa30b5b2b92230ba309032b93937b960691b604052600060605260646000fd5b861561184b5761184461181583613279565b60408051602081019290925281018390526060016040516020818303038152906040528051906020012061150e565b935061185a565b61185761181583613284565b93505b5050935093915050565b60008251600a811115611879576118796152e7565b1480611897575060028251600a811115611895576118956152e7565b145b1561197b576001600160a01b0381166118e35760405162461bcd60e51b815260206004820152600e60248201526d24a72b20a624a22fa9a4a3a722a960911b60448201526064016105b9565b60208083015160408085015160608087015183516000815295860180855289905260ff9094169285019290925290830152608082015260019060a0016020604051602081039080840390855afa158015611941573d6000803e3d6000fd5b505050602060405103516001600160a01b0316816001600160a01b031614610b975760405162461bcd60e51b81526004016105b990615bae565b60038251600a811115611990576119906152e7565b14806119ae575060048251600a8111156119ac576119ac6152e7565b145b156119e8576119cc818484602001518560400151866060015161328f565b610b975760405162461bcd60e51b81526004016105b990615bae565b60058251600a8111156119fd576119fd6152e7565b1480611a1b575060068251600a811115611a1957611a196152e7565b145b15611aba576001600160821b0154600116611a785760405162461bcd60e51b815260206004820181905260248201527f457468657265756d506572736f6e616c5369676e2069732064697361626c656460448201526064016105b9565b6000611a83846132f9565b9050611a9e828285602001518660400151876060015161328f565b610b7c5760405162461bcd60e51b81526004016105b990615bae565b60078251600a811115611acf57611acf6152e7565b1480611aed575060088251600a811115611aeb57611aeb6152e7565b145b15611b55576001600160821b0154600216611b4a5760405162461bcd60e51b815260206004820152601f60248201527f426974636f696e506572736f6e616c5369676e2069732064697361626c65640060448201526064016105b9565b6000611a8384613314565b60098251600a811115611b6a57611b6a6152e7565b1480611b885750600a8251600a811115611b8657611b866152e7565b145b15611c16576001600160821b0154600416611bf05760405162461bcd60e51b815260206004820152602260248201527f426974636f696e506572736f6e616c5369676e3137332069732064697361626c604482015261195960f21b60648201526084016105b9565b6000611bfb84613314565b9050611a9e828285602001518660400151876060015161340f565b60018251600a811115611c2b57611c2b6152e7565b03611ccd576001600160a01b038116611c775760405162461bcd60e51b815260206004820152600e60248201526d24a72b20a624a22fa9a4a3a722a960911b60448201526064016105b9565b611c8183826134d8565b610b975760405162461bcd60e51b815260206004820152601860248201527f5052455349474e45445f494e56414c49445f5349474e4552000000000000000060448201526064016105b9565b60405162461bcd60e51b8152602060048201526016602482015275494e56414c49445f5349474e41545552455f5459504560501b60448201526064016105b9565b80516001600160a01b03166000908152600160821b60205260408120546104ee908390613528565b6000602083028401845b81811015611ddc578035860180356004811015611d6c578515611d6557611d65611df1565b5050611dd4565b6001600160e01b0319602083013516898103611dc3578a60005260048203602484016004376000808360008f5af415611dab5760019550505050611dd4565b8615611dbb573d6000803e3d6000fd5b505050611dd4565b5050508315611dd457611dd4611e2f565b602001611d40565b505080611deb57611deb611e70565b50611eae565b62461bcd60e51b600052600160e51b6020527c165f6d756c746943616c6c3a2064617461206572726f72000000000000604052600060605260646000fd5b62461bcd60e51b600052600160e51b6020527c1d5f6d756c746943616c6c3a2073656c6563746f72206d69736d617463604052600d60fb1b60605260646000fd5b62461bcd60e51b600052600160e51b6020527c1c5f6d756c746943616c6c3a20616c6c2063616c6c73206661696c6564604052600060605260646000fd5b505050505050565b611ebe614a1d565b611ec7826114e6565b808252611ed39061150e565b6020820152604082015160fc1c60071901611f9257604082810151811c63ffffffff166060830190815260208084015160009081526002600560801b0190915291909120549051611f2d916001600160801b031690615bd9565b6001600160801b0316608082018190521580611f565750611f568260000151836060015161303f565b15611f6657604081016002611634565b610100820151151580611f7d575061012082015151155b15611f8d57604081016000611634565b611fed565b6001606080830191909152825190830151611fad919061303f565b15611fbd57604081016002611634565b600160808201526101208201515115801590611fdd575061010082015115155b15611fed57604081016000611634565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b031682608001516001600160a01b03160361202957604081016000611634565b4260208360400151901c63ffffffff16111561167957604081016000611634565b6001600160a01b03919091166000908152600560801b602090815260408083206001600160b81b03600886901c16845290915290208054600160ff9093169290921b9091179055565b60208601516001600160a01b031615806120c25750826001600160a01b031686602001516001600160a01b0316145b61210a5760405162461bcd60e51b81526020600482015260196024820152782fbb30b634b230ba32a7b93232b917a7a7262cafaa20a5a2a960391b60448201526064016105b9565b600184604001516003811115612122576121226152e7565b1461216f5760405162461bcd60e51b815260206004820152601d60248201527f5f76616c69646174654f726465722f4f524445525f4e4f545f46494c4c00000060448201526064016105b9565b83608001516001600160801b0316826001600160801b031611156121a55760405162461bcd60e51b81526004016105b990615c00565b6121b486856020015184613596565b604086015160f81c6001908116036121d8576121d5846020015184836135a8565b90505b60028551600a8111156121ed576121ed6152e7565b148061220b575060048551600a811115612209576122096152e7565b145b80612228575060068551600a811115612226576122266152e7565b145b80612245575060088551600a811115612243576122436152e7565b145b806122625750600a8551600a811115612260576122606152e7565b145b1561228b5760006122796000866000015184611726565b509050611deb81878960000151611864565b611eae8460200151868860000151611864565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b031687608001516001600160a01b0316036123175760405162461bcd60e51b815260206004820152601d60248201527f5f76616c69646174654f726465722f544f4b454e5f4d49534d4154434800000060448201526064016105b9565b60208701516001600160a01b031615806123465750836001600160a01b031687602001516001600160a01b0316145b61238e5760405162461bcd60e51b81526020600482015260196024820152782fbb30b634b230ba32a7b93232b917a7a7262cafaa20a5a2a960391b60448201526064016105b9565b6001856040015160038111156123a6576123a66152e7565b146123f35760405162461bcd60e51b815260206004820152601d60248201527f5f76616c69646174654f726465722f4f524445525f4e4f545f46494c4c00000060448201526064016105b9565b84608001516001600160801b0316826001600160801b031611156124295760405162461bcd60e51b81526004016105b990615c00565b612438878660200151846137a2565b604087015160f81c60019081160361245c57612459856020015185836135a8565b90505b60028651600a811115612471576124716152e7565b148061248f575060048651600a81111561248d5761248d6152e7565b145b806124ac575060068651600a8111156124aa576124aa6152e7565b145b806124c9575060088651600a8111156124c7576124c76152e7565b145b806124e65750600a8651600a8111156124e4576124e46152e7565b145b15612528576000806124fe6001886000015185611726565b915091506125128988602001518784613808565b61252182898b60000151611864565b505061254b565b6125388786602001518584613808565b61254b8560200151878960000151611864565b50505050505050565b60006125658560c001518484613a08565b905060008560a00151826125799190615c47565b9050808514611eae57600061258e828761587d565b9050600082156126385760005b8860c0015151811015612636576000848a60c0015183815181106125c1576125c1615890565b602002602001015160200151856125d89190615c5a565b6125e29190615b49565b9050808a60c0015183815181106125fb576125fb615890565b60200260200101516020018181516126139190615c47565b9052506126208184615c47565b925050808061262e90615864565b91505061259b565b505b612642818361587d565b8860a0018181516126539190615c47565b9052505050505050505050565b836001600160a01b03163b6000036126ba5760405162461bcd60e51b815260206004820152601d60248201527f5f7472616e736665724552433732312f494e56414c49445f544f4b454e00000060448201526064016105b9565b60006040516001600160a01b0384166323b872dd60e01b82526001600160a01b038616600483015280602483015283604483015260008060648460008b5af115612731576331a9108f60e11b82528360048301526020826024848a5afa156127315760203d03612731578082510361273157600192505b505080600003610d895760405162461bcd60e51b815260206004820152601f60248201527f5f7472616e736665724552433732312f5452414e534645525f4641494c45440060448201526064016105b9565b8015610b7c57836001600160a01b03163b6000036127e35760405162461bcd60e51b815260206004820152601c60248201527f5f7472616e7366657245524332302f494e56414c49445f544f4b454e0000000060448201526064016105b9565b60006040516323b872dd60e01b81526001600160a01b03851660048201526001600160a01b038416602482015282604482015260208160648360008a5af191503d600182511460208210151681151783169250505080600003610d895760405162461bcd60e51b815260206004820152601e60248201527f5f7472616e7366657245524332302f5452414e534645525f4641494c4544000060448201526064016105b9565b604080516101208101825260008082526020820181905291810182905260608082018390526080820183905260a0820183905260c082015260e08101829052610100015290565b6000805b8660c0015151811015612b075760008760c0015182815181106128f8576128f8615890565b602002602001015190506000856001600160801b0316876001600160801b03161461294f57856001600160801b0316876001600160801b031683602001516129409190615c5a565b61294a9190615b49565b612955565b81602001515b9050841561296e578151612969908261143d565b612988565b801561298857612988896080015189846000015184612783565b60408201515115612af15781516001600160a01b03163b6000036129ee5760405162461bcd60e51b815260206004820152601e60248201527f5f706179466565732f494e56414c49445f4645455f524543495049454e54000060448201526064016105b9565b81516000906001600160a01b03166330787dd187612a10578b60800151612a26565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee5b8486604001516040518463ffffffff1660e01b8152600401612a4a93929190615c71565b6020604051808303816000875af1158015612a69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a8d9190615ca1565b90506001600160e01b031981166330787dd160e01b14612aef5760405162461bcd60e51b815260206004820152601860248201527f5f706179466565732f43414c4c4241434b5f4641494c4544000000000000000060448201526064016105b9565b505b612afb8185615c47565b935050506001016128d3565b5095945050505050565b60008360c00151516001600160401b03811115612b3057612b30614aa7565b604051908082528060200260200182016040528015612b7557816020015b6040805180820190915260008082526020820152815260200190600190039081612b4e5790505b50905060005b8151811015612c4f578460c001518181518110612b9a57612b9a615890565b602002602001015160000151828281518110612bb857612bb8615890565b60209081029190910101516001600160a01b03909116905260c0850151805182908110612be757612be7615890565b602002602001015160200151828281518110612c0557612c05615890565b60200260200101516020018181525050818181518110612c2757612c27615890565b6020026020010151602001518560a001818151612c449190615c47565b905250600101612b7b565b507f9c248aa1a265aa616f707b979d57f4529bb63a4fc34dc7fc61fdddc18410f74e82856000015185876060015188608001518960a00151878b60e001518c6101000151604051612ca899989796959493929190615ccb565b60405180910390a150505050565b6000600860fc8660400151901c14612ccf576001612cdf565b60408560400151901c63ffffffff165b905060008560c00151516001600160401b03811115612d0057612d00614aa7565b604051908082528060200260200182016040528015612d4557816020015b6040805180820190915260008082526020820152815260200190600190039081612d1e5790505b50905060005b8151811015612e39578660c001518181518110612d6a57612d6a615890565b602002602001015160000151828281518110612d8857612d88615890565b6020026020010151600001906001600160a01b031690816001600160a01b031681525050828760c001518281518110612dc357612dc3615890565b60200260200101516020015181612ddc57612ddc615b33565b04828281518110612def57612def615890565b60200260200101516020018181525050818181518110612e1157612e11615890565b6020026020010151602001518760a001818151612e2e9190615c47565b905250600101612d4b565b507fd90a5c60975c6ff8eafcf02088e7b50ae5d9e156a79206ba553df1c4fb4594c28387600001518789606001518a608001518b60a00151878d60e001518c604051612e8d99989796959493929190615ccb565b60405180910390a1505050505050565b6000612ead878787868887612093565b84606001516001600160801b0316846001600160801b031614612efe57612ef9846001600160801b03168860a00151612ee69190615c5a565b86606001516001600160801b0316613ac6565b612f04565b8660a001515b9050612f298760e001518860000151858a6101000151886001600160801b0316613ae9565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b031687608001516001600160a01b031603612f7e578651612f66908261143d565b612f78873086886060015160016128cf565b50612fa6565b612f92876080015133896000015184612783565b612fa4873386886060015160006128cf565b505b9695505050505050565b600080612fc1846101200151613af5565b90506000612fd28560c00151613d37565b90506020851015612fdf57fe5b601f198501805160c087018051610120890180516101408b0180517fa525d336300f566329800fcbe82fd263226dc27d6c109f060d9a4a364281521c88529785529782528988526101808620949095529152919091529152905092915050565b6001600160a01b03919091166000908152600560801b60209081526040808320600885901c6001600160b81b03168452909152902054600160ff9092169190911b16151590565b60006130a78585858560600151866020015187600001518860a0015161229e565b82606001516001600160801b031682600001516001600160801b0316146131025782606001516001600160801b031682600001516001600160801b03168660a001516130f39190615c5a565b6130fd9190615b49565b613108565b8460a001515b90508160400151801561315057507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031685608001516001600160a01b0316145b15613212576131857f000000000000000000000000000000000000000000000000000000000000000086600001513084612783565b604051632e1a7d4d60e01b8152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632e1a7d4d90602401600060405180830381600087803b1580156131e757600080fd5b505af11580156131fb573d6000803e3d6000fd5b5050505061320d82606001518261143d565b61322a565b61322a85608001518660000151846060015184612783565b6132548560e0015183608001518760000151856020015186600001516001600160801b0316613ae9565b61327061326086612888565b86518451606087015160006128cf565b50949350505050565b60006104ee82613f46565b60006104ee8261441f565b600080863b15612fa657604051631626ba7e8152866020820152604080820152604160608201528460808201528360a08201528560f81b60c082015260208160a5601c84018b5afa15612fa457630b135d3f60e11b815103612fa457506001979650505050505050565b6000613304826148f8565b6040516020016115ce9190615d7a565b6000806002613322846148f8565b6040516020016133329190615de5565b60408051601f198184030181529082905261334c91615a8e565b602060405180830381855afa158015613369573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061338c9190615e50565b604080516020808252818301909252919250600091906020820181803683370190505090508160208201526002816040516133c79190615a8e565b602060405180830381855afa1580156133e4573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906134079190615e50565b949350505050565b600080863b1561344857604051638da5cb5b81526020816004601c84018b5afa1561344657600160a01b8151101561344657805191505b505b6001600160a01b038116158015906134cd575060408051600081526020810180835288905260ff871691810191909152606081018590526080810184905260019060a0016020604051602081039080840390855afa1580156134ae573d6000803e3d6000fd5b505050602060405103516001600160a01b0316816001600160a01b0316145b979650505050505050565b6001600160a01b0381166000908152600160821b60205260408120546134ff906001615c47565b600093845270050000000000000000000000000000000160205260409093205490921492915050565b6000806135388460c00151613d37565b9050602084101561354557fe5b601f198401805160c08601805161012090970180517fed676c7f3e8232a311454799b1cf26e75b4abc90c9bf06c9f7e8e79fcc7fe14d85529482529586526101608320919092529490529091525090565b610b978360000151846060015161204a565b805160609060458110156135f75760405162461bcd60e51b815260206004820152601660248201527527b930b1b6329039b4b3b730ba3ab9329032b93937b960511b60448201526064016105b9565b60006136116002600160821b01546001600160a01b031690565b90506001600160a01b03811661363457506044190160458301908152905061379b565b600484015160248501516044860151604587018051604080514681523060208201529081018c9052606081018b905263ffffffff9095166080860181905260a09095206044198801835291975060ff1693904282116136d55760405162461bcd60e51b815260206004820152601760248201527f4f7261636c6520646561646c696e65207265616368656400000000000000000060448201526064016105b9565b60408051600081526020810180835283905260ff87169181019190915260608101859052608081018490526001600160a01b0387169060019060a0016020604051602081039080840390855afa158015613733573d6000803e3d6000fd5b505050602060405103516001600160a01b0316146137935760405162461bcd60e51b815260206004820152601860248201527f496e76616c6964206f7261636c65207369676e6174757265000000000000000060448201526064016105b9565b505050505050505b9392505050565b600860fc8460400151901c036135965760008281526002600560801b016020526040812080548392906137df9084906001600160801b0316615e69565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550505050565b8361012001515160000361386f57836101000151821461386a5760405162461bcd60e51b815260206004820181905260248201527f5f76616c696461746550726f706572746965732f544f4b454e5f49445f45525260448201526064016105b9565b610b7c565b60005b84610120015151811015610d89576000856101200151828151811061389957613899615890565b6020026020010151905060006001600160a01b031681600001516001600160a01b0316146139ff5780516001600160a01b03163b60000361391c5760405162461bcd60e51b815260206004820152601a60248201527f494e56414c49445f50524f50455254595f56414c494441544f5200000000000060448201526064016105b9565b805160e0870151602083015160405163779fc9b560e11b81526000936001600160a01b03169263ef3f936a9261395a928a918c918b90600401615e89565b602060405180830381865afa158015613977573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061399b9190615ca1565b90506001600160e01b0319811663779fc9b560e11b146139fd5760405162461bcd60e51b815260206004820152601a60248201527f50524f50455254595f56414c49444154494f4e5f4641494c454400000000000060448201526064016105b9565b505b50600101613872565b6000818303613a605760005b8451811015613a5a57848181518110613a2f57613a2f615890565b60200260200101516020015182613a469190615c47565b915080613a5281615864565b915050613a14565b5061379b565b60005b8451811015613abe578284868381518110613a8057613a80615890565b602002602001015160200151613a969190615c5a565b613aa09190615b49565b613aaa9083615c47565b915080613ab681615864565b915050613a63565b509392505050565b6000816001613ad58286615c47565b613adf919061587d565b61379b9190615b49565b610d8985858585612660565b8051600090808203613b29577fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4709150613d31565b80600103613bff57600083600081518110613b4657613b46615890565b6020026020010151905060006001600160a01b031681600001516001600160a01b0316148015613b795750602081015151155b15613ba6577f720ee400a9024f6a49768142c339bf09d2dd9056ab52d20fbe7165faba6e142d9250613bf9565b602080820151805190820120604080517f6292cf854241cb36887e639065eca63b3af9f7f70270cebeda4c29b6d3bc65e8815284516001600160a01b031681850152908101919091526060812081522092505b50613d31565b6000816001600160401b03811115613c1957613c19614aa7565b604051908082528060200260200182016040528015613c42578160200160208202803683370190505b50905060005b82811015613d25577f6292cf854241cb36887e639065eca63b3af9f7f70270cebeda4c29b6d3bc65e8858281518110613c8357613c83615890565b602002602001015160000151868381518110613ca157613ca1615890565b60200260200101516020015180519060200120604051602001613ce0939291909283526001600160a01b03919091166020830152604082015260600190565b60405160208183030381529060405280519060200120828281518110613d0857613d08615890565b602090810291909101015280613d1d81615864565b915050613c48565b50602082810291012091505b50919050565b8051600090808203613d6b577fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4709150613d31565b80600103613dfc57600083600081518110613d8857613d88615890565b60200260200101519050600081604001518051906020012090506040517fe68c29f1b4e8cce0bbcac76eb1334bdc1dc1f293a517c90e9e532340e1e94115815282516001600160a01b0316602082015260208301516040820152816060820152608081208152602081209450505050613d31565b6000816001600160401b03811115613e1657613e16614aa7565b604051908082528060200260200182016040528015613e3f578160200160208202803683370190505b50905060005b82811015613d25577fe68c29f1b4e8cce0bbcac76eb1334bdc1dc1f293a517c90e9e532340e1e94115858281518110613e8057613e80615890565b602002602001015160000151868381518110613e9e57613e9e615890565b602002602001015160200151878481518110613ebc57613ebc615890565b60200260200101516040015180519060200120604051602001613f0194939291909384526001600160a01b039290921660208401526040830152606082015260800190565b60405160208183030381529060405280519060200120828281518110613f2957613f29615890565b602090810291909101015280613f3e81615864565b915050613e45565b6000600782101561406b5781600203613f8057507f9f75ca91e1048cc22959b86e890a322468993b0042056da157f2b412c6448a67919050565b81600303613faf57507f0b9237358bc0780db84404e8ac4354d9f65ad89d2f69ee36feef85323cc50e56919050565b81600403613fde57507f1d7449e626c1883d0a685a1eda892c4ebbec2fee5314d96df22ec6075af7e6da919050565b8160050361400d57507f3bd53d6120daeed6dfbe380dea0375dc8998073981bdb5b77d06c322e9f2d647919050565b8160010361403c57507fb32e6b07ca7f956efdb96d28fed6462c6d478d4f66692a6773741b404ff85f74919050565b8160060361406b57507f5ee31cf4765667f4d0fb661820bbfe26e1583a3035f58a2fa02f1bba4e6fbd6c919050565b600d82101561418e57816007036140a357507fb608f4e4a9cd3cfd2c8cfccdad26888534996b0ae42be788464d9f617736ca9a919050565b816008036140d257507f46b6148f58b19871db49b6f83360c40fa5c1245310a5a68a58ebd575aa83ed13919050565b8160090361410157507fa8a9bda09e5a02cacb2dead999ab5f3a42c31378575a118d3610c7fcd0f5f589919050565b81600a0361413057507f104d0c688b877378c48931b8ab8d4cd40b91a284864372a291f5f0781080320a919050565b81600b0361415f57507f566bb180c8b6c356458ac8ac2b1f94a344f13ad2cab2a0368fb5e0f63995271c919050565b81600c0361418e57507fea284288a7b9efcb7bfa8960c9fee47e83a928c769634a8ccd84de1f04ab5cca919050565b60138210156142b15781600d036141c657507f07f743265e8e61a1b890adf806926567cc011ebdfa491d5accc08a0c353056f2919050565b81600e036141f557507f3cb41bc57327bfc80e77688d75fd37ae8d661f2d347e724e8f5e417022f9796f919050565b81600f0361422457507fc79245b07759ae6288019cddb41b3cf90ca8ee2f5c8339d99b111efc6544a867919050565b8160100361425357507facd68817a805cfc3b06f56b3bbb5fcbdf8e945abd065de4c81c580533f7a600a919050565b8160110361428257507fd57701e882860956e3f7872db1e179d6b8fc8e13a5398bb6af893a5e42e77839919050565b816012036142b157507f2f3ed58d4e1d0a4c76f70032ee82f302118bfbadf3b0c39721868115a2bb020b919050565b816013036142e057507f185fae4db124d03654cdc4beefd2f59ae93e9cc2f04eda3d86eefc6ad69fb653919050565b8160140361430f57507f8284117e9b7752fa6a09985a8ad343a0f36e4399dc23841b852b06f61c494944919050565b8160150361433e57507f4645af7b9f125b178e9090156cc187c311456985f773afde066dad652981a8db919050565b8160160361436d57507f15c4e80ebf08449122359b63924db2ae4aefad40b75bef4b6a4325cf2f72ce9c919050565b8160170361439c57507fa18f3d5fd85a19d6b8db5ebd2d5e31db3fb730b2d30a046b473c0137a2fc8056919050565b816018036143cb57507f637175f391c9fa3e7d2456fc5f4d663cb628d453586604ba35d7a0f2d89f958b919050565b60405162461bcd60e51b815260206004820152602360248201527f67657442756c6b4552433732314275794f7264657254797065486173682065726044820152623937b960e91b60648201526084016105b9565b60006007821015614544578160020361445957507fbe8fa00d5b6a4c861c69d133d99ca46b741eb30c6909efbec15c237de29df561919050565b8160030361448857507fa4e6352852d88baa542528c5d7dd37687543ba5b2ee63f207a5e03fe4544415e919050565b816004036144b757507f65ba80d235ecf7aec7cb17b9ba7cae23869c6f5338039d07c01170985202f1fb919050565b816005036144e657507fb187dd134be01439b73639695a8858e0f1a24e73eb2b2a4cb0720b4dbda5ffd9919050565b8160010361451557507fd34f03762ce1f357d7a826ecb4627841b188c269566aeb2a73e284d84cd78912919050565b8160060361454457507f698d310ab6eafea7429fc10c1541820159abd99d4f97b0ac55a280c6fa034862919050565b600d821015614667578160070361457c57507f7d140482f96d81136b0473b9da1642229f2ace5516157987dd911fd86933752e919050565b816008036145ab57507f43ddc7bd2b79f0fce3d28ffe218973cdfc75db4d262dc7e68e78c43ddb2139d5919050565b816009036145da57507fb2bb85f1bb297265004ee4385dfaa05cfc37266a01321161d983471d7e59d6f3919050565b81600a0361460957507fa3796aeaba14ca1c62562b30874fa4418b6b722d3092259608f09eeba1df16e8919050565b81600b0361463857507f3c9e717430c9ada5e01143f5e8a7c4a9285b0a8b818ae99cb471f764b6e432ea919050565b81600c0361466757507f42a852d8385b94b31ae1f6c15cf66b195eafe58bf051f8a16c803876f55da687919050565b601382101561478a5781600d0361469f57507fb793175426ec3a64dfc1ec27ca103f2368b0117fc08c4bbb1fa3b6ad133c2934919050565b81600e036146ce57507f4ccffbfa05cf55a8156a9a2d539974bc99a792b040f07f8bcb9da8a8c50496b1919050565b81600f036146fd57507fb19809e8a69fb92b9b3d5dcf8ed27878cebc770f6c81f317d4092f1d6ef38804919050565b8160100361472c57507fa09a903f341da4dd111eff50adb9c12edb83525d28f67eca2891dddbdba73659919050565b8160110361475b57507f9891e291bb672c5a78451aee982906c1cce43e4e5bc7397770c58fc4decd9039919050565b8160120361478a57507fd7c0b9608ad661aa8a552e080abdbeb17b5d35a0c523f385f3b6575823940ef5919050565b816013036147b957507f8576b675cd395ceb837f22d2a7ecaa6de131eb69b16f017cee7c562896099bc0919050565b816014036147e857507f23b44e24d7f76cbaf701cc1e9f071db3bdb8a724bbcb88b18f8c5694b082dd9f919050565b8160150361481757507fc9ee72afde7c567fd7341fe62b02bca4ccf8705bcf6aac1e68ad25eed57fb755919050565b8160160361484657507fa3dd9c0bf81fb4bfb232fe287cf1f5ce8561446f2f2319231bc4db0b3a2441c8919050565b8160170361487557507f5309812ac587bdacbfd514f846f4bba837fe11edf3d82ec3338af8877192ffcd919050565b816018036148a457507f5379dceee9dc69ff1c99801b6c20a1933258d5e57119464510dff80bf19b529c919050565b60405162461bcd60e51b8152602060048201526024808201527f67657442756c6b45524337323153656c6c4f7264657254797065486173682065604482015263393937b960e11b60648201526084016105b9565b60408051604280825260808201909252606091839190602082018180368337019050509150600360fc1b8260008151811061493557614935615890565b60200101906001600160f81b031916908160001a905350600f60fb1b8260018151811061496457614964615890565b60200101906001600160f81b031916908160001a90535060415b60018111156149ec576f181899199a1a9b1b9c1cb0b131b232b360811b82600f16601081106149af576149af615890565b1a60f81b8382815181106149c5576149c5615890565b60200101906001600160f81b031916908160001a90535060049190911c906000190161497e565b5050919050565b6040805160808101909152600080825260208201905b815260006020820181905260409091015290565b6040805160a0810182526000808252602082018190529091820190614a09565b6001600160a01b0381168114610a1e57600080fd5b8035614a5d81614a3d565b919050565b60008060408385031215614a7557600080fd5b8235614a8081614a3d565b915060208301356001600160f81b0381168114614a9c57600080fd5b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b604051606081016001600160401b0381118282101715614adf57614adf614aa7565b60405290565b60405161012081016001600160401b0381118282101715614adf57614adf614aa7565b604080519081016001600160401b0381118282101715614adf57614adf614aa7565b60405161014081016001600160401b0381118282101715614adf57614adf614aa7565b604051601f8201601f191681016001600160401b0381118282101715614b7557614b75614aa7565b604052919050565b60006001600160401b03821115614b9657614b96614aa7565b5060051b60200190565b600082601f830112614bb157600080fd5b81356001600160401b03811115614bca57614bca614aa7565b614bdd601f8201601f1916602001614b4d565b818152846020838601011115614bf257600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f830112614c2057600080fd5b81356020614c35614c3083614b7d565b614b4d565b82815260059290921b84018101918181019086841115614c5457600080fd5b8286015b84811015612fa45780356001600160401b0380821115614c785760008081fd5b908801906060828b03601f1901811315614c925760008081fd5b614c9a614abd565b87840135614ca781614a3d565b815260408481013589830152918401359183831115614cc65760008081fd5b614cd48d8a85880101614ba0565b908201528652505050918301918301614c58565b60006101208284031215614cfb57600080fd5b614d03614ae5565b9050614d0e82614a52565b8152614d1c60208301614a52565b60208201526040820135604082015260608201356060820152614d4160808301614a52565b608082015260a082013560a082015260c08201356001600160401b03811115614d6957600080fd5b614d7584828501614c0f565b60c083015250614d8760e08301614a52565b60e082015261010080830135818301525092915050565b8035600b8110614a5d57600080fd5b600060808284031215614dbf57600080fd5b604051608081018181106001600160401b0382111715614de157614de1614aa7565b604052905080614df083614d9e565b8152602083013560ff81168114614e0657600080fd5b8060208301525060408301356040820152606083013560608201525092915050565b600082601f830112614e3957600080fd5b81356020614e49614c3083614b7d565b82815260079290921b84018101918181019086841115614e6857600080fd5b8286015b84811015612fa457614e7e8882614dad565b835291830191608001614e6c565b60008083601f840112614e9e57600080fd5b5081356001600160401b03811115614eb557600080fd5b6020830191508360208260051b8501011115614ed057600080fd5b9250929050565b600082601f830112614ee857600080fd5b81356020614ef8614c3083614b7d565b82815260059290921b84018101918181019086841115614f1757600080fd5b8286015b84811015612fa45780356001600160401b03811115614f3a5760008081fd5b614f488986838b0101614ba0565b845250918301918301614f1b565b80358015158114614a5d57600080fd5b60008060008060008060a08789031215614f7f57600080fd5b6001600160401b038088351115614f9557600080fd5b8735880189601f820112614fa857600080fd5b80356020614fb8614c3083614b7d565b82815260059290921b8301810191818101908d841115614fd757600080fd5b8285015b8481101561500d578681351115614ff157600080fd5b6150008f858335890101614ce8565b8352918301918301614fdb565b509a50508a01359150508181111561502457600080fd5b6150308a828b01614e28565b96505060408801358181111561504557600080fd5b6150518a828b01614e8c565b90965094505060608801358181111561506957600080fd5b6150758a828b01614ed7565b9350505061508560808801614f56565b90509295509295509295565b6020808252825182820181905260009190848201906040850190845b818110156150cb5783511515835292840192918401916001016150ad565b50909695505050505050565b600082601f8301126150e857600080fd5b813560206150f8614c3083614b7d565b82815260059290921b8401810191818101908684111561511757600080fd5b8286015b84811015612fa45780356001600160401b038082111561513b5760008081fd5b908801906040828b03601f19018113156151555760008081fd5b61515d614b08565b8784013561516a81614a3d565b815290830135908282111561517f5760008081fd5b61518d8c8984870101614ba0565b81890152865250505091830191830161511b565b600061014082840312156151b457600080fd5b6151bc614b2a565b90506151c782614a52565b81526151d560208301614a52565b602082015260408201356040820152606082013560608201526151fa60808301614a52565b608082015260a082013560a082015260c08201356001600160401b038082111561522357600080fd5b61522f85838601614c0f565b60c084015261524060e08501614a52565b60e084015261010084810135908401526101209150818401358181111561526657600080fd5b615272868287016150d7565b8385015250505092915050565b60006020828403121561529157600080fd5b81356001600160401b038111156152a757600080fd5b613407848285016151a1565b6000602082840312156152c557600080fd5b81356001600160401b038111156152db57600080fd5b61340784828501614ce8565b634e487b7160e01b600052602160045260246000fd5b6004811061530d5761530d6152e7565b9052565b602081016104ee82846152fd565b60006020828403121561533157600080fd5b5035919050565b60008083601f84011261534a57600080fd5b5081356001600160401b0381111561536157600080fd5b602083019150836020828501011115614ed057600080fd5b60008060008060006080868803121561539157600080fd5b853561539c81614a3d565b945060208601356153ac81614a3d565b93506040860135925060608601356001600160401b038111156153ce57600080fd5b6153da88828901615338565b969995985093965092949392505050565b600080600060c0848603121561540057600080fd5b83356001600160401b038082111561541757600080fd5b615423878388016151a1565b94506154328760208801614dad565b935060a086013591508082111561544857600080fd5b5061545586828701614ba0565b9150509250925092565b60006020828403121561547157600080fd5b813561379b81614a3d565b60008060008060e0858703121561549257600080fd5b84356001600160401b03808211156154a957600080fd5b6154b588838901614ce8565b95506154c48860208901614dad565b945060a087013591506154d682614a3d565b90925060c086013590808211156154ec57600080fd5b506154f987828801614ba0565b91505092959194509250565b60008060a0838503121561551857600080fd5b82356001600160401b0381111561552e57600080fd5b61553a85828601614ce8565b92505061554a8460208501614dad565b90509250929050565b6000806020838503121561556657600080fd5b82356001600160401b0381111561557c57600080fd5b61558885828601614e8c565b90969095509350505050565b6000806000604084860312156155a957600080fd5b83356001600160401b038111156155bf57600080fd5b6155cb86828701614e8c565b90945092506155de905060208501614f56565b90509250925092565b6000806000806000610100868803121561560057600080fd5b85356001600160401b038082111561561757600080fd5b61562389838a016151a1565b96506156328960208a01614dad565b955060a0880135945061564760c08901614f56565b935060e088013591508082111561565d57600080fd5b5061566a88828901614ba0565b9150509295509295909350565b815181526020808301516080830191615692908401826152fd565b5060408301516001600160801b038082166040850152806060860151166060850152505092915050565b60008060a083850312156156cf57600080fd5b82356001600160401b038111156156e557600080fd5b61553a858286016151a1565b600080600080600080610180878903121561570b57600080fd5b86356001600160401b038082111561572257600080fd5b61572e8a838b01614ce8565b9750602089013591508082111561574457600080fd5b6157508a838b016151a1565b965061575f8a60408b01614dad565b955061576e8a60c08b01614dad565b945061014089013591508082111561578557600080fd5b6157918a838b01614ba0565b93506101608901359150808211156157a857600080fd5b506157b589828a01614ba0565b9150509295509295509295565b60008060008084860360c08112156157d957600080fd5b85356001600160401b03808211156157f057600080fd5b90870190610120828a03121561580557600080fd5b8196506080601f198401121561581a57600080fd5b60208801955060a088013592508083111561583457600080fd5b505061584287828801615338565b95989497509550505050565b634e487b7160e01b600052601160045260246000fd5b6000600182016158765761587661584e565b5060010190565b818103818111156104ee576104ee61584e565b634e487b7160e01b600052603260045260246000fd5b60005b838110156158c15781810151838201526020016158a9565b50506000910152565b600081518084526158e28160208601602086016158a6565b601f01601f19169290920160200192915050565b600081518084526020808501808196508360051b8101915082860160005b85811015615967578284038952815180516001600160a01b031685528581015186860152604090810151606091860182905290615953818701836158ca565b9a87019a9550505090840190600101615914565b5091979650505050505050565b8051600b8110615986576159866152e7565b825260208181015160ff169083015260408082015190830152606090810151910152565b60e081526159c460e0820186516001600160a01b03169052565b600060208601516101006159e2818501836001600160a01b03169052565b604088015161012085810191909152606089015161014086015260808901516001600160a01b031661016086015260a089015161018086015260c08901516101a08601919091529150615a396102008501836158f6565b915060e0880151615a566101c08601826001600160a01b03169052565b508701516101e0840152615a6d6020840187615974565b6001600160a01b03851660a084015282810360c08401526134cd81856158ca565b60008251615aa08184602087016158a6565b9190910192915050565b600060208284031215615abc57600080fd5b815161379b81614a3d565b60008060008060e08587031215615add57600080fd5b84356001600160401b0380821115615af457600080fd5b615b00888389016151a1565b9550615b0f8860208901614dad565b9450615b1d60a08801614f56565b935060c08701359150808211156154ec57600080fd5b634e487b7160e01b600052601260045260246000fd5b600082615b6657634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215615b7d57600080fd5b61379b82614d9e565b60006104ee3683614ce8565b600060808284031215615ba457600080fd5b61379b8383614dad565b602080825260119082015270494e56414c49445f5349474e415455524560781b604082015260600190565b6001600160801b03828116828216039080821115615bf957615bf961584e565b5092915050565b60208082526027908201527f5f76616c69646174654f726465722f455843454544535f52454d41494e494e4760408201526617d05353d5539560ca1b606082015260800190565b808201808211156104ee576104ee61584e565b80820281158282048414176104ee576104ee61584e565b60018060a01b0384168152826020820152606060408201526000615c9860608301846158ca565b95945050505050565b600060208284031215615cb357600080fd5b81516001600160e01b03198116811461379b57600080fd5b60006101208083018c8452602060018060a01b03808e16828701526040818e16818801528c6060880152818c1660808801528a60a08801528460c0880152839450895180855261014088019550838b01945060005b81811015615d47578551805185168852850151858801529582019594840194600101615d20565b5050506001600160a01b03881660e087015250919250615d65915050565b826101008301529a9950505050505050505050565b7f19457468657265756d205369676e6564204d6573736167653a0a313031456c6581527f6d656e742e6d61726b6574206c697374696e672f6f6666657220686173683a0a602082015260008251615dd88160408501602087016158a6565b9190910160400192915050565b7f18426974636f696e205369676e6564204d6573736167653a0a65456c656d656e81527f742e6d61726b6574206c697374696e672f6f6666657220686173683a0a000000602082015260008251615e4381603d8501602087016158a6565b91909101603d0192915050565b600060208284031215615e6257600080fd5b5051919050565b6001600160801b03818116838216019080821115615bf957615bf961584e565b60018060a01b038616815284602082015283604082015260a060608201526000615eb660a08301856158ca565b8281036080840152615ec881856158ca565b9897505050505050505056fea26469706673582212204356ed8f700975f3ad79a8110d0106f4d5077c5d3d53b79b4fc33ae2e685b25b64736f6c63430008110033000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Deployed Bytecode
0x6080604052600436106101665760003560e01c8063689d44a1116100d1578063af3de1551161008a578063be167b9d11610064578063be167b9d1461043d578063c67a89111461045d578063e2f5f5721461047d578063f70ae5031461049d57600080fd5b8063af3de155146103dd578063b18d619f146103fd578063bc3f61651461041057600080fd5b8063689d44a11461032f5780636e74f68a1461034257806386219940146103625780638971a1f714610382578063993cbd97146103a2578063a8809485146103bd57600080fd5b8063150b7a0211610123578063150b7a02146102425780631ef3c3a61461027b578063287846681461029b578063330c0c39146102bb5780633cdad7ce146102db5780635e725186146102f657600080fd5b8063030b27301461016b578063050505d61461019e578063053c23f1146101b5578063078e6b33146101d557806310a1ea2b146101f55780631291e27814610222575b600080fd5b34801561017757600080fd5b5061018b610186366004614a62565b6104bd565b6040519081526020015b60405180910390f35b3480156101aa57600080fd5b506101b36104f4565b005b6101c86101c3366004614f66565b610558565b6040516101959190615091565b3480156101e157600080fd5b5061018b6101f036600461527f565b6108e5565b34801561020157600080fd5b506102156102103660046152b3565b6108f8565b6040516101959190615311565b34801561022e57600080fd5b506101b361023d36600461531f565b61090d565b34801561024e57600080fd5b5061026261025d366004615379565b610a21565b6040516001600160e01b03199091168152602001610195565b34801561028757600080fd5b506101b36102963660046153eb565b610ac5565b3480156102a757600080fd5b5061018b6102b63660046152b3565b610b9c565b3480156102c757600080fd5b506101b36102d636600461531f565b610baa565b3480156102e757600080fd5b506001600160821b015461018b565b34801561030257600080fd5b5061018b61031136600461545f565b6001600160a01b03166000908152600160821b602052604090205490565b6101b361033d36600461547c565b610c73565b34801561034e57600080fd5b506101b361035d366004615505565b610cee565b34801561036e57600080fd5b506101b361037d366004615553565b610d07565b34801561038e57600080fd5b506101b361039d366004615594565b610d45565b3480156103ae57600080fd5b506002600160821b015461018b565b3480156103c957600080fd5b506101b36103d83660046155e7565b610d7a565b3480156103e957600080fd5b506102156103f836600461527f565b610d90565b6101b361040b36600461547c565b610d9b565b34801561041c57600080fd5b5061043061042b36600461527f565b610dca565b6040516101959190615677565b34801561044957600080fd5b506101b361045836600461531f565b610e3d565b34801561046957600080fd5b506101b36104783660046156bc565b610e7d565b34801561048957600080fd5b5061018b6104983660046156f1565b610e89565b3480156104a957600080fd5b506101b36104b83660046157c2565b61122e565b6001600160a01b0382166000908152600560801b602090815260408083206001600160b81b03851684529091529020545b92915050565b336000908152600160821b602052604081208054829061051390615864565b918290555060408051338152602081018390529192507f4cf3e8a83c6bf8a510613208458629675b4ae99b8029e3ab6cb6a86e5f01fd3191015b60405180910390a150565b85518551606091908114801561056d57508085145b80156105795750835181145b6105c25760405162461bcd60e51b8152602060048201526015602482015274082a4a482b2be988a9c8ea890be9a92a69a82a8869605b1b60448201526064015b60405180910390fd5b806001600160401b038111156105da576105da614aa7565b604051908082528060200260200182016040528015610603578160200160208202803683370190505b5091506000610612344761587d565b9050600084156106d95760005b838110156106d3576106a48b828151811061063c5761063c615890565b60200260200101518b838151811061065657610656615890565b60200260200101518b8b8581811061067057610670615890565b9050602002016020810190610685919061545f565b8a858151811061069757610697615890565b60200260200101516113a0565b60018582815181106106b8576106b8615890565b9115156020928302919091019091015260019150810161061f565b5061086e565b60005b8381101561086c577f000000000000000000000000d163b423e76c996c4fd73a9dd51b08b0370677696001600160a01b031663689d44a160e01b8c838151811061072857610728615890565b60200260200101518c848151811061074257610742615890565b60200260200101518c8c8681811061075c5761075c615890565b9050602002016020810190610771919061545f565b8b868151811061078357610783615890565b602002602001015160405160240161079e94939291906159aa565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199094169390931790925290516107dc9190615a8e565b600060405180830381855af49150503d8060008114610817576040519150601f19603f3d011682016040523d82523d6000602084013e61081c565b606091505b505085828151811061083057610830615890565b6020026020010181151515158152505084818151811061085257610852615890565b60200260200101511561086457600191505b6001016106dc565b505b806108c55760405162461bcd60e51b815260206004820152602160248201527f62617463684275794552433732317345782f4e4f5f4f524445525f46494c4c456044820152601160fa1b60648201526084016105b9565b6108d8336108d3844761587d565b61143d565b5050509695505050505050565b60006104ee6108f3836114e6565b61150e565b6000610903826115eb565b6040015192915050565b306001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561094b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061096f9190615aaa565b6001600160a01b0316336001600160a01b0316146109bc5760405162461bcd60e51b815260206004820152600a60248201526927b7363c9037bbb732b960b11b60448201526064016105b9565b6002600160821b015481146109d6576002600160821b0155565b60405162461bcd60e51b815260206004820152601760248201527f4e6f207374617465206e65656420746f2062652073657400000000000000000060448201526064016105b9565b50565b600080808080610a3386880188615ac7565b93509350935093508360e001516001600160a01b0316336001600160a01b031614610aa05760405162461bcd60e51b815260206004820152601b60248201527f4552433732315f544f4b454e5f4d49534d415443485f4552524f52000000000060448201526064016105b9565b610aaf84848a858e30876116a0565b50630a85bd0160e11b9998505050505050505050565b60028251600a811115610ada57610ada6152e7565b1480610af8575060048251600a811115610af657610af66152e7565b145b80610b15575060068251600a811115610b1357610b136152e7565b145b80610b32575060088251600a811115610b3057610b306152e7565b145b80610b4f5750600a8251600a811115610b4d57610b4d6152e7565b145b15610b82576000610b6a6001610b64866114e6565b84611726565b509050610b7c81848660000151611864565b50505050565b610b97610b8e846108e5565b84518490611864565b505050565b60006104ee6108f383611d0e565b306001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610be8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0c9190615aaa565b6001600160a01b0316336001600160a01b031614610c595760405162461bcd60e51b815260206004820152600a60248201526927b7363c9037bbb732b960b11b60448201526064016105b9565b6001600160821b015481146109d6576001600160821b0155565b307f000000000000000000000000d163b423e76c996c4fd73a9dd51b08b0370677696001600160a01b031603610ce25760405162461bcd60e51b81526020600482015260146024820152734d5553545f43414c4c5f46524f4d5f50524f585960601b60448201526064016105b9565b610b7c848484846113a0565b610d03610cfa83610b9c565b83518390611864565b5050565b60005b81811015610b9757610d33838383818110610d2757610d27615890565b90506020020135610e3d565b80610d3d81615864565b915050610d0a565b610b977f000000000000000000000000d163b423e76c996c4fd73a9dd51b08b03706776963a880948560e01b80868686611d36565b610d89858585853333876116a0565b5050505050565b600061090382611eb6565b6000610da7344761587d565b9050610db5858585856113a0565b804714610d8957610d89336108d3834761587d565b610dd26149f3565b6000610ddd83611eb6565b9050806040015182602001906003811115610dfa57610dfa6152e7565b90816003811115610e0d57610e0d6152e7565b90525060808101516001600160801b03908116606080850191909152820151166040830152602001518152919050565b610e47338261204a565b60408051338152602081018390527fa015ad2dc32f266993958a0fd9884c746b971b254206f3478bc43e2f125c7b9e910161054d565b610d03610cfa836108e5565b60008560e001516001600160a01b03168760e001516001600160a01b031614610ef45760405162461bcd60e51b815260206004820152601b60248201527f4552433732315f544f4b454e5f4d49534d415443485f4552524f52000000000060448201526064016105b9565b6000610eff886115eb565b90506000610f0c88611eb6565b9050610f218988848b6000015160018a612093565b610f3a8887838c600001518d610100015160018a61229e565b80606001516001600160801b03168860a00151610f579190615b49565b60a0890152604089015160fc1c60011901610f7d57610f7d898960a00151600180612554565b60008960a001518960a00151610f93919061587d565b60e08b01518b518b516101008e0151939450610fae93612660565b60808a01516001600160a01b031673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14801561101357507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031689608001516001600160a01b0316145b156111315761104c7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28a60000151308c60a00151612783565b60a0890151604051632e1a7d4d60e01b815260048101919091527f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031690632e1a7d4d90602401600060405180830381600087803b1580156110b457600080fd5b505af11580156110c8573d6000803e3d6000fd5b505050506110de8a600001518b60a0015161143d565b6110fb6110ea8a612888565b8a51606085015160019060006128cf565b50600061110d8b3060018060016128cf565b9050611119818361587d565b9450841561112b5761112b338661143d565b50611202565b88608001516001600160a01b03168a608001516001600160a01b03161461119a5760405162461bcd60e51b815260206004820152601a60248201527f45524332305f544f4b454e5f4d49534d415443485f4552524f5200000000000060448201526064016105b9565b6111b689608001518a600001518c600001518d60a00151612783565b6111c26110ea8a612888565b5060006111d88b8b6000015160018060006128cf565b90506111e4818361587d565b94508415611200576112008a608001518b600001513388612783565b505b6112158a8a600001518560200151612b11565b6108d8898b600001518c61010001518560200151612cb6565b600261123d6020850185615b6b565b600a81111561124e5761124e6152e7565b1480611277575060046112646020850185615b6b565b600a811115611275576112756152e7565b145b8061129f5750600661128c6020850185615b6b565b600a81111561129d5761129d6152e7565b145b806112c7575060086112b46020850185615b6b565b600a8111156112c5576112c56152e7565b145b806112ef5750600a6112dc6020850185615b6b565b600a8111156112ed576112ed6152e7565b145b156113755760006113478161130b61130688615b86565b611d0e565b85858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061172692505050565b50905061136f8161135d36879003870187615b92565b61136a602089018961545f565b611864565b50610b7c565b610b7c6113846102b686615b86565b61139336869003860186615b92565b61136a602088018861545f565b306001600160a01b038316036113f85760405162461bcd60e51b815260206004820152601c60248201527f5f6275794552433732312f54414b45525f43414e4e4f545f53454c460000000060448201526064016105b9565b6001600160a01b03821661140a573391505b6000611415856115eb565b905061142685858360018787612e9d565b60a08601526020810151610d899086908590612b11565b8015610d03576000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611490576040519150601f19603f3d011682016040523d82523d6000602084013e611495565b606091505b5050905080610b975760405162461bcd60e51b815260206004820152601c60248201527f5f7472616e736665724574682f5452414e534645525f4641494c45440000000060448201526064016105b9565b80516001600160a01b03166000908152600160821b60205260408120546104ee908390612fb0565b604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f27b14c20196091d9cd90ca9c473d3ad1523b00ddf487a9b7452a8a119a16b98c918101919091527f06c015bd22b4c69690933c1058878ebdfef31f9aaae40bbe86d8a09fe1b2972c60608201524660808201523060a082015260009060c00160408051601f1981840301815290829052805160209182012061190160f01b918301919091526022820152604281018390526062015b604051602081830303815290604052805190602001209050919050565b6115f3614a1d565b6115fc82611d0e565b8082526116089061150e565b60208201526001606080830191909152825190830151611628919061303f565b1561164f576040810160025b90816003811115611647576116476152e7565b905250919050565b6001608082015260408201514260209190911c63ffffffff16111561167957604081016000611634565b42826040015163ffffffff161161169557604081016003611634565b604081016001611634565b60006116ab88611eb6565b90506117038888836040518060c0016040528060016001600160801b031681526020018b81526020018a15158152602001896001600160a01b03168152602001886001600160a01b0316815260200187815250613086565b8860a001818152505061171c8885888460200151612cb6565b5050505050505050565b602081018051600091606091600481901a91869162ffffff81169060e01c84611751576117516117cf565b8751818660051b0160200114611769576117696117cf565b602083018060005b878110156117bc5784811c6001168015611792576001811461179e576117a6565b878752825184526117a6565b825187528784525b5060408620965060209190910190600101611771565b50601f1901918252509450611803915050565b62461bcd60e51b600052600160e51b6020526f07aa30b5b2b92230ba309032b93937b960691b604052600060605260646000fd5b861561184b5761184461181583613279565b60408051602081019290925281018390526060016040516020818303038152906040528051906020012061150e565b935061185a565b61185761181583613284565b93505b5050935093915050565b60008251600a811115611879576118796152e7565b1480611897575060028251600a811115611895576118956152e7565b145b1561197b576001600160a01b0381166118e35760405162461bcd60e51b815260206004820152600e60248201526d24a72b20a624a22fa9a4a3a722a960911b60448201526064016105b9565b60208083015160408085015160608087015183516000815295860180855289905260ff9094169285019290925290830152608082015260019060a0016020604051602081039080840390855afa158015611941573d6000803e3d6000fd5b505050602060405103516001600160a01b0316816001600160a01b031614610b975760405162461bcd60e51b81526004016105b990615bae565b60038251600a811115611990576119906152e7565b14806119ae575060048251600a8111156119ac576119ac6152e7565b145b156119e8576119cc818484602001518560400151866060015161328f565b610b975760405162461bcd60e51b81526004016105b990615bae565b60058251600a8111156119fd576119fd6152e7565b1480611a1b575060068251600a811115611a1957611a196152e7565b145b15611aba576001600160821b0154600116611a785760405162461bcd60e51b815260206004820181905260248201527f457468657265756d506572736f6e616c5369676e2069732064697361626c656460448201526064016105b9565b6000611a83846132f9565b9050611a9e828285602001518660400151876060015161328f565b610b7c5760405162461bcd60e51b81526004016105b990615bae565b60078251600a811115611acf57611acf6152e7565b1480611aed575060088251600a811115611aeb57611aeb6152e7565b145b15611b55576001600160821b0154600216611b4a5760405162461bcd60e51b815260206004820152601f60248201527f426974636f696e506572736f6e616c5369676e2069732064697361626c65640060448201526064016105b9565b6000611a8384613314565b60098251600a811115611b6a57611b6a6152e7565b1480611b885750600a8251600a811115611b8657611b866152e7565b145b15611c16576001600160821b0154600416611bf05760405162461bcd60e51b815260206004820152602260248201527f426974636f696e506572736f6e616c5369676e3137332069732064697361626c604482015261195960f21b60648201526084016105b9565b6000611bfb84613314565b9050611a9e828285602001518660400151876060015161340f565b60018251600a811115611c2b57611c2b6152e7565b03611ccd576001600160a01b038116611c775760405162461bcd60e51b815260206004820152600e60248201526d24a72b20a624a22fa9a4a3a722a960911b60448201526064016105b9565b611c8183826134d8565b610b975760405162461bcd60e51b815260206004820152601860248201527f5052455349474e45445f494e56414c49445f5349474e4552000000000000000060448201526064016105b9565b60405162461bcd60e51b8152602060048201526016602482015275494e56414c49445f5349474e41545552455f5459504560501b60448201526064016105b9565b80516001600160a01b03166000908152600160821b60205260408120546104ee908390613528565b6000602083028401845b81811015611ddc578035860180356004811015611d6c578515611d6557611d65611df1565b5050611dd4565b6001600160e01b0319602083013516898103611dc3578a60005260048203602484016004376000808360008f5af415611dab5760019550505050611dd4565b8615611dbb573d6000803e3d6000fd5b505050611dd4565b5050508315611dd457611dd4611e2f565b602001611d40565b505080611deb57611deb611e70565b50611eae565b62461bcd60e51b600052600160e51b6020527c165f6d756c746943616c6c3a2064617461206572726f72000000000000604052600060605260646000fd5b62461bcd60e51b600052600160e51b6020527c1d5f6d756c746943616c6c3a2073656c6563746f72206d69736d617463604052600d60fb1b60605260646000fd5b62461bcd60e51b600052600160e51b6020527c1c5f6d756c746943616c6c3a20616c6c2063616c6c73206661696c6564604052600060605260646000fd5b505050505050565b611ebe614a1d565b611ec7826114e6565b808252611ed39061150e565b6020820152604082015160fc1c60071901611f9257604082810151811c63ffffffff166060830190815260208084015160009081526002600560801b0190915291909120549051611f2d916001600160801b031690615bd9565b6001600160801b0316608082018190521580611f565750611f568260000151836060015161303f565b15611f6657604081016002611634565b610100820151151580611f7d575061012082015151155b15611f8d57604081016000611634565b611fed565b6001606080830191909152825190830151611fad919061303f565b15611fbd57604081016002611634565b600160808201526101208201515115801590611fdd575061010082015115155b15611fed57604081016000611634565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b031682608001516001600160a01b03160361202957604081016000611634565b4260208360400151901c63ffffffff16111561167957604081016000611634565b6001600160a01b03919091166000908152600560801b602090815260408083206001600160b81b03600886901c16845290915290208054600160ff9093169290921b9091179055565b60208601516001600160a01b031615806120c25750826001600160a01b031686602001516001600160a01b0316145b61210a5760405162461bcd60e51b81526020600482015260196024820152782fbb30b634b230ba32a7b93232b917a7a7262cafaa20a5a2a960391b60448201526064016105b9565b600184604001516003811115612122576121226152e7565b1461216f5760405162461bcd60e51b815260206004820152601d60248201527f5f76616c69646174654f726465722f4f524445525f4e4f545f46494c4c00000060448201526064016105b9565b83608001516001600160801b0316826001600160801b031611156121a55760405162461bcd60e51b81526004016105b990615c00565b6121b486856020015184613596565b604086015160f81c6001908116036121d8576121d5846020015184836135a8565b90505b60028551600a8111156121ed576121ed6152e7565b148061220b575060048551600a811115612209576122096152e7565b145b80612228575060068551600a811115612226576122266152e7565b145b80612245575060088551600a811115612243576122436152e7565b145b806122625750600a8551600a811115612260576122606152e7565b145b1561228b5760006122796000866000015184611726565b509050611deb81878960000151611864565b611eae8460200151868860000151611864565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b031687608001516001600160a01b0316036123175760405162461bcd60e51b815260206004820152601d60248201527f5f76616c69646174654f726465722f544f4b454e5f4d49534d4154434800000060448201526064016105b9565b60208701516001600160a01b031615806123465750836001600160a01b031687602001516001600160a01b0316145b61238e5760405162461bcd60e51b81526020600482015260196024820152782fbb30b634b230ba32a7b93232b917a7a7262cafaa20a5a2a960391b60448201526064016105b9565b6001856040015160038111156123a6576123a66152e7565b146123f35760405162461bcd60e51b815260206004820152601d60248201527f5f76616c69646174654f726465722f4f524445525f4e4f545f46494c4c00000060448201526064016105b9565b84608001516001600160801b0316826001600160801b031611156124295760405162461bcd60e51b81526004016105b990615c00565b612438878660200151846137a2565b604087015160f81c60019081160361245c57612459856020015185836135a8565b90505b60028651600a811115612471576124716152e7565b148061248f575060048651600a81111561248d5761248d6152e7565b145b806124ac575060068651600a8111156124aa576124aa6152e7565b145b806124c9575060088651600a8111156124c7576124c76152e7565b145b806124e65750600a8651600a8111156124e4576124e46152e7565b145b15612528576000806124fe6001886000015185611726565b915091506125128988602001518784613808565b61252182898b60000151611864565b505061254b565b6125388786602001518584613808565b61254b8560200151878960000151611864565b50505050505050565b60006125658560c001518484613a08565b905060008560a00151826125799190615c47565b9050808514611eae57600061258e828761587d565b9050600082156126385760005b8860c0015151811015612636576000848a60c0015183815181106125c1576125c1615890565b602002602001015160200151856125d89190615c5a565b6125e29190615b49565b9050808a60c0015183815181106125fb576125fb615890565b60200260200101516020018181516126139190615c47565b9052506126208184615c47565b925050808061262e90615864565b91505061259b565b505b612642818361587d565b8860a0018181516126539190615c47565b9052505050505050505050565b836001600160a01b03163b6000036126ba5760405162461bcd60e51b815260206004820152601d60248201527f5f7472616e736665724552433732312f494e56414c49445f544f4b454e00000060448201526064016105b9565b60006040516001600160a01b0384166323b872dd60e01b82526001600160a01b038616600483015280602483015283604483015260008060648460008b5af115612731576331a9108f60e11b82528360048301526020826024848a5afa156127315760203d03612731578082510361273157600192505b505080600003610d895760405162461bcd60e51b815260206004820152601f60248201527f5f7472616e736665724552433732312f5452414e534645525f4641494c45440060448201526064016105b9565b8015610b7c57836001600160a01b03163b6000036127e35760405162461bcd60e51b815260206004820152601c60248201527f5f7472616e7366657245524332302f494e56414c49445f544f4b454e0000000060448201526064016105b9565b60006040516323b872dd60e01b81526001600160a01b03851660048201526001600160a01b038416602482015282604482015260208160648360008a5af191503d600182511460208210151681151783169250505080600003610d895760405162461bcd60e51b815260206004820152601e60248201527f5f7472616e7366657245524332302f5452414e534645525f4641494c4544000060448201526064016105b9565b604080516101208101825260008082526020820181905291810182905260608082018390526080820183905260a0820183905260c082015260e08101829052610100015290565b6000805b8660c0015151811015612b075760008760c0015182815181106128f8576128f8615890565b602002602001015190506000856001600160801b0316876001600160801b03161461294f57856001600160801b0316876001600160801b031683602001516129409190615c5a565b61294a9190615b49565b612955565b81602001515b9050841561296e578151612969908261143d565b612988565b801561298857612988896080015189846000015184612783565b60408201515115612af15781516001600160a01b03163b6000036129ee5760405162461bcd60e51b815260206004820152601e60248201527f5f706179466565732f494e56414c49445f4645455f524543495049454e54000060448201526064016105b9565b81516000906001600160a01b03166330787dd187612a10578b60800151612a26565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee5b8486604001516040518463ffffffff1660e01b8152600401612a4a93929190615c71565b6020604051808303816000875af1158015612a69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a8d9190615ca1565b90506001600160e01b031981166330787dd160e01b14612aef5760405162461bcd60e51b815260206004820152601860248201527f5f706179466565732f43414c4c4241434b5f4641494c4544000000000000000060448201526064016105b9565b505b612afb8185615c47565b935050506001016128d3565b5095945050505050565b60008360c00151516001600160401b03811115612b3057612b30614aa7565b604051908082528060200260200182016040528015612b7557816020015b6040805180820190915260008082526020820152815260200190600190039081612b4e5790505b50905060005b8151811015612c4f578460c001518181518110612b9a57612b9a615890565b602002602001015160000151828281518110612bb857612bb8615890565b60209081029190910101516001600160a01b03909116905260c0850151805182908110612be757612be7615890565b602002602001015160200151828281518110612c0557612c05615890565b60200260200101516020018181525050818181518110612c2757612c27615890565b6020026020010151602001518560a001818151612c449190615c47565b905250600101612b7b565b507f9c248aa1a265aa616f707b979d57f4529bb63a4fc34dc7fc61fdddc18410f74e82856000015185876060015188608001518960a00151878b60e001518c6101000151604051612ca899989796959493929190615ccb565b60405180910390a150505050565b6000600860fc8660400151901c14612ccf576001612cdf565b60408560400151901c63ffffffff165b905060008560c00151516001600160401b03811115612d0057612d00614aa7565b604051908082528060200260200182016040528015612d4557816020015b6040805180820190915260008082526020820152815260200190600190039081612d1e5790505b50905060005b8151811015612e39578660c001518181518110612d6a57612d6a615890565b602002602001015160000151828281518110612d8857612d88615890565b6020026020010151600001906001600160a01b031690816001600160a01b031681525050828760c001518281518110612dc357612dc3615890565b60200260200101516020015181612ddc57612ddc615b33565b04828281518110612def57612def615890565b60200260200101516020018181525050818181518110612e1157612e11615890565b6020026020010151602001518760a001818151612e2e9190615c47565b905250600101612d4b565b507fd90a5c60975c6ff8eafcf02088e7b50ae5d9e156a79206ba553df1c4fb4594c28387600001518789606001518a608001518b60a00151878d60e001518c604051612e8d99989796959493929190615ccb565b60405180910390a1505050505050565b6000612ead878787868887612093565b84606001516001600160801b0316846001600160801b031614612efe57612ef9846001600160801b03168860a00151612ee69190615c5a565b86606001516001600160801b0316613ac6565b612f04565b8660a001515b9050612f298760e001518860000151858a6101000151886001600160801b0316613ae9565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b031687608001516001600160a01b031603612f7e578651612f66908261143d565b612f78873086886060015160016128cf565b50612fa6565b612f92876080015133896000015184612783565b612fa4873386886060015160006128cf565b505b9695505050505050565b600080612fc1846101200151613af5565b90506000612fd28560c00151613d37565b90506020851015612fdf57fe5b601f198501805160c087018051610120890180516101408b0180517fa525d336300f566329800fcbe82fd263226dc27d6c109f060d9a4a364281521c88529785529782528988526101808620949095529152919091529152905092915050565b6001600160a01b03919091166000908152600560801b60209081526040808320600885901c6001600160b81b03168452909152902054600160ff9092169190911b16151590565b60006130a78585858560600151866020015187600001518860a0015161229e565b82606001516001600160801b031682600001516001600160801b0316146131025782606001516001600160801b031682600001516001600160801b03168660a001516130f39190615c5a565b6130fd9190615b49565b613108565b8460a001515b90508160400151801561315057507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031685608001516001600160a01b0316145b15613212576131857f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc286600001513084612783565b604051632e1a7d4d60e01b8152600481018290527f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031690632e1a7d4d90602401600060405180830381600087803b1580156131e757600080fd5b505af11580156131fb573d6000803e3d6000fd5b5050505061320d82606001518261143d565b61322a565b61322a85608001518660000151846060015184612783565b6132548560e0015183608001518760000151856020015186600001516001600160801b0316613ae9565b61327061326086612888565b86518451606087015160006128cf565b50949350505050565b60006104ee82613f46565b60006104ee8261441f565b600080863b15612fa657604051631626ba7e8152866020820152604080820152604160608201528460808201528360a08201528560f81b60c082015260208160a5601c84018b5afa15612fa457630b135d3f60e11b815103612fa457506001979650505050505050565b6000613304826148f8565b6040516020016115ce9190615d7a565b6000806002613322846148f8565b6040516020016133329190615de5565b60408051601f198184030181529082905261334c91615a8e565b602060405180830381855afa158015613369573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061338c9190615e50565b604080516020808252818301909252919250600091906020820181803683370190505090508160208201526002816040516133c79190615a8e565b602060405180830381855afa1580156133e4573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906134079190615e50565b949350505050565b600080863b1561344857604051638da5cb5b81526020816004601c84018b5afa1561344657600160a01b8151101561344657805191505b505b6001600160a01b038116158015906134cd575060408051600081526020810180835288905260ff871691810191909152606081018590526080810184905260019060a0016020604051602081039080840390855afa1580156134ae573d6000803e3d6000fd5b505050602060405103516001600160a01b0316816001600160a01b0316145b979650505050505050565b6001600160a01b0381166000908152600160821b60205260408120546134ff906001615c47565b600093845270050000000000000000000000000000000160205260409093205490921492915050565b6000806135388460c00151613d37565b9050602084101561354557fe5b601f198401805160c08601805161012090970180517fed676c7f3e8232a311454799b1cf26e75b4abc90c9bf06c9f7e8e79fcc7fe14d85529482529586526101608320919092529490529091525090565b610b978360000151846060015161204a565b805160609060458110156135f75760405162461bcd60e51b815260206004820152601660248201527527b930b1b6329039b4b3b730ba3ab9329032b93937b960511b60448201526064016105b9565b60006136116002600160821b01546001600160a01b031690565b90506001600160a01b03811661363457506044190160458301908152905061379b565b600484015160248501516044860151604587018051604080514681523060208201529081018c9052606081018b905263ffffffff9095166080860181905260a09095206044198801835291975060ff1693904282116136d55760405162461bcd60e51b815260206004820152601760248201527f4f7261636c6520646561646c696e65207265616368656400000000000000000060448201526064016105b9565b60408051600081526020810180835283905260ff87169181019190915260608101859052608081018490526001600160a01b0387169060019060a0016020604051602081039080840390855afa158015613733573d6000803e3d6000fd5b505050602060405103516001600160a01b0316146137935760405162461bcd60e51b815260206004820152601860248201527f496e76616c6964206f7261636c65207369676e6174757265000000000000000060448201526064016105b9565b505050505050505b9392505050565b600860fc8460400151901c036135965760008281526002600560801b016020526040812080548392906137df9084906001600160801b0316615e69565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550505050565b8361012001515160000361386f57836101000151821461386a5760405162461bcd60e51b815260206004820181905260248201527f5f76616c696461746550726f706572746965732f544f4b454e5f49445f45525260448201526064016105b9565b610b7c565b60005b84610120015151811015610d89576000856101200151828151811061389957613899615890565b6020026020010151905060006001600160a01b031681600001516001600160a01b0316146139ff5780516001600160a01b03163b60000361391c5760405162461bcd60e51b815260206004820152601a60248201527f494e56414c49445f50524f50455254595f56414c494441544f5200000000000060448201526064016105b9565b805160e0870151602083015160405163779fc9b560e11b81526000936001600160a01b03169263ef3f936a9261395a928a918c918b90600401615e89565b602060405180830381865afa158015613977573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061399b9190615ca1565b90506001600160e01b0319811663779fc9b560e11b146139fd5760405162461bcd60e51b815260206004820152601a60248201527f50524f50455254595f56414c49444154494f4e5f4641494c454400000000000060448201526064016105b9565b505b50600101613872565b6000818303613a605760005b8451811015613a5a57848181518110613a2f57613a2f615890565b60200260200101516020015182613a469190615c47565b915080613a5281615864565b915050613a14565b5061379b565b60005b8451811015613abe578284868381518110613a8057613a80615890565b602002602001015160200151613a969190615c5a565b613aa09190615b49565b613aaa9083615c47565b915080613ab681615864565b915050613a63565b509392505050565b6000816001613ad58286615c47565b613adf919061587d565b61379b9190615b49565b610d8985858585612660565b8051600090808203613b29577fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4709150613d31565b80600103613bff57600083600081518110613b4657613b46615890565b6020026020010151905060006001600160a01b031681600001516001600160a01b0316148015613b795750602081015151155b15613ba6577f720ee400a9024f6a49768142c339bf09d2dd9056ab52d20fbe7165faba6e142d9250613bf9565b602080820151805190820120604080517f6292cf854241cb36887e639065eca63b3af9f7f70270cebeda4c29b6d3bc65e8815284516001600160a01b031681850152908101919091526060812081522092505b50613d31565b6000816001600160401b03811115613c1957613c19614aa7565b604051908082528060200260200182016040528015613c42578160200160208202803683370190505b50905060005b82811015613d25577f6292cf854241cb36887e639065eca63b3af9f7f70270cebeda4c29b6d3bc65e8858281518110613c8357613c83615890565b602002602001015160000151868381518110613ca157613ca1615890565b60200260200101516020015180519060200120604051602001613ce0939291909283526001600160a01b03919091166020830152604082015260600190565b60405160208183030381529060405280519060200120828281518110613d0857613d08615890565b602090810291909101015280613d1d81615864565b915050613c48565b50602082810291012091505b50919050565b8051600090808203613d6b577fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4709150613d31565b80600103613dfc57600083600081518110613d8857613d88615890565b60200260200101519050600081604001518051906020012090506040517fe68c29f1b4e8cce0bbcac76eb1334bdc1dc1f293a517c90e9e532340e1e94115815282516001600160a01b0316602082015260208301516040820152816060820152608081208152602081209450505050613d31565b6000816001600160401b03811115613e1657613e16614aa7565b604051908082528060200260200182016040528015613e3f578160200160208202803683370190505b50905060005b82811015613d25577fe68c29f1b4e8cce0bbcac76eb1334bdc1dc1f293a517c90e9e532340e1e94115858281518110613e8057613e80615890565b602002602001015160000151868381518110613e9e57613e9e615890565b602002602001015160200151878481518110613ebc57613ebc615890565b60200260200101516040015180519060200120604051602001613f0194939291909384526001600160a01b039290921660208401526040830152606082015260800190565b60405160208183030381529060405280519060200120828281518110613f2957613f29615890565b602090810291909101015280613f3e81615864565b915050613e45565b6000600782101561406b5781600203613f8057507f9f75ca91e1048cc22959b86e890a322468993b0042056da157f2b412c6448a67919050565b81600303613faf57507f0b9237358bc0780db84404e8ac4354d9f65ad89d2f69ee36feef85323cc50e56919050565b81600403613fde57507f1d7449e626c1883d0a685a1eda892c4ebbec2fee5314d96df22ec6075af7e6da919050565b8160050361400d57507f3bd53d6120daeed6dfbe380dea0375dc8998073981bdb5b77d06c322e9f2d647919050565b8160010361403c57507fb32e6b07ca7f956efdb96d28fed6462c6d478d4f66692a6773741b404ff85f74919050565b8160060361406b57507f5ee31cf4765667f4d0fb661820bbfe26e1583a3035f58a2fa02f1bba4e6fbd6c919050565b600d82101561418e57816007036140a357507fb608f4e4a9cd3cfd2c8cfccdad26888534996b0ae42be788464d9f617736ca9a919050565b816008036140d257507f46b6148f58b19871db49b6f83360c40fa5c1245310a5a68a58ebd575aa83ed13919050565b8160090361410157507fa8a9bda09e5a02cacb2dead999ab5f3a42c31378575a118d3610c7fcd0f5f589919050565b81600a0361413057507f104d0c688b877378c48931b8ab8d4cd40b91a284864372a291f5f0781080320a919050565b81600b0361415f57507f566bb180c8b6c356458ac8ac2b1f94a344f13ad2cab2a0368fb5e0f63995271c919050565b81600c0361418e57507fea284288a7b9efcb7bfa8960c9fee47e83a928c769634a8ccd84de1f04ab5cca919050565b60138210156142b15781600d036141c657507f07f743265e8e61a1b890adf806926567cc011ebdfa491d5accc08a0c353056f2919050565b81600e036141f557507f3cb41bc57327bfc80e77688d75fd37ae8d661f2d347e724e8f5e417022f9796f919050565b81600f0361422457507fc79245b07759ae6288019cddb41b3cf90ca8ee2f5c8339d99b111efc6544a867919050565b8160100361425357507facd68817a805cfc3b06f56b3bbb5fcbdf8e945abd065de4c81c580533f7a600a919050565b8160110361428257507fd57701e882860956e3f7872db1e179d6b8fc8e13a5398bb6af893a5e42e77839919050565b816012036142b157507f2f3ed58d4e1d0a4c76f70032ee82f302118bfbadf3b0c39721868115a2bb020b919050565b816013036142e057507f185fae4db124d03654cdc4beefd2f59ae93e9cc2f04eda3d86eefc6ad69fb653919050565b8160140361430f57507f8284117e9b7752fa6a09985a8ad343a0f36e4399dc23841b852b06f61c494944919050565b8160150361433e57507f4645af7b9f125b178e9090156cc187c311456985f773afde066dad652981a8db919050565b8160160361436d57507f15c4e80ebf08449122359b63924db2ae4aefad40b75bef4b6a4325cf2f72ce9c919050565b8160170361439c57507fa18f3d5fd85a19d6b8db5ebd2d5e31db3fb730b2d30a046b473c0137a2fc8056919050565b816018036143cb57507f637175f391c9fa3e7d2456fc5f4d663cb628d453586604ba35d7a0f2d89f958b919050565b60405162461bcd60e51b815260206004820152602360248201527f67657442756c6b4552433732314275794f7264657254797065486173682065726044820152623937b960e91b60648201526084016105b9565b60006007821015614544578160020361445957507fbe8fa00d5b6a4c861c69d133d99ca46b741eb30c6909efbec15c237de29df561919050565b8160030361448857507fa4e6352852d88baa542528c5d7dd37687543ba5b2ee63f207a5e03fe4544415e919050565b816004036144b757507f65ba80d235ecf7aec7cb17b9ba7cae23869c6f5338039d07c01170985202f1fb919050565b816005036144e657507fb187dd134be01439b73639695a8858e0f1a24e73eb2b2a4cb0720b4dbda5ffd9919050565b8160010361451557507fd34f03762ce1f357d7a826ecb4627841b188c269566aeb2a73e284d84cd78912919050565b8160060361454457507f698d310ab6eafea7429fc10c1541820159abd99d4f97b0ac55a280c6fa034862919050565b600d821015614667578160070361457c57507f7d140482f96d81136b0473b9da1642229f2ace5516157987dd911fd86933752e919050565b816008036145ab57507f43ddc7bd2b79f0fce3d28ffe218973cdfc75db4d262dc7e68e78c43ddb2139d5919050565b816009036145da57507fb2bb85f1bb297265004ee4385dfaa05cfc37266a01321161d983471d7e59d6f3919050565b81600a0361460957507fa3796aeaba14ca1c62562b30874fa4418b6b722d3092259608f09eeba1df16e8919050565b81600b0361463857507f3c9e717430c9ada5e01143f5e8a7c4a9285b0a8b818ae99cb471f764b6e432ea919050565b81600c0361466757507f42a852d8385b94b31ae1f6c15cf66b195eafe58bf051f8a16c803876f55da687919050565b601382101561478a5781600d0361469f57507fb793175426ec3a64dfc1ec27ca103f2368b0117fc08c4bbb1fa3b6ad133c2934919050565b81600e036146ce57507f4ccffbfa05cf55a8156a9a2d539974bc99a792b040f07f8bcb9da8a8c50496b1919050565b81600f036146fd57507fb19809e8a69fb92b9b3d5dcf8ed27878cebc770f6c81f317d4092f1d6ef38804919050565b8160100361472c57507fa09a903f341da4dd111eff50adb9c12edb83525d28f67eca2891dddbdba73659919050565b8160110361475b57507f9891e291bb672c5a78451aee982906c1cce43e4e5bc7397770c58fc4decd9039919050565b8160120361478a57507fd7c0b9608ad661aa8a552e080abdbeb17b5d35a0c523f385f3b6575823940ef5919050565b816013036147b957507f8576b675cd395ceb837f22d2a7ecaa6de131eb69b16f017cee7c562896099bc0919050565b816014036147e857507f23b44e24d7f76cbaf701cc1e9f071db3bdb8a724bbcb88b18f8c5694b082dd9f919050565b8160150361481757507fc9ee72afde7c567fd7341fe62b02bca4ccf8705bcf6aac1e68ad25eed57fb755919050565b8160160361484657507fa3dd9c0bf81fb4bfb232fe287cf1f5ce8561446f2f2319231bc4db0b3a2441c8919050565b8160170361487557507f5309812ac587bdacbfd514f846f4bba837fe11edf3d82ec3338af8877192ffcd919050565b816018036148a457507f5379dceee9dc69ff1c99801b6c20a1933258d5e57119464510dff80bf19b529c919050565b60405162461bcd60e51b8152602060048201526024808201527f67657442756c6b45524337323153656c6c4f7264657254797065486173682065604482015263393937b960e11b60648201526084016105b9565b60408051604280825260808201909252606091839190602082018180368337019050509150600360fc1b8260008151811061493557614935615890565b60200101906001600160f81b031916908160001a905350600f60fb1b8260018151811061496457614964615890565b60200101906001600160f81b031916908160001a90535060415b60018111156149ec576f181899199a1a9b1b9c1cb0b131b232b360811b82600f16601081106149af576149af615890565b1a60f81b8382815181106149c5576149c5615890565b60200101906001600160f81b031916908160001a90535060049190911c906000190161497e565b5050919050565b6040805160808101909152600080825260208201905b815260006020820181905260409091015290565b6040805160a0810182526000808252602082018190529091820190614a09565b6001600160a01b0381168114610a1e57600080fd5b8035614a5d81614a3d565b919050565b60008060408385031215614a7557600080fd5b8235614a8081614a3d565b915060208301356001600160f81b0381168114614a9c57600080fd5b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b604051606081016001600160401b0381118282101715614adf57614adf614aa7565b60405290565b60405161012081016001600160401b0381118282101715614adf57614adf614aa7565b604080519081016001600160401b0381118282101715614adf57614adf614aa7565b60405161014081016001600160401b0381118282101715614adf57614adf614aa7565b604051601f8201601f191681016001600160401b0381118282101715614b7557614b75614aa7565b604052919050565b60006001600160401b03821115614b9657614b96614aa7565b5060051b60200190565b600082601f830112614bb157600080fd5b81356001600160401b03811115614bca57614bca614aa7565b614bdd601f8201601f1916602001614b4d565b818152846020838601011115614bf257600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f830112614c2057600080fd5b81356020614c35614c3083614b7d565b614b4d565b82815260059290921b84018101918181019086841115614c5457600080fd5b8286015b84811015612fa45780356001600160401b0380821115614c785760008081fd5b908801906060828b03601f1901811315614c925760008081fd5b614c9a614abd565b87840135614ca781614a3d565b815260408481013589830152918401359183831115614cc65760008081fd5b614cd48d8a85880101614ba0565b908201528652505050918301918301614c58565b60006101208284031215614cfb57600080fd5b614d03614ae5565b9050614d0e82614a52565b8152614d1c60208301614a52565b60208201526040820135604082015260608201356060820152614d4160808301614a52565b608082015260a082013560a082015260c08201356001600160401b03811115614d6957600080fd5b614d7584828501614c0f565b60c083015250614d8760e08301614a52565b60e082015261010080830135818301525092915050565b8035600b8110614a5d57600080fd5b600060808284031215614dbf57600080fd5b604051608081018181106001600160401b0382111715614de157614de1614aa7565b604052905080614df083614d9e565b8152602083013560ff81168114614e0657600080fd5b8060208301525060408301356040820152606083013560608201525092915050565b600082601f830112614e3957600080fd5b81356020614e49614c3083614b7d565b82815260079290921b84018101918181019086841115614e6857600080fd5b8286015b84811015612fa457614e7e8882614dad565b835291830191608001614e6c565b60008083601f840112614e9e57600080fd5b5081356001600160401b03811115614eb557600080fd5b6020830191508360208260051b8501011115614ed057600080fd5b9250929050565b600082601f830112614ee857600080fd5b81356020614ef8614c3083614b7d565b82815260059290921b84018101918181019086841115614f1757600080fd5b8286015b84811015612fa45780356001600160401b03811115614f3a5760008081fd5b614f488986838b0101614ba0565b845250918301918301614f1b565b80358015158114614a5d57600080fd5b60008060008060008060a08789031215614f7f57600080fd5b6001600160401b038088351115614f9557600080fd5b8735880189601f820112614fa857600080fd5b80356020614fb8614c3083614b7d565b82815260059290921b8301810191818101908d841115614fd757600080fd5b8285015b8481101561500d578681351115614ff157600080fd5b6150008f858335890101614ce8565b8352918301918301614fdb565b509a50508a01359150508181111561502457600080fd5b6150308a828b01614e28565b96505060408801358181111561504557600080fd5b6150518a828b01614e8c565b90965094505060608801358181111561506957600080fd5b6150758a828b01614ed7565b9350505061508560808801614f56565b90509295509295509295565b6020808252825182820181905260009190848201906040850190845b818110156150cb5783511515835292840192918401916001016150ad565b50909695505050505050565b600082601f8301126150e857600080fd5b813560206150f8614c3083614b7d565b82815260059290921b8401810191818101908684111561511757600080fd5b8286015b84811015612fa45780356001600160401b038082111561513b5760008081fd5b908801906040828b03601f19018113156151555760008081fd5b61515d614b08565b8784013561516a81614a3d565b815290830135908282111561517f5760008081fd5b61518d8c8984870101614ba0565b81890152865250505091830191830161511b565b600061014082840312156151b457600080fd5b6151bc614b2a565b90506151c782614a52565b81526151d560208301614a52565b602082015260408201356040820152606082013560608201526151fa60808301614a52565b608082015260a082013560a082015260c08201356001600160401b038082111561522357600080fd5b61522f85838601614c0f565b60c084015261524060e08501614a52565b60e084015261010084810135908401526101209150818401358181111561526657600080fd5b615272868287016150d7565b8385015250505092915050565b60006020828403121561529157600080fd5b81356001600160401b038111156152a757600080fd5b613407848285016151a1565b6000602082840312156152c557600080fd5b81356001600160401b038111156152db57600080fd5b61340784828501614ce8565b634e487b7160e01b600052602160045260246000fd5b6004811061530d5761530d6152e7565b9052565b602081016104ee82846152fd565b60006020828403121561533157600080fd5b5035919050565b60008083601f84011261534a57600080fd5b5081356001600160401b0381111561536157600080fd5b602083019150836020828501011115614ed057600080fd5b60008060008060006080868803121561539157600080fd5b853561539c81614a3d565b945060208601356153ac81614a3d565b93506040860135925060608601356001600160401b038111156153ce57600080fd5b6153da88828901615338565b969995985093965092949392505050565b600080600060c0848603121561540057600080fd5b83356001600160401b038082111561541757600080fd5b615423878388016151a1565b94506154328760208801614dad565b935060a086013591508082111561544857600080fd5b5061545586828701614ba0565b9150509250925092565b60006020828403121561547157600080fd5b813561379b81614a3d565b60008060008060e0858703121561549257600080fd5b84356001600160401b03808211156154a957600080fd5b6154b588838901614ce8565b95506154c48860208901614dad565b945060a087013591506154d682614a3d565b90925060c086013590808211156154ec57600080fd5b506154f987828801614ba0565b91505092959194509250565b60008060a0838503121561551857600080fd5b82356001600160401b0381111561552e57600080fd5b61553a85828601614ce8565b92505061554a8460208501614dad565b90509250929050565b6000806020838503121561556657600080fd5b82356001600160401b0381111561557c57600080fd5b61558885828601614e8c565b90969095509350505050565b6000806000604084860312156155a957600080fd5b83356001600160401b038111156155bf57600080fd5b6155cb86828701614e8c565b90945092506155de905060208501614f56565b90509250925092565b6000806000806000610100868803121561560057600080fd5b85356001600160401b038082111561561757600080fd5b61562389838a016151a1565b96506156328960208a01614dad565b955060a0880135945061564760c08901614f56565b935060e088013591508082111561565d57600080fd5b5061566a88828901614ba0565b9150509295509295909350565b815181526020808301516080830191615692908401826152fd565b5060408301516001600160801b038082166040850152806060860151166060850152505092915050565b60008060a083850312156156cf57600080fd5b82356001600160401b038111156156e557600080fd5b61553a858286016151a1565b600080600080600080610180878903121561570b57600080fd5b86356001600160401b038082111561572257600080fd5b61572e8a838b01614ce8565b9750602089013591508082111561574457600080fd5b6157508a838b016151a1565b965061575f8a60408b01614dad565b955061576e8a60c08b01614dad565b945061014089013591508082111561578557600080fd5b6157918a838b01614ba0565b93506101608901359150808211156157a857600080fd5b506157b589828a01614ba0565b9150509295509295509295565b60008060008084860360c08112156157d957600080fd5b85356001600160401b03808211156157f057600080fd5b90870190610120828a03121561580557600080fd5b8196506080601f198401121561581a57600080fd5b60208801955060a088013592508083111561583457600080fd5b505061584287828801615338565b95989497509550505050565b634e487b7160e01b600052601160045260246000fd5b6000600182016158765761587661584e565b5060010190565b818103818111156104ee576104ee61584e565b634e487b7160e01b600052603260045260246000fd5b60005b838110156158c15781810151838201526020016158a9565b50506000910152565b600081518084526158e28160208601602086016158a6565b601f01601f19169290920160200192915050565b600081518084526020808501808196508360051b8101915082860160005b85811015615967578284038952815180516001600160a01b031685528581015186860152604090810151606091860182905290615953818701836158ca565b9a87019a9550505090840190600101615914565b5091979650505050505050565b8051600b8110615986576159866152e7565b825260208181015160ff169083015260408082015190830152606090810151910152565b60e081526159c460e0820186516001600160a01b03169052565b600060208601516101006159e2818501836001600160a01b03169052565b604088015161012085810191909152606089015161014086015260808901516001600160a01b031661016086015260a089015161018086015260c08901516101a08601919091529150615a396102008501836158f6565b915060e0880151615a566101c08601826001600160a01b03169052565b508701516101e0840152615a6d6020840187615974565b6001600160a01b03851660a084015282810360c08401526134cd81856158ca565b60008251615aa08184602087016158a6565b9190910192915050565b600060208284031215615abc57600080fd5b815161379b81614a3d565b60008060008060e08587031215615add57600080fd5b84356001600160401b0380821115615af457600080fd5b615b00888389016151a1565b9550615b0f8860208901614dad565b9450615b1d60a08801614f56565b935060c08701359150808211156154ec57600080fd5b634e487b7160e01b600052601260045260246000fd5b600082615b6657634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215615b7d57600080fd5b61379b82614d9e565b60006104ee3683614ce8565b600060808284031215615ba457600080fd5b61379b8383614dad565b602080825260119082015270494e56414c49445f5349474e415455524560781b604082015260600190565b6001600160801b03828116828216039080821115615bf957615bf961584e565b5092915050565b60208082526027908201527f5f76616c69646174654f726465722f455843454544535f52454d41494e494e4760408201526617d05353d5539560ca1b606082015260800190565b808201808211156104ee576104ee61584e565b80820281158282048414176104ee576104ee61584e565b60018060a01b0384168152826020820152606060408201526000615c9860608301846158ca565b95945050505050565b600060208284031215615cb357600080fd5b81516001600160e01b03198116811461379b57600080fd5b60006101208083018c8452602060018060a01b03808e16828701526040818e16818801528c6060880152818c1660808801528a60a08801528460c0880152839450895180855261014088019550838b01945060005b81811015615d47578551805185168852850151858801529582019594840194600101615d20565b5050506001600160a01b03881660e087015250919250615d65915050565b826101008301529a9950505050505050505050565b7f19457468657265756d205369676e6564204d6573736167653a0a313031456c6581527f6d656e742e6d61726b6574206c697374696e672f6f6666657220686173683a0a602082015260008251615dd88160408501602087016158a6565b9190910160400192915050565b7f18426974636f696e205369676e6564204d6573736167653a0a65456c656d656e81527f742e6d61726b6574206c697374696e672f6f6666657220686173683a0a000000602082015260008251615e4381603d8501602087016158a6565b91909101603d0192915050565b600060208284031215615e6257600080fd5b5051919050565b6001600160801b03818116838216019080821115615bf957615bf961584e565b60018060a01b038616815284602082015283604082015260a060608201526000615eb660a08301856158ca565b8281036080840152615ec881856158ca565b9897505050505050505056fea26469706673582212204356ed8f700975f3ad79a8110d0106f4d5077c5d3d53b79b4fc33ae2e685b25b64736f6c63430008110033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
-----Decoded View---------------
Arg [0] : weth (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ 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.