Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- ExchangeV3
- Optimization enabled
- true
- Compiler version
- v0.8.19+commit.7dd6d404
- Optimization runs
- 200
- EVM Version
- default
- Verified at
- 2024-05-02T02:36:26.479458Z
Constructor Arguments
0x000000000000000000000000307e7a9713dbf6f19a2d2a2b670544f4791c4ec2
Arg [0] (address) : 0x307e7a9713dbf6f19a2d2a2b670544f4791c4ec2
contracts/sbinft/market/v3/exchange/ExchangeV3.sol
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.19; import "@sbinft/contracts/upgradeable/access/AdminUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/interfaces/IERC165Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/metatx/ERC2771ContextUpgradeable.sol"; import {EIP712Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/draft-EIP712Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "contracts/sbinft/market/v1/interface/IPlatformRegistry.sol"; import "contracts/sbinft/market/v1/interface/ITransferProxy.sol"; import "contracts/sbinft/market/v1/interface/IRoyaltyRegistry.sol"; import "contracts/sbinft/market/v3/interface/IExchangeV3.sol"; /** * @dev SBINFT Exchange 2.0 * @author SBINFT Co., Ltd. */ contract ExchangeV3 is Initializable, IExchangeV3, EIP712Upgradeable, ERC2771ContextUpgradeable, AdminUpgradeable, ERC165Upgradeable, ReentrancyGuardUpgradeable, PausableUpgradeable, UUPSUpgradeable { using ECDSAUpgradeable for bytes32; // Fired when PlatformRegistry is changed event PlatformRegistryUpdated(IPlatformRegistry indexed platformRegistry); // PlatformRegistry holds platform related info IPlatformRegistry public platformRegistry; // Fired when TransferProxy is changed event TransferProxyUpdated(ITransferProxy indexed transferProxy); // Holds access rights for on-chain asset transfer. // Must be pre approved for the respective asset ITransferProxy public transferProxy; // Fired when RoyaltyRegistry is changed event RoyaltyRegistryUpdated(IRoyaltyRegistry indexed royaltyRegistry); // RoyaltyRegistry holds Royalty info IRoyaltyRegistry public royaltyRegistry; // Map of SaleOrderHash => soldCount // Instead of soldCount being uint256 it can be bool but using uint256 inorder to support ERC1155 later mapping(bytes32 => uint256) internal _saleProgress; // Tip related struct ERC20Tip { address tipper; uint256 amount; } mapping(address => ERC20Tip[]) internal _erc20TipDeposite; // Just a temp variable to be used as local function variable // as mapping declaration is not supported inside function mapping(address => uint256) internal _tempPayoutAmount; address[] internal _tempPayoutAddress; /// @custom:oz-upgrades-unsafe-allow constructor constructor( address trustedForwarder ) ERC2771ContextUpgradeable(trustedForwarder) { _disableInitializers(); } /** * @dev See {UUPSUpgradeable._authorizeUpgrade()} * * Requirements: * - onlyAdmin can call */ function _authorizeUpgrade( address _newImplementation ) internal virtual override onlyAdmin {} /** * @dev See {IERC165Upgradeable-supportsInterface}. * * @param _interfaceId bytes4 */ function supportsInterface( bytes4 _interfaceId ) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) { return _interfaceId == type(IExchangeV3).interfaceId || super.supportsInterface(_interfaceId); } /** * See {ERC2771ContextUpgradeable._msgSender()} */ function _msgSender() internal view virtual override(ContextUpgradeable, ERC2771ContextUpgradeable) returns (address sender) { return ERC2771ContextUpgradeable._msgSender(); } /** * See {ERC2771ContextUpgradeable._msgData()} */ function _msgData() internal view virtual override(ContextUpgradeable, ERC2771ContextUpgradeable) returns (bytes calldata) { return ERC2771ContextUpgradeable._msgData(); } /** * @dev See {PausableUpgradeable._pause()} * * Requirements: * - onlyAdmin can call */ function pause() external virtual onlyAdmin { PausableUpgradeable._pause(); } /** * @dev See {PausableUpgradeable._unpause()} * * Requirements: * - onlyAdmin can call */ function unpause() external virtual onlyAdmin { PausableUpgradeable._unpause(); } /** * @dev Update to new PlatformRegistry * * @param _newPlatformRegistry new PlatformRegistry * * Requirements: * - _newPlatformRegistry must be a contract and must support IPlatformRegistry * * Emits a {PlatformRegistryUpdated} event */ function updatePlatformRegistry( IPlatformRegistry _newPlatformRegistry ) public virtual onlyAdmin { // EM: IPlatformRegistry interface not supported require( IPlatformRegistry(_newPlatformRegistry).supportsInterface( type(IPlatformRegistry).interfaceId ), "E_INS" ); platformRegistry = _newPlatformRegistry; emit PlatformRegistryUpdated(_newPlatformRegistry); } /** * @dev Update to new TransferProxy * * @param _newTransferProxy new TransferProxy * * Requirements: * - _newTransferProxy must be a contract and must support ITransferProxy * * Emits a {TransferProxyUpdated} event */ function updateTransferProxy( ITransferProxy _newTransferProxy ) public virtual onlyAdmin { // EM: ITransferProxy interface not supported require( ITransferProxy(_newTransferProxy).supportsInterface( type(ITransferProxy).interfaceId ), "E_INS" ); transferProxy = _newTransferProxy; emit TransferProxyUpdated(_newTransferProxy); } /** * @dev Update to new RoyaltyRegistry * * @param _newRoyaltyRegistry new RoyaltyRegistry * * Requirements: * - _newRoyaltyRegistry must be a contract and must support IRoyaltyRegistry * * Emits a {RoyaltyManagerUpdated} event */ function updateRoyaltyRegistry( IRoyaltyRegistry _newRoyaltyRegistry ) public virtual onlyAdmin { // EM: IRoyaltyRegistry interface not supported require( IRoyaltyRegistry(_newRoyaltyRegistry).supportsInterface( type(IRoyaltyRegistry).interfaceId ), "E_INS" ); royaltyRegistry = _newRoyaltyRegistry; emit RoyaltyRegistryUpdated(_newRoyaltyRegistry); } /** * @dev Gets sold count of an order * * @param _saleKey Sale key * @return sold count of an order */ function getSoldCountByKey( bytes32 _saleKey ) public view virtual returns (uint256) { return _saleProgress[_saleKey]; } /** * @dev Gets sold count of an order * * @param _nonce Sale nonce * @param _token token address * @param _tokenId token ID * @return sold count of an order */ function getSoldCountByNonce( uint256 _nonce, address _token, uint256 _tokenId ) public view virtual returns (uint256) { return _saleProgress[keccak256(abi.encode(_nonce, _token, _tokenId))]; } /** * @dev Updates order state as sold * * @param _saleKey Sale Key * @param _soldValueCount sold value count */ function _setSoldByKey( bytes32 _saleKey, uint256 _soldValueCount ) internal virtual { _saleProgress[_saleKey] += _soldValueCount; } /** * @dev Updates order state as sold * * @param _nonce Sale nonce * @param _token token address * @param _tokenId token ID * @param _soldValueCount sold value count */ function _setSoldByNonce( uint256 _nonce, address _token, uint256 _tokenId, uint256 _soldValueCount ) internal virtual { _saleProgress[ keccak256(abi.encode(_nonce, _token, _tokenId)) ] += _soldValueCount; } /** * @dev Validates royalty parameters * * @param _royaltyReceivers address[] * @param _royaltyDistributionRate uint16[] * @param _secondaryOnwardsRoyaltyPercentage uint16 */ function _validateRoyaltyInfo( address[] memory _royaltyReceivers, uint16[] memory _royaltyDistributionRate, uint16 _secondaryOnwardsRoyaltyPercentage ) private pure { // EM: Invalid royalty data require( _royaltyReceivers.length == _royaltyDistributionRate.length, "E_VRI_IRD" ); uint16 totalPercentage = 0; for (uint256 idx = 0; idx < _royaltyReceivers.length; idx++) { totalPercentage += _royaltyDistributionRate[idx]; // EM: zero address must not be included in receivers require(_royaltyReceivers[idx] != address(0), "E_VRI_IRA"); } // EM: receiversPercentage total in not 100% require(totalPercentage == OrderDomainV3.FEE_DENOMINATOR, "E_VRI_RPN100"); // EM: secondaryOnwardsRoyaltyPercentage greater than 100% require( _secondaryOnwardsRoyaltyPercentage <= OrderDomainV3.FEE_DENOMINATOR, "E_VRI_SOPG100" ); } /** * @dev Check validity of arguments and Verify signatures for calling exchange * * @param _saleOrder OrderDomainV3.SaleOrder * @param _salerSign saler signature * @param _buyOrder OrderDomainV3.BuyOrder * @param _platformSign platform signature * @param _hashMsgSaleOrder Hash of Sale Order */ function _checkParameterAndVerifySignaturesForExchange( OrderDomainV3.SaleOrder calldata _saleOrder, bytes calldata _salerSign, OrderDomainV3.BuyOrder calldata _buyOrder, bytes calldata _platformSign, bytes32 _hashMsgSaleOrder ) internal virtual { uint8 ver = _saleOrder.version; // Part 1: Check parameters { // Make sure SaleOrder and BuyOrder version is same // EM: Version mismatch require(ver == _buyOrder.version, "E_CPFE_VMM"); // EM: Sale Order Asset length is not valid require(_saleOrder.assetList.length == 1, "E_CPFE_ISOAL"); OrderDomainV3.Asset memory asset = _saleOrder.assetList[0]; // EM: SaleOrder asset invalid token require(asset.token != address(0), "E_CPFE_SAIT"); // EM: SaleOrder asset invalid tokenId require(asset.tokenId != 0, "E_CPFE_SAITI"); // Make sure asset is not already sold out if (_buyOrder.firstAssetBuyValue == 0) { // EM: not enough asset remaining for sale // when _buyOrder.firstAssetBuyValue == 0, it means bundle sale require(getSoldCountByKey(_hashMsgSaleOrder) != 1, "E_CPFE_SOLD"); } else { // Make sure asset is not already sold out // EM: not enough asset remaining for sale uint256 soldCount = getSoldCountByNonce( _saleOrder.nonce, asset.token, asset.tokenId ); require( _buyOrder.firstAssetBuyValue <= (asset.value - soldCount), "E_CPFE_SOLD" ); } // Make sure order is not expired // EM: Expired Order require(_buyOrder.validUntil >= block.timestamp, "E_CPFE_EO"); // Platform fee rate should be greater than PlatformFeeRateLowerLimit // EM: SaleOrder pfSaleFeeRate Lower than low limit require( _saleOrder.pfSaleFeeRate >= platformRegistry.getPlatformFeeRateLowerLimit(), "E_CPFE_SPFLTLL" ); if (ver >= 1) { require( _saleOrder.pfSaleFeeRateSecondary >= platformRegistry.getPlatformFeeRateLowerLimit(), "E_CPFE_SPFLTLL" ); } if ( _buyOrder.paymentDetails.paymentMode == OrderDomainV3.ERC20_PAYMENT_MODE ) { // Whitelist check // EM: BuyOrder paymentToken not whitelisted require( platformRegistry.isWhitelistedERC20( _buyOrder.paymentDetails.paymentToken ), "E_CPFE_BPTNW" ); } // OrderDomainV3.SaleOrder // OrderDomainV3.Asset // EM: SaleOrder asset invalid originKind require( OrderDomainV3._isValidOriginKind(asset.originKind), "E_CPFE_SAIO" ); // Make sure using newer signature for new version // EM: Version not correct if (asset.value > 0) { require(ver >= 1, "E_CPFE_VNC"); } // Validate RoyaltyInfo if (asset.royaltyReceivers.length > 0) { _validateRoyaltyInfo( asset.royaltyReceivers, asset.royaltyDistributionRate, asset.secondaryOnwardsRoyaltyPercentage ); } // EM: SaleOrder invalid currentOwner require(_saleOrder.currentOwner != address(0), "E_CPFE_SICO"); // EM: SaleOrder invalid paymentReceiver require(_saleOrder.paymentReceiver != address(0), "E_CPFE_SIPR"); // EM: SaleOrder invalid start require( _saleOrder.start > 0 && _saleOrder.start <= block.timestamp, "E_CPFE_SIS" ); // EM: SaleOrder invalid end require( _saleOrder.end == 0 || _saleOrder.end > block.timestamp, "E_CPFE_SIE" ); // EM: SaleOrder invalid nonce require(_saleOrder.nonce != 0, "E_CPFE_SIN"); // OrderDomainV3.BuyOrder // EM: SaleOrder and BuyOrder nonce does't match require(_saleOrder.nonce == _buyOrder.saleNonce, "E_CPFE_SBN"); // EM: BuyOrder invalid buyer require(_buyOrder.buyer != address(0), "E_CPFE_BIB"); // EM: BuyOrder invalid payer require(_buyOrder.payer != address(0), "E_CPFE_BIP"); // EM: BuyOrder invalid paymentMode require( OrderDomainV3._isValidPaymentMode(_buyOrder.paymentDetails.paymentMode), "E_CPFE_BIPM" ); // EM: BuyOrder invalid price require(_buyOrder.paymentDetails.price != 0, "E_CPFE_BOIP"); // Mixed cases // EM: currentOwner and buyer can't be same require(_saleOrder.currentOwner != _buyOrder.buyer, "E_CPFE_CAABS"); // Check for matching payment mode for Sale and Buy bool matchFound = false; for ( uint256 idx = 0; idx < _saleOrder.acceptedPaymentMode.length; idx++ ) { // EM: SaleOrder acceptedPaymentMode invalid paymentMode require( OrderDomainV3._isValidPaymentMode( _saleOrder.acceptedPaymentMode[idx].paymentMode ), "E_CPFE_SAPMPM" ); // EM: SaleOrder acceptedPaymentMode invalid price require( _saleOrder.acceptedPaymentMode[idx].price != 0, "E_CPFE_SAPMIP" ); if ( _saleOrder.acceptedPaymentMode[idx].paymentMode == _buyOrder.paymentDetails.paymentMode ) { matchFound = true; break; } } // EM: payment mode did't match require(matchFound, "E_CPFE_PMNM"); } // Part 2: Verify signatures { // Prepares ERC712 message hash of Saler signature address recoverdAddress = _domainSeparatorV4() .toTypedDataHash(_hashMsgSaleOrder) .recover(_salerSign); // EM: invalid saler signer require(recoverdAddress == _saleOrder.currentOwner, "E_CPFE_ISS"); // Prepares ERC712 message hash of platform signature bytes32 hashMsgBuyOrder = OrderDomainV3._hashBuyOrder(_buyOrder); recoverdAddress = _domainSeparatorV4() .toTypedDataHash(hashMsgBuyOrder) .recover(_platformSign); // EM: invalid platform signer require(platformRegistry.isPlatformSigner(recoverdAddress), "E_CPFE_IPS"); } } /** * @dev Simulate the PartnerFeeTransfer(Not actual transfer) * * @param _asset OrderDomainV3.Asset * @param _pricePerAsset uint256 price of the asset */ function _simulateRoyaltyTransfer( OrderDomainV3.Asset memory _asset, uint256 _pricePerAsset, uint8 _version ) internal virtual returns (uint256) { uint256 totalRoyaltyToSend = 0; address[] memory royaltyReceivers; uint256[] memory royaltyReceiversCut; uint8 royaltyType; (royaltyReceivers, royaltyReceiversCut, royaltyType) = royaltyRegistry .royaltyInfo( _asset.token, _asset.tokenId, _pricePerAsset, _asset.isSecondarySale ); if ( _version >= 2 && royaltyReceivers.length == 0 && _asset.royaltyReceivers.length > 0 ) { // No RoyaltyRegistry info is set, use Royalty from parameter royaltyReceivers = _asset.royaltyReceivers; // Find the amount that needs to be split for royalty uint256 splitTotalPrice = _pricePerAsset; if (_asset.isSecondarySale == 1) { // Secondary Sale onwards royalty is distributed based on royaltyPercentage splitTotalPrice = (_pricePerAsset * _asset.secondaryOnwardsRoyaltyPercentage) / OrderDomainV3.FEE_DENOMINATOR; } // Find/Calculate royaltyReceiversCut royaltyReceiversCut = new uint256[](royaltyReceivers.length); for (uint256 idx = 0; idx < royaltyReceivers.length; idx++) { royaltyReceiversCut[idx] = (splitTotalPrice * _asset.royaltyDistributionRate[idx]) / OrderDomainV3.FEE_DENOMINATOR; } } for (uint256 idx = 0; idx < royaltyReceivers.length; idx++) { uint256 royaltyReceiverCut = royaltyReceiversCut[idx]; _registerPayout(royaltyReceivers[idx], royaltyReceiverCut); totalRoyaltyToSend += royaltyReceiverCut; } return totalRoyaltyToSend; } /** * @dev Transfer NFT * * @param _currentOwner address * @param _asset OrderDomainV3.Asset memory * @param _buyOrder OrderDomainV3.BuyOrder */ function _transferNFT( // OrderDomainV3.SaleOrder calldata _saleOrder, address _currentOwner, OrderDomainV3.Asset memory _asset, OrderDomainV3.BuyOrder calldata _buyOrder ) internal virtual { // OrderDomainV3.Asset memory asset = _saleOrder.assetList[0]; if (IERC721(_asset.token).supportsInterface(type(IERC721).interfaceId)) { // ERC721の場合 transferProxy.erc721safeTransferFrom( IERC721(_asset.token), _currentOwner, _buyOrder.buyer, _asset.tokenId ); } else if ( IERC1155(_asset.token).supportsInterface(type(IERC1155).interfaceId) ) { uint256 value = _asset.value; if (_buyOrder.firstAssetBuyValue > 0) { // For Single ERC1155 value = _buyOrder.firstAssetBuyValue; } // ERC1155の場合 transferProxy.erc1155safeTransferFrom( IERC1155(_asset.token), _currentOwner, _buyOrder.buyer, _asset.tokenId, value, bytes("0x") ); } else { // EM: Unsupported asset type revert("E_UAT"); } } /** * @dev Payout to all receivers using _tempPayoutAddress and _tempPayoutAmount * when execting exchange * * @param _paymentMode bytes4 Payment.paymentMode * @param _paymentToken address * @param _payer address */ function _payout( bytes4 _paymentMode, address _paymentToken, address _payer ) internal virtual { for (uint256 idx = 0; idx < _tempPayoutAddress.length; idx++) { address payable reciever = payable(_tempPayoutAddress[idx]); uint256 amount = _tempPayoutAmount[reciever]; if (_paymentMode == OrderDomainV3.NATIVE_PAYMENT_MODE) { // Sending ETH reciever.transfer(amount); } else if (_paymentMode == OrderDomainV3.ERC20_PAYMENT_MODE) { // Sending ERC20 transferProxy.erc20safeTransferFrom( IERC20(_paymentToken), _payer, reciever, amount ); } } } /** * @dev Register payment locally, to be used in _payout * * @param _reciever address * @param _amount uint256 */ function _registerPayout( address _reciever, uint256 _amount ) internal virtual { if (_amount > 0) { if (_tempPayoutAmount[_reciever] == 0) { _tempPayoutAddress.push(_reciever); } _tempPayoutAmount[_reciever] += _amount; } } /** * @dev Clears previous payout data * It is used for collective payment to pay one address only once */ function _resetPayoutTemp() internal virtual { for (uint256 idx = 0; idx < _tempPayoutAddress.length; idx++) { delete _tempPayoutAmount[_tempPayoutAddress[idx]]; } delete _tempPayoutAddress; } /** * @dev See {IExchange.exchange()} * * @param _saleOrder OrderDomainV3.SaleOrder * @param _salerSign saler signature * @param _buyOrder OrderDomainV3.BuyOrder * @param _platformSign platform signature * * Requirements: * - whenNotPaused * - nonReentrant * * Emits a {Sale} event */ function exchange( OrderDomainV3.SaleOrder calldata _saleOrder, bytes calldata _salerSign, OrderDomainV3.BuyOrder calldata _buyOrder, bytes calldata _platformSign ) external payable virtual override whenNotPaused nonReentrant { uint8 ver = _saleOrder.version; // Step1 : Parameters and signatures checks bytes32 hashMsgSaleOrder = OrderDomainV3._hashSaleOrder(_saleOrder); _checkParameterAndVerifySignaturesForExchange( _saleOrder, _salerSign, _buyOrder, _platformSign, hashMsgSaleOrder ); OrderDomainV3.Asset memory asset = _saleOrder.assetList[0]; // Step2 : Payout (if OnchainPaymentMode) : Platform Fee + Partner Fee(If partner) + Royalty + Saler(Secondary onwards) // OnchainPaymentMode == NATIVE_PAYMENT_MODE || ERC20_PAYMENT_MODE if ( OrderDomainV3._isOnchainPaymentMode(_buyOrder.paymentDetails.paymentMode) ) { // Payout map is used for collective payment by sending only once for an address // So reset it before using it _resetPayoutTemp(); // Sale Price = Platform Fee + Partner Fee(If partner) + Royalty + Saler(Secondary onwards) // Find the total sale price by matching payment mode of SaleOrder and BuyOrder uint256 totalSalePrice = OrderDomainV3._findTotalSalePrice( _saleOrder, _buyOrder ); if (_buyOrder.firstAssetBuyValue > 0) { // Single Sale for ERC1155 totalSalePrice = (totalSalePrice * _buyOrder.firstAssetBuyValue) / _saleOrder.assetList[0].value; } // Make sure Native Token/ERC20 recieved is enough for sale // NOTE: if got more Native Token/ERC20 then needed, it will be stored in this contract(considered as TIP) if ( _buyOrder.paymentDetails.paymentMode == OrderDomainV3.NATIVE_PAYMENT_MODE ) { // Native Token case // EM: not enough Native Token received for sale require(msg.value >= totalSalePrice, "E_E_NENT"); // NOTE: TIP will be added to the balance of this contract } else if ( _buyOrder.paymentDetails.paymentMode == OrderDomainV3.ERC20_PAYMENT_MODE ) { // ERC20 case // NOTE: Make sure appropriate amount of ERC20 is approved to TransferProxy address paymentToken = _buyOrder.paymentDetails.paymentToken; // EM: not enough ERC20 approved for sale uint256 allowanceCount = IERC20(paymentToken).allowance( _buyOrder.payer, address(transferProxy) ); require(allowanceCount >= totalSalePrice, "E_E_NEERC20"); // Register TIP uint256 tip = allowanceCount - totalSalePrice; if (tip > 0) { ERC20Tip memory erc20Tip = ERC20Tip(_buyOrder.payer, tip); _erc20TipDeposite[paymentToken].push(erc20Tip); } } address paymentReceiver = _saleOrder.paymentReceiver; // [Platform Fee for Asset] uint16 pfSaleFeeRate = _saleOrder.pfSaleFeeRate; // NOTE: from version 1 onward, need to set Secondary Sale fee rate at [SaleOrder.pfSaleFeeRateSecondary] if (ver >= 1 && OrderDomainV3._isSecondarySale(asset.isSecondarySale)) { // Secondary onwards sale case pfSaleFeeRate = _saleOrder.pfSaleFeeRateSecondary; } // Simulate sending platform fee uint256 pfFeeForAsset = (totalSalePrice * pfSaleFeeRate) / OrderDomainV3.FEE_DENOMINATOR; _registerPayout(platformRegistry.getPlatformFeeReceiver(), pfFeeForAsset); // [Partner Fee for Asset] uint256 partnerFeeForAsset = 0; if ( OrderDomainV3._isPartnerOrigin(asset.originKind) && asset.partnerFeeRate > 0 ) { address payable partnerFeeReceiver = asset.partnerFeeReceiver; if (partnerFeeReceiver == address(0)) { // If _asset.partnerFeeReceiver is not set, try to get from platformRegistry partnerFeeReceiver = platformRegistry.getPartnerFeeReceiver( asset.token ); } // Make sure partner fee recever is set // EM: partner fee recever is not set require(partnerFeeReceiver != address(0), "E_E_PFRNS"); partnerFeeForAsset = (totalSalePrice * asset.partnerFeeRate) / OrderDomainV3.FEE_DENOMINATOR; _registerPayout(partnerFeeReceiver, partnerFeeForAsset); } // [Royalties for Asset] uint256 royaltySplitPriceForAsset = 0; if (OrderDomainV3._isSecondarySale(asset.isSecondarySale)) { // Secondary onwards sale case royaltySplitPriceForAsset = totalSalePrice; } else { // Primary sale case royaltySplitPriceForAsset = totalSalePrice - pfFeeForAsset - partnerFeeForAsset; } // Simulate sending royalty cut uint256 royaltyFeeForAsset = _simulateRoyaltyTransfer( asset, royaltySplitPriceForAsset, ver ); // [Saler Cut for Asset] _registerPayout( paymentReceiver, totalSalePrice - pfFeeForAsset - partnerFeeForAsset - royaltyFeeForAsset ); // Payout _payout( _buyOrder.paymentDetails.paymentMode, _buyOrder.paymentDetails.paymentToken, _buyOrder.payer ); _resetPayoutTemp(); } // Step3 : Transfer NFT _transferNFT(_saleOrder.currentOwner, asset, _buyOrder); // Step4 : Update sale order state and emit event if (_buyOrder.firstAssetBuyValue > 0) { _setSoldByNonce( _saleOrder.nonce, asset.token, asset.tokenId, _buyOrder.firstAssetBuyValue ); emit SaleSingle( _saleOrder.nonce, asset.token, asset.tokenId, _buyOrder.firstAssetBuyValue ); } else { // Mark whole order as sold, when bundle sale _setSoldByKey(hashMsgSaleOrder, 1); emit SaleSingle( _saleOrder.nonce, asset.token, asset.tokenId, asset.value ); } } /** * @dev Withdraw Tip * * @param _receiver address payable * @param _erc20Token address. When Native, address is zero. */ function withdrawTip( address payable _receiver, address _erc20Token ) public virtual onlyAdmin { // EM: Invalid withdraw address require(_receiver != address(0), "E_WT_IRA"); if (_erc20Token == address(0)) { // Native tip withdraw _receiver.transfer(address(this).balance); } else { // ERC20 tip withdrawal ERC20Tip[] storage erc20TipList = _erc20TipDeposite[_erc20Token]; for (uint256 idx = 0; idx < erc20TipList.length; idx++) { ERC20Tip storage erc20Tip = erc20TipList[idx]; // Sending ERC20 transferProxy.erc20safeTransferFrom( IERC20(_erc20Token), erc20Tip.tipper, _receiver, erc20Tip.amount ); } // Clear tip info after transfer delete _erc20TipDeposite[_erc20Token]; } } /** * @dev Returns the version of this contract */ function version() public pure virtual override returns (uint8) { return 2; } }
@openzeppelin/contracts-upgradeable/interfaces/IERC165Upgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165Upgradeable.sol";
@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165Upgradeable.sol"; /** * @dev Interface for the NFT Royalty Standard. * * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal * support for royalty payments across all NFT marketplaces and ecosystem participants. * * _Available since v4.5._ */ interface IERC2981Upgradeable is IERC165Upgradeable { /** * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of * exchange. The royalty amount is denominated and should be paid in that same unit of exchange. */ function royaltyInfo(uint256 tokenId, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount); }
@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol) pragma solidity ^0.8.0; /** * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified * proxy whose upgrades are fully controlled by the current implementation. */ interface IERC1822ProxiableUpgradeable { /** * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation * address. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. */ function proxiableUUID() external view returns (bytes32); }
@openzeppelin/contracts-upgradeable/metatx/ERC2771ContextUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (metatx/ERC2771Context.sol) pragma solidity ^0.8.9; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Context variant with ERC2771 support. */ abstract contract ERC2771ContextUpgradeable is Initializable, ContextUpgradeable { /// @custom:oz-upgrades-unsafe-allow state-variable-immutable address private immutable _trustedForwarder; /// @custom:oz-upgrades-unsafe-allow constructor constructor(address trustedForwarder) { _trustedForwarder = trustedForwarder; } function isTrustedForwarder(address forwarder) public view virtual returns (bool) { return forwarder == _trustedForwarder; } function _msgSender() internal view virtual override returns (address sender) { if (isTrustedForwarder(msg.sender)) { // The assembly code is more direct than the Solidity version using `abi.decode`. /// @solidity memory-safe-assembly assembly { sender := shr(96, calldataload(sub(calldatasize(), 20))) } } else { return super._msgSender(); } } function _msgData() internal view virtual override returns (bytes calldata) { if (isTrustedForwarder(msg.sender)) { return msg.data[:msg.data.length - 20]; } else { return super._msgData(); } } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol) pragma solidity ^0.8.2; import "../beacon/IBeaconUpgradeable.sol"; import "../../interfaces/draft-IERC1822Upgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "../../utils/StorageSlotUpgradeable.sol"; import "../utils/Initializable.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. * * _Available since v4.1._ * * @custom:oz-upgrades-unsafe-allow delegatecall */ abstract contract ERC1967UpgradeUpgradeable is Initializable { function __ERC1967Upgrade_init() internal onlyInitializing { } function __ERC1967Upgrade_init_unchained() internal onlyInitializing { } // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1 bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143; /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Returns the current implementation address. */ function _getImplementation() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { require(AddressUpgradeable.isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Perform implementation upgrade * * Emits an {Upgraded} event. */ function _upgradeTo(address newImplementation) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Perform implementation upgrade with additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCall( address newImplementation, bytes memory data, bool forceCall ) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { _functionDelegateCall(newImplementation, data); } } /** * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCallUUPS( address newImplementation, bytes memory data, bool forceCall ) internal { // Upgrades from old implementations will perform a rollback test. This test requires the new // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing // this special case will break upgrade paths from old UUPS implementation to new ones. if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) { _setImplementation(newImplementation); } else { try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) { require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID"); } catch { revert("ERC1967Upgrade: new implementation is not UUPS"); } _upgradeToAndCall(newImplementation, data, forceCall); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Returns the current admin. */ function _getAdmin() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { require(newAdmin != address(0), "ERC1967: new admin is the zero address"); StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. */ function _changeAdmin(address newAdmin) internal { emit AdminChanged(_getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor. */ bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Emitted when the beacon is upgraded. */ event BeaconUpgraded(address indexed beacon); /** * @dev Returns the current beacon. */ function _getBeacon() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { require(AddressUpgradeable.isContract(newBeacon), "ERC1967: new beacon is not a contract"); require( AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()), "ERC1967: beacon implementation is not a contract" ); StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon; } /** * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that). * * Emits a {BeaconUpgraded} event. */ function _upgradeBeaconToAndCall( address newBeacon, bytes memory data, bool forceCall ) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0 || forceCall) { _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data); } } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) { require(AddressUpgradeable.isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return AddressUpgradeable.verifyCallResult(success, returndata, "Address: low-level delegate call failed"); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeaconUpgradeable { /** * @dev Must return an address that can be used as a delegate call target. * * {BeaconProxy} will check that this address is a contract. */ function implementation() external view returns (address); }
@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original * initialization step. This is essential to configure modules that are added through upgrades and that require * initialization. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized < type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } }
@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/utils/UUPSUpgradeable.sol) pragma solidity ^0.8.0; import "../../interfaces/draft-IERC1822Upgradeable.sol"; import "../ERC1967/ERC1967UpgradeUpgradeable.sol"; import "./Initializable.sol"; /** * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy. * * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing * `UUPSUpgradeable` with a custom implementation of upgrades. * * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism. * * _Available since v4.1._ */ abstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable { function __UUPSUpgradeable_init() internal onlyInitializing { } function __UUPSUpgradeable_init_unchained() internal onlyInitializing { } /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment address private immutable __self = address(this); /** * @dev Check that the execution is being performed through a delegatecall call and that the execution context is * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to * fail. */ modifier onlyProxy() { require(address(this) != __self, "Function must be called through delegatecall"); require(_getImplementation() == __self, "Function must be called through active proxy"); _; } /** * @dev Check that the execution is not being performed through a delegate call. This allows a function to be * callable on the implementing contract but not through proxies. */ modifier notDelegated() { require(address(this) == __self, "UUPSUpgradeable: must not be called through delegatecall"); _; } /** * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the * implementation. It is used to validate that the this implementation remains valid after an upgrade. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier. */ function proxiableUUID() external view virtual override notDelegated returns (bytes32) { return _IMPLEMENTATION_SLOT; } /** * @dev Upgrade the implementation of the proxy to `newImplementation`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeTo(address newImplementation) external virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, new bytes(0), false); } /** * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call * encoded in `data`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, data, true); } /** * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by * {upgradeTo} and {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal override onlyOwner {} * ``` */ function _authorizeUpgrade(address newImplementation) internal virtual; /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract PausableUpgradeable is Initializable, ContextUpgradeable { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ function __Pausable_init() internal onlyInitializing { __Pausable_init_unchained(); } function __Pausable_init_unchained() internal onlyInitializing { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuardUpgradeable is Initializable { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol) pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlotUpgradeable { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } }
@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library StringsUpgradeable { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.3) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../StringsUpgradeable.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSAUpgradeable { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } else if (error == RecoverError.InvalidSignatureV) { revert("ECDSA: invalid signature 'v' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } if (v != 27 && v != 28) { return (address(0), RecoverError.InvalidSignatureV); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", StringsUpgradeable.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
@openzeppelin/contracts-upgradeable/utils/cryptography/draft-EIP712Upgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol) pragma solidity ^0.8.0; import "./ECDSAUpgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible, * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding * they need in their contracts using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * _Available since v3.4._ * * @custom:storage-size 52 */ abstract contract EIP712Upgradeable is Initializable { /* solhint-disable var-name-mixedcase */ bytes32 private _HASHED_NAME; bytes32 private _HASHED_VERSION; bytes32 private constant _TYPE_HASH = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); /* solhint-enable var-name-mixedcase */ /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ function __EIP712_init(string memory name, string memory version) internal onlyInitializing { __EIP712_init_unchained(name, version); } function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing { bytes32 hashedName = keccak256(bytes(name)); bytes32 hashedVersion = keccak256(bytes(version)); _HASHED_NAME = hashedName; _HASHED_VERSION = hashedVersion; } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { return _buildDomainSeparator(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash()); } function _buildDomainSeparator( bytes32 typeHash, bytes32 nameHash, bytes32 versionHash ) private view returns (bytes32) { return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this))); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return ECDSAUpgradeable.toTypedDataHash(_domainSeparatorV4(), structHash); } /** * @dev The hash of the name parameter for the EIP712 domain. * * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs * are a concern. */ function _EIP712NameHash() internal virtual view returns (bytes32) { return _HASHED_NAME; } /** * @dev The hash of the version parameter for the EIP712 domain. * * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs * are a concern. */ function _EIP712VersionHash() internal virtual view returns (bytes32) { return _HASHED_VERSION; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable { function __ERC165_init() internal onlyInitializing { } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165Upgradeable { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
@openzeppelin/contracts/token/ERC1155/IERC1155.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC1155 compliant contract, as defined in the * https://eips.ethereum.org/EIPS/eip-1155[EIP]. * * _Available since v3.1._ */ interface IERC1155 is IERC165 { /** * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`. */ event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); /** * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all * transfers. */ event TransferBatch( address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values ); /** * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to * `approved`. */ event ApprovalForAll(address indexed account, address indexed operator, bool approved); /** * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. * * If an {URI} event was emitted for `id`, the standard * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value * returned by {IERC1155MetadataURI-uri}. */ event URI(string value, uint256 indexed id); /** * @dev Returns the amount of tokens of token type `id` owned by `account`. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) external view returns (uint256); /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory); /** * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the caller. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. * * See {setApprovalForAll}. */ function isApprovedForAll(address account, address operator) external view returns (bool); /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes calldata data ) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data ) external; }
@openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
@openzeppelin/contracts/token/ERC721/IERC721.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
@openzeppelin/contracts/utils/introspection/IERC165.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
@sbinft/contracts/upgradeable/access/AdminUpgradeable.sol
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol"; /** * @notice deprecated use AdminUpgradeableV2 * @title AdminUpgradeable Contract to manage access * * @author SBINFT Co., Ltd. */ abstract contract AdminUpgradeable is ContextUpgradeable { event AdminAdded(address); event AdminRemoved(address); /** * @dev 管理者のマッピング。管理者でないならばfalseを返す。 */ mapping(address => bool) private _admin; function __Admin_init() internal onlyInitializing { __Context_init(); // 初期化時にデプロイ者を管理者に追加する。 _addAdmin(_msgSender()); } /** * @dev 管理者を複数追加 */ function addAdmin(address[] calldata newAdmin) public virtual onlyAdmin { for (uint256 idx = 0; idx < newAdmin.length; idx++) { _addAdmin(newAdmin[idx]); } } /** * @dev 管理者を一人追加 */ function addAdmin(address newAdmin) public virtual onlyAdmin { _addAdmin(newAdmin); } /** * @dev 管理者を一人追加 * 無制限 Internal function */ function _addAdmin(address newAdmin) internal virtual { require( newAdmin != address(0), "Admin:addAdmin newAdmin is the zero address" ); _admin[newAdmin] = true; emit AdminAdded(newAdmin); } /** * @dev 管理者を一人削除 */ function removeAdmin(address admin) public virtual onlyAdmin { require( _admin[admin], "Admin:removeAdmin trying to remove non existing Admin" ); _removeAdmin(admin); } /** * @dev 管理者を一人削除 * 無制限 Internal function */ function _removeAdmin(address admin) internal virtual { delete _admin[admin]; emit AdminRemoved(admin); } /** * @dev * Adminかどうかのチェック */ function isAdmin(address checkAdmin) public view virtual returns (bool) { return _admin[checkAdmin]; } /** * @dev Throws if called by any account other than Admin. */ modifier onlyAdmin() { require(_admin[_msgSender()], "Admin:onlyAdmin caller is not an Admin"); _; } }
contracts/sbinft/market/v1/interface/IPlatformRegistry.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import "@openzeppelin/contracts-upgradeable/interfaces/IERC165Upgradeable.sol"; /** * @title SBINFT Platform Registry */ interface IPlatformRegistry is IERC165Upgradeable { /** * @dev Update to new PlatformFeeRateLowerLimit * * @param _new new PlatformFeeRateLowerLimit */ function updatePlatformFeeLowerLimit(uint16 _new) external; /** * @dev Update to new PlatformFeeReceiver * * @param _new new PlatformFeeReceiver */ function updatePlatformFeeReceiver(address payable _new) external; /** * @dev Update to new PartnerFeeReceiver for partner's collection * * @param collection partner's collection * @param partnerFeeReceiver new partner's FeeReceiver * @param sign bytes calldata signature of platform signer */ function updatePartnerFeeReceiver( address collection, address payable partnerFeeReceiver, bytes calldata sign ) external; /** * @dev Checks if partner fee receiver * * @param _collection address of token * @param _partnerFeeReceiver address of partner FeeReceiver * * Requirements: * - _collection must be a non zero address * - _partnerFeeReceiver must be a non zero address */ function isPartnerFeeReceiver( address _collection, address _partnerFeeReceiver ) external view returns (bool); /** * @dev Checks state of a Whitelisted token * * @param _token address of token */ function isWhitelistedERC20(address _token) external view returns (bool); /** * @dev Adds list of token to Whitelisted, if zero address then will be ignored * * @param _addTokenList array of address of token to add */ function addToERC20Whitelist(address[] calldata _addTokenList) external; /** * @dev Removes list of token from Whitelisted * * @param _tokenList array of address of token to remove */ function removeFromERC20Whitelist(address[] calldata _tokenList) external; /** * @dev Checks state of a Whitelisted token * * @param _signer address of token */ function isPlatformSigner(address _signer) external view returns (bool); /** * @dev Adds list of token to Whitelisted, if zero address then will be ignored * * @param _platformSignerList array of platfomr signer address to add */ function addPlatformSigner(address[] calldata _platformSignerList) external; /** * @dev Removes list of platform signers address * * @param _list array of platfomr signer address to remove */ function removePlatformSigner(address[] calldata _list) external; /** * @dev Returns PlatformFeeReceiver */ function getPlatformFeeReceiver() external returns (address payable); /** * @dev Returns PartnerFeeReceiver * * @param _token address of partner token */ function getPartnerFeeReceiver( address _token ) external returns (address payable); /** * @dev Returns PlatformFeeReceiver * */ function getPlatformFeeRateLowerLimit() external returns (uint16); /** * @dev Update to new PartnerPfFeeReceiver for partner's platformSigner * * @param _externalPlatformToken address of external Platform Token * @param _partnerPfFeeReceiver address new partner's platformer FeeReceiver * * Requirements: * - _platformSigner must be a non zero address * - _partnerPfFeeReceiver must be a non zero address * * Emits a {ExternalPfFeeReceiverUpdated} event */ function updateExternalPlatformFeeReceiver( address _externalPlatformToken, address payable _partnerPfFeeReceiver ) external; /** * @dev Returns ExternalPlatformFeeReceiver * * @param _token address of external platform token */ function getExternalPlatformFeeReceiver( address _token ) external returns (address payable); }
contracts/sbinft/market/v1/interface/IRoyaltyRegistry.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.17; import "@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol"; /** * @dev Interface for the NFT Royalty Standard. * * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal * support for royalty payments across all NFT marketplaces and ecosystem participants. * * _Available since v4.5._ */ interface IRoyaltyRegistry is IERC2981Upgradeable { /** * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of * exchange. The royalty amount is denominated and should be paid in that same unit of exchange. */ function royaltyInfo( address _token, uint256 _tokenId, uint256 _salePrice, uint8 _isSecondarySale ) external returns ( address[] memory receivers, uint256[] memory royaltyFees, uint8 royaltyType ); /** * @dev Returns the division factor for calculating precentage */ function feeDenominator() external returns (uint16); }
contracts/sbinft/market/v1/interface/ITransferProxy.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import "@openzeppelin/contracts-upgradeable/interfaces/IERC165Upgradeable.sol"; /** * @title SBINFT market non-native asset transfer protocol */ interface ITransferProxy is IERC165Upgradeable { /** * @notice Safe transfer ERC20 token * @dev only registered operators could call this function(i.e. Exchange) * * @param _token IERC20 token address * @param _from address from * @param _to address to * @param _value uint256 value */ function erc20safeTransferFrom( IERC20 _token, address _from, address _to, uint256 _value ) external; /** * @notice Safe transfer ERC721 token * @dev only registered operators could call this function(i.e. Exchange) * * @param _token IERC721 token address * @param _from address current owner address * @param _to address new to be owner address * @param _tokenId uint256 token id to transfer */ function erc721safeTransferFrom( IERC721 _token, address _from, address _to, uint256 _tokenId ) external; /** * @notice Safe transfer ERC1155 token * @dev only registered operators could call this function(i.e. Exchange) * * @param _token IERC1155 token address * @param _from address current owner address * @param _to address new to be owner address * @param _tokenId uint256 token id to transfer * @param _value uint256 count of token to transfer * @param _data bytes extra data if needed */ function erc1155safeTransferFrom( IERC1155 _token, address _from, address _to, uint256 _tokenId, uint256 _value, bytes calldata _data ) external; }
contracts/sbinft/market/v3/interface/IExchangeV3.sol
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.19; import "@openzeppelin/contracts-upgradeable/interfaces/IERC165Upgradeable.sol"; import "contracts/sbinft/market/v3/library/OrderDomainV3.sol"; /** * @title SBINFT Exchange protocol interface * @author SBINFT Co., Ltd. */ interface IExchangeV3 is IERC165Upgradeable { // Emits whenever there is a exchange/sale event SaleSingle( uint256 indexed nonce, address indexed token, uint256 indexed tokenId, uint256 value ); /** * @dev Try to exchange bundle asset in process of Sale * * @param _saleOrder OrderDomainV3.SaleOrder * @param _salerSign saler signature * @param _buyOrder OrderDomainV3.BuyOrder * @param _platformSign platform signature */ function exchange( OrderDomainV3.SaleOrder calldata _saleOrder, bytes calldata _salerSign, OrderDomainV3.BuyOrder calldata _buyOrder, bytes calldata _platformSign ) external payable; /** * @dev Returns the version of this contract */ function version() external pure returns (uint8); }
contracts/sbinft/market/v3/library/OrderDomainV3.sol
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.19; /** * @dev Model data related with Order * @author SBINFT Co., Ltd. */ library OrderDomainV3 { // ORIGIN_KIND bytes4 private constant NANAKUSA_ORIGIN_KIND = bytes4(keccak256("NANAKUSA")); bytes4 private constant PARTNER_ORIGIN_KIND = bytes4(keccak256("PARTNER")); // PAYMENT_MODE bytes4 public constant NATIVE_PAYMENT_MODE = bytes4(keccak256("NATIVE")); bytes4 public constant ERC20_PAYMENT_MODE = bytes4(keccak256("ERC20")); bytes4 private constant CREDIT_CARD_PAYMENT_MODE = bytes4(keccak256("CREDIT_CARD")); bytes4 private constant OTHER_BLOCKCHAIN_PAYMENT_MODE = bytes4(keccak256("OTHER_BLOCKCHAIN")); /** * @dev Sale Asset Info */ struct Asset { bytes4 originKind; address token; uint256 tokenId; uint256 value; // [v2] Only For ERC1155, For ERC721 always 0 uint16 partnerFeeRate; // only set when originKind = PARTNER_ORIGIN_KIND address payable partnerFeeReceiver; //[v2] only set when originKind = PARTNER_ORIGIN_KIND or can be set into PlatformRegistry uint8 isSecondarySale; // 1 = true, 0 = false address[] royaltyReceivers; // [v3] uint16[] royaltyDistributionRate; // [v3] uint16 secondaryOnwardsRoyaltyPercentage; // [v3] } struct Payment { bytes4 paymentMode; // Like NATIVE_PAYMENT_MODE || ERC20_PAYMENT_MODE || ... address paymentToken; // Token contract address uint256 price; } struct SaleOrder { Asset[] assetList; // Array but only zero [0] index will be used(as bundle listing is depreciated) address currentOwner; address paymentReceiver; // Onchain payment receiver, can be same as currentOwner Payment[] acceptedPaymentMode; uint16 pfSaleFeeRate; uint16 pfSaleFeeRateSecondary; // [v2] uint256 start; // Always non zero uint256 end; // Can be zero when there is no end time uint256 nonce; uint8 version; // [v2] 0 = version1, 1 = version2, 2 = version3 ... } struct BuyOrder { uint256 saleNonce; address payable buyer; address payable payer; // If no payer means buyer is the payer uint256 firstAssetBuyValue; // [v2] For bundle sale and ERC721 always 0, Only for single ERC1155 sale need some value Payment paymentDetails; uint256 validUntil; // UNIX timestamp to determine the of validity of buyOrder uint8 version; // [v2] 0 = version1, 1 = version2 ... } // ---- EIP712 ---- // [v1] bytes32 private constant ASSET_TYPEHASH = keccak256( "Asset(bytes4 originKind,address token,uint256 tokenId,uint16 partnerFeeRate,uint8 isSecondarySale)" ); bytes32 private constant PAYMENT_TYPEHASH = keccak256("Payment(bytes4 paymentMode,address paymentToken,uint256 price)"); bytes32 private constant SALE_ORDER_TYPEHASH = keccak256( "SaleOrder(Asset[] assetList,address currentOwner,address paymentReceiver,Payment[] acceptedPaymentMode,uint16 pfSaleFeeRate,uint256 start,uint256 end,uint256 nonce)Asset(bytes4 originKind,address token,uint256 tokenId,uint16 partnerFeeRate,uint8 isSecondarySale)Payment(bytes4 paymentMode,address paymentToken,uint256 price)" ); bytes32 private constant BUY_ORDER_TYPEHASH = keccak256( "BuyOrder(uint256 saleNonce,address buyer,address payer,Payment paymentDetails,uint256 validUntil)Payment(bytes4 paymentMode,address paymentToken,uint256 price)" ); // [v2] bytes32 private constant ASSET_TYPEHASH_V2 = keccak256( "Asset(bytes4 originKind,address token,uint256 tokenId,uint256 value,uint16 partnerFeeRate,address partnerFeeReceiver,uint8 isSecondarySale)" ); bytes32 private constant SALE_ORDER_TYPEHASH_V2 = keccak256( "SaleOrder(Asset[] assetList,address currentOwner,address paymentReceiver,Payment[] acceptedPaymentMode,uint16 pfSaleFeeRate,uint16 pfSaleFeeRateSecondary,uint256 start,uint256 end,uint256 nonce,uint8 version)Asset(bytes4 originKind,address token,uint256 tokenId,uint256 value,uint16 partnerFeeRate,address partnerFeeReceiver,uint8 isSecondarySale)Payment(bytes4 paymentMode,address paymentToken,uint256 price)" ); bytes32 private constant BUY_ORDER_TYPEHASH_V2 = keccak256( "BuyOrder(uint256 saleNonce,address buyer,address payer,uint256 firstAssetBuyValue,Payment paymentDetails,uint256 validUntil,uint8 version)Payment(bytes4 paymentMode,address paymentToken,uint256 price)" ); // [v3] /** * @dev Defaults to 10000 so fees are expressed in basis points, but may be customized by an override. * 10000 = 100% */ uint16 internal constant FEE_DENOMINATOR = 10000; bytes32 private constant ASSET_TYPEHASH_V3 = keccak256( "Asset(bytes4 originKind,address token,uint256 tokenId,uint256 value,uint16 partnerFeeRate,address partnerFeeReceiver,uint8 isSecondarySale,address[] royaltyReceivers,uint16[] royaltyDistributionRate,uint16 secondaryOnwardsRoyaltyPercentage)" ); bytes32 private constant SALE_ORDER_TYPEHASH_V3 = keccak256( "SaleOrder(Asset[] assetList,address currentOwner,address paymentReceiver,Payment[] acceptedPaymentMode,uint16 pfSaleFeeRate,uint16 pfSaleFeeRateSecondary,uint256 start,uint256 end,uint256 nonce,uint8 version)Asset(bytes4 originKind,address token,uint256 tokenId,uint256 value,uint16 partnerFeeRate,address partnerFeeReceiver,uint8 isSecondarySale,address[] royaltyReceivers,uint16[] royaltyDistributionRate,uint16 secondaryOnwardsRoyaltyPercentage)Payment(bytes4 paymentMode,address paymentToken,uint256 price)" ); /** * @dev Prepares keccak256 hash for Asset * * @param _asset OrderDomain.Asset * @param _version uint8 */ function _hashAsset( Asset calldata _asset, uint8 _version ) internal pure returns (bytes32) { if (_version == 0) { // [v1] return keccak256( abi.encode( ASSET_TYPEHASH, _asset.originKind, _asset.token, _asset.tokenId, _asset.partnerFeeRate, _asset.isSecondarySale ) ); } else if (_version == 1) { // [v2] return keccak256( abi.encode( ASSET_TYPEHASH_V2, _asset.originKind, _asset.token, _asset.tokenId, _asset.value, _asset.partnerFeeRate, _asset.partnerFeeReceiver, _asset.isSecondarySale ) ); } else if (_version == 2) { // [v3] return keccak256( abi.encode( ASSET_TYPEHASH_V3, _asset.originKind, _asset.token, _asset.tokenId, _asset.value, _asset.partnerFeeRate, _asset.partnerFeeReceiver, _asset.isSecondarySale, keccak256(abi.encodePacked(_asset.royaltyReceivers)), keccak256(abi.encodePacked(_asset.royaltyDistributionRate)), _asset.secondaryOnwardsRoyaltyPercentage ) ); } else { revert("E_OD3_IV"); } } /** * @dev Prepares keccak256 hash for Asset list * * @param _assetList OrderDomain.Asset[] * @param _version uint8 */ function _hashAsset( Asset[] calldata _assetList, uint8 _version ) internal pure returns (bytes32) { bytes32[] memory keccakData = new bytes32[](_assetList.length); for (uint256 idx = 0; idx < _assetList.length; idx++) { keccakData[idx] = _hashAsset(_assetList[idx], _version); } return keccak256(abi.encodePacked(keccakData)); } /** * @dev Prepares keccak256 hash for Payment * * @param _payment OrderDomain.Payment */ function _hashPayment( Payment calldata _payment ) internal pure returns (bytes32) { return keccak256( abi.encode( PAYMENT_TYPEHASH, _payment.paymentMode, _payment.paymentToken, _payment.price ) ); } /** * @dev Prepares keccak256 hash for Payment list * * @param _paymentList OrderDomain.Payment[] */ function _hashPayment( Payment[] calldata _paymentList ) internal pure returns (bytes32) { bytes32[] memory keccakData = new bytes32[](_paymentList.length); for (uint256 idx = 0; idx < _paymentList.length; idx++) { keccakData[idx] = _hashPayment(_paymentList[idx]); } return keccak256(abi.encodePacked(keccakData)); } /** * @dev Prepares keccak256 hash for SaleOrder * * @param _saleOrder OrderDomain.SaleOrder */ function _hashSaleOrder( SaleOrder calldata _saleOrder ) internal pure returns (bytes32) { if (_saleOrder.version == 0) { // [v1] return keccak256( abi.encode( SALE_ORDER_TYPEHASH, _hashAsset(_saleOrder.assetList, _saleOrder.version), _saleOrder.currentOwner, _saleOrder.paymentReceiver, _hashPayment(_saleOrder.acceptedPaymentMode), _saleOrder.pfSaleFeeRate, _saleOrder.start, _saleOrder.end, _saleOrder.nonce ) ); } else if (_saleOrder.version == 1) { // [v2] return keccak256( abi.encode( SALE_ORDER_TYPEHASH_V2, _hashAsset(_saleOrder.assetList, _saleOrder.version), _saleOrder.currentOwner, _saleOrder.paymentReceiver, _hashPayment(_saleOrder.acceptedPaymentMode), _saleOrder.pfSaleFeeRate, _saleOrder.pfSaleFeeRateSecondary, _saleOrder.start, _saleOrder.end, _saleOrder.nonce, _saleOrder.version ) ); } else if (_saleOrder.version == 2) { // [v3] return keccak256( abi.encode( SALE_ORDER_TYPEHASH_V3, _hashAsset(_saleOrder.assetList, _saleOrder.version), _saleOrder.currentOwner, _saleOrder.paymentReceiver, _hashPayment(_saleOrder.acceptedPaymentMode), _saleOrder.pfSaleFeeRate, _saleOrder.pfSaleFeeRateSecondary, _saleOrder.start, _saleOrder.end, _saleOrder.nonce, _saleOrder.version ) ); } else { revert("E_OD3_IV"); } } /** * @dev Prepares keccak256 hash for BuyOrder * * @param _buyOrder OrderDomain.BuyOrder */ function _hashBuyOrder( BuyOrder calldata _buyOrder ) internal pure returns (bytes32) { if (_buyOrder.version == 0) { // [v1] return keccak256( abi.encode( BUY_ORDER_TYPEHASH, _buyOrder.saleNonce, _buyOrder.buyer, _buyOrder.payer, _hashPayment(_buyOrder.paymentDetails), _buyOrder.validUntil ) ); } else if (_buyOrder.version == 1 || _buyOrder.version == 2) { // [v2] or [v3] return keccak256( abi.encode( BUY_ORDER_TYPEHASH_V2, _buyOrder.saleNonce, _buyOrder.buyer, _buyOrder.payer, _buyOrder.firstAssetBuyValue, _hashPayment(_buyOrder.paymentDetails), _buyOrder.validUntil, _buyOrder.version ) ); } else { revert("E_OD3_IV"); } } // ---- EIP712 ---- /** * @dev Checks if it's a Secondary Sale * * @param _secondarySale uint8 */ function _isSecondarySale(uint8 _secondarySale) internal pure returns (bool) { return (_secondarySale == 1); } /** * @dev Checks if it's a valid origin kind * * @param _originKind bytes4 */ function _isValidOriginKind(bytes4 _originKind) internal pure returns (bool) { return (_originKind == NANAKUSA_ORIGIN_KIND || _originKind == PARTNER_ORIGIN_KIND); } /** * @dev Checks if it's a valid payment mode * * @param _paymentMode bytes4 */ function _isValidPaymentMode( bytes4 _paymentMode ) internal pure returns (bool) { return (_paymentMode == NATIVE_PAYMENT_MODE || _paymentMode == ERC20_PAYMENT_MODE || _paymentMode == CREDIT_CARD_PAYMENT_MODE || _paymentMode == OTHER_BLOCKCHAIN_PAYMENT_MODE); } /** * @dev Checks if payment mode is onchain * * @param _paymentMode bytes4 */ function _isOnchainPaymentMode( bytes4 _paymentMode ) internal pure returns (bool) { return (_paymentMode == NATIVE_PAYMENT_MODE || _paymentMode == ERC20_PAYMENT_MODE); } /** * @dev Checks if origin kind is partner * * @param _originKind bytes4 */ function _isPartnerOrigin(bytes4 _originKind) internal pure returns (bool) { return (_originKind == PARTNER_ORIGIN_KIND); } /** * @dev Find the total sale price by matching payment mode of SaleOrder and BuyOrder * * @param _saleOrder SaleOrder * @param _buyOrder BuyOrder */ function _findTotalSalePrice( SaleOrder calldata _saleOrder, BuyOrder calldata _buyOrder ) internal pure returns (uint256) { uint256 totalSalePrice = 0; // Find total sale price for (uint256 idx = 0; idx < _saleOrder.acceptedPaymentMode.length; idx++) { if ( _saleOrder.acceptedPaymentMode[idx].paymentMode == _buyOrder.paymentDetails.paymentMode ) { totalSalePrice = _saleOrder.acceptedPaymentMode[idx].price; break; } } return totalSalePrice; } }
Compiler Settings
{"outputSelection":{"*":{"*":["*"],"":["*"]}},"optimizer":{"runs":200,"enabled":true},"libraries":{}}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"trustedForwarder","internalType":"address"}]},{"type":"event","name":"AdminAdded","inputs":[{"type":"address","name":"","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"AdminChanged","inputs":[{"type":"address","name":"previousAdmin","internalType":"address","indexed":false},{"type":"address","name":"newAdmin","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"AdminRemoved","inputs":[{"type":"address","name":"","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"BeaconUpgraded","inputs":[{"type":"address","name":"beacon","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Initialized","inputs":[{"type":"uint8","name":"version","internalType":"uint8","indexed":false}],"anonymous":false},{"type":"event","name":"Paused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"PlatformRegistryUpdated","inputs":[{"type":"address","name":"platformRegistry","internalType":"contract IPlatformRegistry","indexed":true}],"anonymous":false},{"type":"event","name":"RoyaltyRegistryUpdated","inputs":[{"type":"address","name":"royaltyRegistry","internalType":"contract IRoyaltyRegistry","indexed":true}],"anonymous":false},{"type":"event","name":"SaleSingle","inputs":[{"type":"uint256","name":"nonce","internalType":"uint256","indexed":true},{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":true},{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"TransferProxyUpdated","inputs":[{"type":"address","name":"transferProxy","internalType":"contract ITransferProxy","indexed":true}],"anonymous":false},{"type":"event","name":"Unpaused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"Upgraded","inputs":[{"type":"address","name":"implementation","internalType":"address","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addAdmin","inputs":[{"type":"address[]","name":"newAdmin","internalType":"address[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addAdmin","inputs":[{"type":"address","name":"newAdmin","internalType":"address"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"exchange","inputs":[{"type":"tuple","name":"_saleOrder","internalType":"struct OrderDomainV3.SaleOrder","components":[{"type":"tuple[]","name":"assetList","internalType":"struct OrderDomainV3.Asset[]","components":[{"type":"bytes4","name":"originKind","internalType":"bytes4"},{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"uint256","name":"value","internalType":"uint256"},{"type":"uint16","name":"partnerFeeRate","internalType":"uint16"},{"type":"address","name":"partnerFeeReceiver","internalType":"address payable"},{"type":"uint8","name":"isSecondarySale","internalType":"uint8"},{"type":"address[]","name":"royaltyReceivers","internalType":"address[]"},{"type":"uint16[]","name":"royaltyDistributionRate","internalType":"uint16[]"},{"type":"uint16","name":"secondaryOnwardsRoyaltyPercentage","internalType":"uint16"}]},{"type":"address","name":"currentOwner","internalType":"address"},{"type":"address","name":"paymentReceiver","internalType":"address"},{"type":"tuple[]","name":"acceptedPaymentMode","internalType":"struct OrderDomainV3.Payment[]","components":[{"type":"bytes4","name":"paymentMode","internalType":"bytes4"},{"type":"address","name":"paymentToken","internalType":"address"},{"type":"uint256","name":"price","internalType":"uint256"}]},{"type":"uint16","name":"pfSaleFeeRate","internalType":"uint16"},{"type":"uint16","name":"pfSaleFeeRateSecondary","internalType":"uint16"},{"type":"uint256","name":"start","internalType":"uint256"},{"type":"uint256","name":"end","internalType":"uint256"},{"type":"uint256","name":"nonce","internalType":"uint256"},{"type":"uint8","name":"version","internalType":"uint8"}]},{"type":"bytes","name":"_salerSign","internalType":"bytes"},{"type":"tuple","name":"_buyOrder","internalType":"struct OrderDomainV3.BuyOrder","components":[{"type":"uint256","name":"saleNonce","internalType":"uint256"},{"type":"address","name":"buyer","internalType":"address payable"},{"type":"address","name":"payer","internalType":"address payable"},{"type":"uint256","name":"firstAssetBuyValue","internalType":"uint256"},{"type":"tuple","name":"paymentDetails","internalType":"struct OrderDomainV3.Payment","components":[{"type":"bytes4","name":"paymentMode","internalType":"bytes4"},{"type":"address","name":"paymentToken","internalType":"address"},{"type":"uint256","name":"price","internalType":"uint256"}]},{"type":"uint256","name":"validUntil","internalType":"uint256"},{"type":"uint8","name":"version","internalType":"uint8"}]},{"type":"bytes","name":"_platformSign","internalType":"bytes"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getSoldCountByKey","inputs":[{"type":"bytes32","name":"_saleKey","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getSoldCountByNonce","inputs":[{"type":"uint256","name":"_nonce","internalType":"uint256"},{"type":"address","name":"_token","internalType":"address"},{"type":"uint256","name":"_tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isAdmin","inputs":[{"type":"address","name":"checkAdmin","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isTrustedForwarder","inputs":[{"type":"address","name":"forwarder","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"pause","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"paused","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IPlatformRegistry"}],"name":"platformRegistry","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"proxiableUUID","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeAdmin","inputs":[{"type":"address","name":"admin","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IRoyaltyRegistry"}],"name":"royaltyRegistry","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"supportsInterface","inputs":[{"type":"bytes4","name":"_interfaceId","internalType":"bytes4"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract ITransferProxy"}],"name":"transferProxy","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unpause","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updatePlatformRegistry","inputs":[{"type":"address","name":"_newPlatformRegistry","internalType":"contract IPlatformRegistry"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateRoyaltyRegistry","inputs":[{"type":"address","name":"_newRoyaltyRegistry","internalType":"contract IRoyaltyRegistry"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateTransferProxy","inputs":[{"type":"address","name":"_newTransferProxy","internalType":"contract ITransferProxy"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"upgradeTo","inputs":[{"type":"address","name":"newImplementation","internalType":"address"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"upgradeToAndCall","inputs":[{"type":"address","name":"newImplementation","internalType":"address"},{"type":"bytes","name":"data","internalType":"bytes"}]},{"type":"function","stateMutability":"pure","outputs":[{"type":"uint8","name":"","internalType":"uint8"}],"name":"version","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdrawTip","inputs":[{"type":"address","name":"_receiver","internalType":"address payable"},{"type":"address","name":"_erc20Token","internalType":"address"}]}]
Contract Creation Code
0x60c06040523060a0523480156200001557600080fd5b5060405162004fe038038062004fe0833981016040819052620000389162000118565b6001600160a01b0381166080526200004f62000056565b506200014a565b600054610100900460ff1615620000c35760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff908116101562000116576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6000602082840312156200012b57600080fd5b81516001600160a01b03811681146200014357600080fd5b9392505050565b60805160a051614e4d62000193600039600081816107560152818161079601528181610a3201528181610a720152610b01015260008181610307015261324a0152614e4d6000f3fe6080604052600436106101405760003560e01c806354fd4d50116100b6578063704802751161006f57806370480275146103bb5780638456cb59146103db578063a11b0712146103f0578063c255f87814610411578063cc25319314610432578063cf1d53cf1461045257600080fd5b806354fd4d50146102ce578063572b6c05146102ea5780635c975abb14610337578063653551501461034f578063658c09a81461036f5780636e667db31461038257600080fd5b80633659cfe6116101085780633659cfe6146102315780633d0950a8146102515780633f4ba83a146102715780634c275cac146102865780634f1ef286146102a657806352d1902d146102b957600080fd5b806301ffc9a714610145578063132633401461017a5780631785f53c146101b657806318cdeccc146101d857806324d7806c146101f8575b600080fd5b34801561015157600080fd5b5061016561016036600461422a565b610472565b60405190151581526020015b60405180910390f35b34801561018657600080fd5b506101a8610195366004614245565b6000908152610197602052604090205490565b604051908152602001610171565b3480156101c257600080fd5b506101d66101d136600461427e565b6104a9565b005b3480156101e457600080fd5b506101d66101f336600461429b565b610589565b34801561020457600080fd5b5061016561021336600461427e565b6001600160a01b031660009081526099602052604090205460ff1690565b34801561023d57600080fd5b506101d661024c36600461427e565b61074c565b34801561025d57600080fd5b506101d661026c3660046142d4565b610828565b34801561027d57600080fd5b506101d66108b9565b34801561029257600080fd5b506101d66102a136600461427e565b610908565b6101d66102b43660046143b7565b610a28565b3480156102c557600080fd5b506101a8610af4565b3480156102da57600080fd5b5060405160028152602001610171565b3480156102f657600080fd5b5061016561030536600461427e565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0390811691161490565b34801561034357600080fd5b5060fe5460ff16610165565b34801561035b57600080fd5b506101d661036a36600461427e565b610ba7565b6101d661037d36600461449f565b610cc7565b34801561038e57600080fd5b50610195546103a3906001600160a01b031681565b6040516001600160a01b039091168152602001610171565b3480156103c757600080fd5b506101d66103d636600461427e565b611429565b3480156103e757600080fd5b506101d6611477565b3480156103fc57600080fd5b50610196546103a3906001600160a01b031681565b34801561041d57600080fd5b50610194546103a3906001600160a01b031681565b34801561043e57600080fd5b506101d661044d36600461427e565b6114c4565b34801561045e57600080fd5b506101a861046d36600461455e565b6115e4565b60006001600160e01b0319821663062e289f60e31b14806104a357506301ffc9a760e01b6001600160e01b03198316145b92915050565b609960006104b5611649565b6001600160a01b0316815260208101919091526040016000205460ff166104f75760405162461bcd60e51b81526004016104ee90614596565b60405180910390fd5b6001600160a01b03811660009081526099602052604090205460ff1661057d5760405162461bcd60e51b815260206004820152603560248201527f41646d696e3a72656d6f766541646d696e20747279696e6720746f2072656d6f6044820152743b32903737b71032bc34b9ba34b7339020b236b4b760591b60648201526084016104ee565b61058681611658565b50565b60996000610595611649565b6001600160a01b0316815260208101919091526040016000205460ff166105ce5760405162461bcd60e51b81526004016104ee90614596565b6001600160a01b03821661060f5760405162461bcd60e51b8152602060048201526008602482015267455f57545f49524160c01b60448201526064016104ee565b6001600160a01b038116610657576040516001600160a01b038316904780156108fc02916000818181858888f19350505050158015610652573d6000803e3d6000fd5b505050565b6001600160a01b038116600090815261019860205260408120905b815481101561072557600082828154811061068f5761068f6145dc565b60009182526020909120610195546002909202018054600182015460405163776062c360e01b81529294506001600160a01b039384169363776062c3936106df938a939216918b916004016145f2565b600060405180830381600087803b1580156106f957600080fd5b505af115801561070d573d6000803e3d6000fd5b5050505050808061071d90614632565b915050610672565b506001600160a01b03821660009081526101986020526040812061065291614194565b5050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036107945760405162461bcd60e51b81526004016104ee9061464b565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166107dd600080516020614dd1833981519152546001600160a01b031690565b6001600160a01b0316146108035760405162461bcd60e51b81526004016104ee90614697565b61080c816116b0565b60408051600080825260208201909252610586918391906116f5565b60996000610834611649565b6001600160a01b0316815260208101919091526040016000205460ff1661086d5760405162461bcd60e51b81526004016104ee90614596565b60005b81811015610652576108a783838381811061088d5761088d6145dc565b90506020020160208101906108a2919061427e565b611860565b806108b181614632565b915050610870565b609960006108c5611649565b6001600160a01b0316815260208101919091526040016000205460ff166108fe5760405162461bcd60e51b81526004016104ee90614596565b61090661191e565b565b60996000610914611649565b6001600160a01b0316815260208101919091526040016000205460ff1661094d5760405162461bcd60e51b81526004016104ee90614596565b6040516301ffc9a760e01b81526001600160a01b038216906301ffc9a7906109809063071d7d4b60e21b906004016146e3565b602060405180830381865afa15801561099d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109c191906146f8565b6109dd5760405162461bcd60e51b81526004016104ee9061471a565b61019580546001600160a01b0319166001600160a01b0383169081179091556040517fdf3b866248a7a3e982f0a93fde9cf30633ed3bb09365c16b08260ad033db920790600090a250565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163003610a705760405162461bcd60e51b81526004016104ee9061464b565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610ab9600080516020614dd1833981519152546001600160a01b031690565b6001600160a01b031614610adf5760405162461bcd60e51b81526004016104ee90614697565b610ae8826116b0565b610748828260016116f5565b6000306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610b945760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c000000000000000060648201526084016104ee565b50600080516020614dd183398151915290565b60996000610bb3611649565b6001600160a01b0316815260208101919091526040016000205460ff16610bec5760405162461bcd60e51b81526004016104ee90614596565b6040516301ffc9a760e01b81526001600160a01b038216906301ffc9a790610c1f9063042eca1d60e51b906004016146e3565b602060405180830381865afa158015610c3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6091906146f8565b610c7c5760405162461bcd60e51b81526004016104ee9061471a565b61019480546001600160a01b0319166001600160a01b0383169081179091556040517fa48d197b43b1826afcf98445392676fa169817dd3216002b6fd70e8601ef2b0190600090a250565b610ccf611976565b600260cc5403610d215760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016104ee565b600260cc556000610d3a61014088016101208901614753565b90506000610d47886119bc565b9050610d5888888888888887611c89565b6000610d648980614770565b6000818110610d7557610d756145dc565b9050602002810190610d8791906147b9565b610d90906148f0565b9050610daa610da560a088016080890161422a565b612972565b1561131b57610db76129a8565b6000610dc38a88612a14565b9050606087013515610e1d57610dd98a80614770565b6000818110610dea57610dea6145dc565b9050602002810190610dfc91906147b9565b60600135876060013582610e1091906149da565b610e1a91906149f1565b90505b63fdae1ba760e01b610e3560a0890160808a0161422a565b6001600160e01b03191603610e845780341015610e7f5760405162461bcd60e51b81526020600482015260086024820152671157d157d391539560c21b60448201526064016104ee565b611029565b6322ba176160e21b610e9c60a0890160808a0161422a565b6001600160e01b03191603611029576000610ebd60c0890160a08a0161427e565b905060006001600160a01b03821663dd62ed3e610ee060608c0160408d0161427e565b6101955460405160e084901b6001600160e01b03191681526001600160a01b03928316600482015291166024820152604401602060405180830381865afa158015610f2f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f539190614a13565b905082811015610f935760405162461bcd60e51b815260206004820152600b60248201526a0455f455f4e4545524332360ac1b60448201526064016104ee565b6000610f9f8483614a2c565b9050801561102557600060405180604001604052808c6040016020810190610fc7919061427e565b6001600160a01b0390811682526020918201859052868116600090815261019883526040812080546001808201835591835291849020855160029093020180546001600160a01b031916929093169190911782559290910151910155505b5050505b600061103b60608c0160408d0161427e565b9050600061104f60a08d0160808e01614a3f565b905060018660ff161015801561106c575060c084015160ff166001145b156110845761108160c08d0160a08e01614a3f565b90505b600061271061109761ffff8416866149da565b6110a191906149f1565b905061112661019460009054906101000a90046001600160a01b03166001600160a01b031663707d18486040518163ffffffff1660e01b81526004016020604051808303816000875af11580156110fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111209190614a5c565b82612ad3565b600061114686600001516001600160e01b03191663163b6d3b60e21b1490565b801561115a57506000866080015161ffff16115b1561125b5760a08601516001600160a01b0381166111ea5761019454602088015160405163342ce4cb60e11b81526001600160a01b039182166004820152911690636859c996906024016020604051808303816000875af11580156111c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111e79190614a5c565b90505b6001600160a01b03811661122c5760405162461bcd60e51b8152602060048201526009602482015268455f455f5046524e5360b81b60448201526064016104ee565b6080870151612710906112439061ffff16886149da565b61124d91906149f1565b91506112598183612ad3565b505b60c086015160009060ff1660010361127457508461128c565b8161127f8488614a2c565b6112899190614a2c565b90505b600061129988838c612b78565b90506112c48682856112ab888c614a2c565b6112b59190614a2c565b6112bf9190614a2c565b612ad3565b61130b8d60800160000160208101906112dd919061422a565b8e60800160200160208101906112f3919061427e565b8f6040016020810190611306919061427e565b612dc9565b6113136129a8565b505050505050505b61133561132e60408b0160208c0161427e565b8288612f07565b6060860135156113b75761135c896101000135826020015183604001518960600135613176565b806040015181602001516001600160a01b03168a61010001357f052aa775128ed1cbbd47b4948be31a03a0e96f23361fbabd94fde8e24aedfb0389606001356040516113aa91815260200190565b60405180910390a4611419565b6113c28260016131e9565b806040015181602001516001600160a01b03168a61010001357f052aa775128ed1cbbd47b4948be31a03a0e96f23361fbabd94fde8e24aedfb03846060015160405161141091815260200190565b60405180910390a45b5050600160cc5550505050505050565b60996000611435611649565b6001600160a01b0316815260208101919091526040016000205460ff1661146e5760405162461bcd60e51b81526004016104ee90614596565b61058681611860565b60996000611483611649565b6001600160a01b0316815260208101919091526040016000205460ff166114bc5760405162461bcd60e51b81526004016104ee90614596565b610906613208565b609960006114d0611649565b6001600160a01b0316815260208101919091526040016000205460ff166115095760405162461bcd60e51b81526004016104ee90614596565b6040516301ffc9a760e01b81526001600160a01b038216906301ffc9a79061153c90635a8c1c2960e01b906004016146e3565b602060405180830381865afa158015611559573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061157d91906146f8565b6115995760405162461bcd60e51b81526004016104ee9061471a565b61019680546001600160a01b0319166001600160a01b0383169081179091556040517f39753a6336ef533f6e1785dcab15abdacaf0467b09c6127c32053ad75bcefc6790600090a250565b6000610197600085858560405160200161161a939291909283526001600160a01b03919091166020830152604082015260600190565b6040516020818303038152906040528051906020012081526020019081526020016000205490505b9392505050565b6000611653613246565b905090565b6001600160a01b038116600081815260996020908152604091829020805460ff1916905590519182527fa3b62bc36326052d97ea62d63c3d60308ed4c3ea8ac079dd8499f1e9c4f80c0f91015b60405180910390a150565b609960006116bc611649565b6001600160a01b0316815260208101919091526040016000205460ff166105865760405162461bcd60e51b81526004016104ee90614596565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615611728576106528361328a565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015611782575060408051601f3d908101601f1916820190925261177f91810190614a13565b60015b6117e55760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b60648201526084016104ee565b600080516020614dd183398151915281146118545760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b60648201526084016104ee565b50610652838383613326565b6001600160a01b0381166118ca5760405162461bcd60e51b815260206004820152602b60248201527f41646d696e3a61646441646d696e206e657741646d696e20697320746865207a60448201526a65726f206164647265737360a81b60648201526084016104ee565b6001600160a01b038116600081815260996020908152604091829020805460ff1916600117905590519182527f44d6d25963f097ad14f29f06854a01f575648a1ef82f30e562ccd3889717e33991016116a5565b61192661334b565b60fe805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa611959611649565b6040516001600160a01b03909116815260200160405180910390a1565b60fe5460ff16156109065760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016104ee565b60006119d061014083016101208401614753565b60ff16600003611ae3577f39b77601008263a7668e3e906fb7170db776f21b4b101c313e63194c888f361d611a1f611a088480614770565b611a1a61014087016101208801614753565b613394565b611a2f604085016020860161427e565b611a3f606086016040870161427e565b611a54611a4f6060880188614a79565b613474565b611a6460a0880160808901614a3f565b6040805160208101979097528601949094526001600160a01b0392831660608601529116608084015260a083015261ffff1660c08281019190915283013560e08281019190915283013561010082810191909152830135610120820152610140015b604051602081830303815290604052805190602001209050919050565b611af561014083016101208401614753565b60ff16600103611c07577fd7db0db2ef492c99933d7c642ebe5da2a1b81a50be6ba5b0752806cad27c3cc1611b2d611a088480614770565b611b3d604085016020860161427e565b611b4d606086016040870161427e565b611b5d611a4f6060880188614a79565b611b6d60a0880160808901614a3f565b611b7d60c0890160a08a01614a3f565b60c089013560e08a01356101008b0135611b9f6101408d016101208e01614753565b60408051602081019c909c528b01999099526001600160a01b0397881660608b015296909516608089015260a088019390935261ffff91821660c08801521660e086015261010085015261012084015261014083015260ff1661016082015261018001611ac6565b611c1961014083016101208401614753565b60ff16600203611c51577f9f4eecad4a60dff4b37449aceb09bdac950063fc93d795c35ece8212883dffe2611b2d611a088480614770565b60405162461bcd60e51b815260206004820152600860248201526722afa7a219afa4ab60c11b60448201526064016104ee565b919050565b6000611c9d61014089016101208a01614753565b9050611cb161012086016101008701614753565b60ff168160ff1614611cf25760405162461bcd60e51b815260206004820152600a602482015269455f435046455f564d4d60b01b60448201526064016104ee565b611cfc8880614770565b9050600114611d3c5760405162461bcd60e51b815260206004820152600c60248201526b1157d0d4119157d254d3d05360a21b60448201526064016104ee565b6000611d488980614770565b6000818110611d5957611d596145dc565b9050602002810190611d6b91906147b9565b611d74906148f0565b60208101519091506001600160a01b0316611dbf5760405162461bcd60e51b815260206004820152600b60248201526a1157d0d4119157d4d0525560aa1b60448201526064016104ee565b8060400151600003611e025760405162461bcd60e51b815260206004820152600c60248201526b455f435046455f534149544960a01b60448201526064016104ee565b8560600135600003611e605760008381526101976020526040902054600103611e5b5760405162461bcd60e51b815260206004820152600b60248201526a1157d0d4119157d4d3d31160aa1b60448201526064016104ee565b611ecf565b6000611e7a8a6101000135836020015184604001516115e4565b9050808260600151611e8c9190614a2c565b87606001351115611ecd5760405162461bcd60e51b815260206004820152600b60248201526a1157d0d4119157d4d3d31160aa1b60448201526064016104ee565b505b428660e001351015611f0f5760405162461bcd60e51b8152602060048201526009602482015268455f435046455f454f60b81b60448201526064016104ee565b61019460009054906101000a90046001600160a01b03166001600160a01b031663f815d6cf6040518163ffffffff1660e01b81526004016020604051808303816000875af1158015611f65573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f899190614ac1565b61ffff16611f9d60a08b0160808c01614a3f565b61ffff161015611fe05760405162461bcd60e51b815260206004820152600e60248201526d1157d0d4119157d4d4119315131360921b60448201526064016104ee565b60018260ff16106120bc5761019460009054906101000a90046001600160a01b03166001600160a01b031663f815d6cf6040518163ffffffff1660e01b81526004016020604051808303816000875af1158015612041573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120659190614ac1565b61ffff1661207960c08b0160a08c01614a3f565b61ffff1610156120bc5760405162461bcd60e51b815260206004820152600e60248201526d1157d0d4119157d4d4119315131360921b60448201526064016104ee565b6322ba176160e21b6120d460a088016080890161422a565b6001600160e01b031916036121a857610194546001600160a01b0316635247385c61210560c0890160a08a0161427e565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015612149573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061216d91906146f8565b6121a85760405162461bcd60e51b815260206004820152600c60248201526b455f435046455f4250544e5760a01b60448201526064016104ee565b80516121b390613546565b6121ed5760405162461bcd60e51b815260206004820152600b60248201526a455f435046455f5341494f60a81b60448201526064016104ee565b6060810151156122385760018260ff1610156122385760405162461bcd60e51b815260206004820152600a602482015269455f435046455f564e4360b01b60448201526064016104ee565b60e0810151511561225c5761225c8160e0015182610100015183610120015161357c565b600061226e60408b0160208c0161427e565b6001600160a01b0316036122b25760405162461bcd60e51b815260206004820152600b60248201526a455f435046455f5349434f60a81b60448201526064016104ee565b60006122c460608b0160408c0161427e565b6001600160a01b0316036123085760405162461bcd60e51b815260206004820152600b60248201526a22afa1a82322afa9a4a82960a91b60448201526064016104ee565b60008960c001351180156123205750428960c0013511155b6123595760405162461bcd60e51b815260206004820152600a602482015269455f435046455f53495360b01b60448201526064016104ee565b60e0890135158061236d5750428960e00135115b6123a65760405162461bcd60e51b815260206004820152600a602482015269455f435046455f53494560b01b60448201526064016104ee565b8861010001356000036123e85760405162461bcd60e51b815260206004820152600a60248201526922afa1a82322afa9a4a760b11b60448201526064016104ee565b61010089013586351461242a5760405162461bcd60e51b815260206004820152600a60248201526922afa1a82322afa9a12760b11b60448201526064016104ee565b600061243c604088016020890161427e565b6001600160a01b03160361247f5760405162461bcd60e51b815260206004820152600a60248201526922afa1a82322afa124a160b11b60448201526064016104ee565b6000612491606088016040890161427e565b6001600160a01b0316036124d45760405162461bcd60e51b815260206004820152600a6024820152690455f435046455f4249560b41b60448201526064016104ee565b6124ec6124e760a088016080890161422a565b6136f1565b6125265760405162461bcd60e51b815260206004820152600b60248201526a455f435046455f4249504d60a81b60448201526064016104ee565b60c08601356000036125685760405162461bcd60e51b815260206004820152600b60248201526a0455f435046455f424f49560ac1b60448201526064016104ee565b612578604087016020880161427e565b6001600160a01b031661259160408b0160208c0161427e565b6001600160a01b0316036125d65760405162461bcd60e51b815260206004820152600c60248201526b455f435046455f434141425360a01b60448201526064016104ee565b6000805b6125e760608c018c614a79565b905081101561273f5761262661260060608d018d614a79565b83818110612610576126106145dc565b6124e7926020606090920201908101915061422a565b6126625760405162461bcd60e51b815260206004820152600d60248201526c455f435046455f5341504d504d60981b60448201526064016104ee565b61266f60608c018c614a79565b8281811061267f5761267f6145dc565b905060600201604001356000036126c85760405162461bcd60e51b815260206004820152600d60248201526c0455f435046455f5341504d495609c1b60448201526064016104ee565b6126d860a0890160808a0161422a565b6001600160e01b0319166126ef60608d018d614a79565b838181106126ff576126ff6145dc565b612715926020606090920201908101915061422a565b6001600160e01b0319160361272d576001915061273f565b8061273781614632565b9150506125da565b508061277b5760405162461bcd60e51b815260206004820152600b60248201526a455f435046455f504d4e4d60a81b60448201526064016104ee565b5050600061280888888080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061280292508791506127c7905061375d565b6040805161190160f01b6020808301919091526022820193909352604280820194909452815180820390940184526062019052815191012090565b906137d8565b905061281a60408a0160208b0161427e565b6001600160a01b0316816001600160a01b0316146128675760405162461bcd60e51b815260206004820152600a602482015269455f435046455f49535360b01b60448201526064016104ee565b6000612872876137f4565b90506128bc86868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061280292508591506127c7905061375d565b61019454604051631353b4cb60e21b81526001600160a01b038084166004830152929450911690634d4ed32c90602401602060405180830381865afa158015612909573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061292d91906146f8565b6129665760405162461bcd60e51b815260206004820152600a602482015269455f435046455f49505360b01b60448201526064016104ee565b50505050505050505050565b60006001600160e01b0319821663fdae1ba760e01b14806104a357506001600160e01b031982166322ba176160e21b1492915050565b60005b61019a54811015612a0657610199600061019a83815481106129cf576129cf6145dc565b60009182526020808320909101546001600160a01b03168352820192909252604001812055806129fe81614632565b9150506129ab565b5061090661019a60006141b5565b600080805b612a266060860186614a79565b9050811015612acb57612a3f60a085016080860161422a565b6001600160e01b031916612a566060870187614a79565b83818110612a6657612a666145dc565b612a7c926020606090920201908101915061422a565b6001600160e01b03191603612ab957612a986060860186614a79565b82818110612aa857612aa86145dc565b905060600201604001359150612acb565b80612ac381614632565b915050612a19565b509392505050565b8015610748576001600160a01b038216600090815261019960205260408120549003612b465761019a80546001810182556000919091527fd994f4dad00f9ff89caab117647e768aa59b274f965a222ec6a1586aa6e26bcb0180546001600160a01b0319166001600160a01b0384161790555b6001600160a01b0382166000908152610199602052604081208054839290612b6f908490614ade565b90915550505050565b61019654602084015160408086015160c08701519151634287115760e01b81526001600160a01b03938416600482015260248101919091526044810186905260ff909116606482015260009283926060928392859216906342871157906084016000604051808303816000875af1158015612bf7573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612c1f9190810190614b57565b91945092509050600260ff871610801590612c3957508251155b8015612c4a575060008860e0015151115b15612d4f5760e088015160c0890151909350879060ff16600103612c8d5761012089015161271090612c809061ffff168a6149da565b612c8a91906149f1565b90505b83516001600160401b03811115612ca657612ca6614348565b604051908082528060200260200182016040528015612ccf578160200160208202803683370190505b50925060005b8451811015612d4c5761271061ffff168a61010001518281518110612cfc57612cfc6145dc565b602002602001015161ffff1683612d1391906149da565b612d1d91906149f1565b848281518110612d2f57612d2f6145dc565b602090810291909101015280612d4481614632565b915050612cd5565b50505b60005b8351811015612dbc576000838281518110612d6f57612d6f6145dc565b60200260200101519050612d9c858381518110612d8e57612d8e6145dc565b602002602001015182612ad3565b612da68187614ade565b9550508080612db490614632565b915050612d52565b5092979650505050505050565b60005b61019a54811015612f0157600061019a8281548110612ded57612ded6145dc565b60009182526020808320909101546001600160a01b0316808352610199909152604090912054909150630251e45960e01b6001600160e01b0319871601612e6a576040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015612e64573d6000803e3d6000fd5b50612eec565b631d45e89f60e21b6001600160e01b0319871601612eec576101955460405163776062c360e01b81526001600160a01b039091169063776062c390612eb99088908890879087906004016145f2565b600060405180830381600087803b158015612ed357600080fd5b505af1158015612ee7573d6000803e3d6000fd5b505050505b50508080612ef990614632565b915050612dcc565b50505050565b81602001516001600160a01b03166301ffc9a76380ac58cd60e01b6040518263ffffffff1660e01b8152600401612f3e91906146e3565b602060405180830381865afa158015612f5b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f7f91906146f8565b1561300d57610195546020808401516001600160a01b039092169163f709b906918690612fb2906040870190870161427e565b86604001516040518563ffffffff1660e01b8152600401612fd694939291906145f2565b600060405180830381600087803b158015612ff057600080fd5b505af1158015613004573d6000803e3d6000fd5b50505050505050565b81602001516001600160a01b03166301ffc9a7636cdb3d1360e11b6040518263ffffffff1660e01b815260040161304491906146e3565b602060405180830381865afa158015613061573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061308591906146f8565b156131465760608083015190820135156130a0575060608101355b610195546020808501516001600160a01b0390921691639c1c2ee99187906130ce906040880190880161427e565b604080890151815180830183526002815261060f60f31b602082015291516001600160e01b031960e088901b16815261310e959493928991600401614c7b565b600060405180830381600087803b15801561312857600080fd5b505af115801561313c573d6000803e3d6000fd5b5050505050505050565b60405162461bcd60e51b81526020600482015260056024820152641157d5505560da1b60448201526064016104ee565b8061019760008686866040516020016131ab939291909283526001600160a01b03919091166020830152604082015260600190565b60405160208183030381529060405280519060200120815260200190815260200160002060008282546131de9190614ade565b909155505050505050565b6000828152610197602052604081208054839290612b6f908490614ade565b613210611976565b60fe805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611959611649565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03163303613285575060131936013560601c90565b503390565b6001600160a01b0381163b6132f75760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016104ee565b600080516020614dd183398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b61332f83613992565b60008251118061333c5750805b1561065257612f0183836139d2565b60fe5460ff166109065760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016104ee565b600080836001600160401b038111156133af576133af614348565b6040519080825280602002602001820160405280156133d8578160200160208202803683370190505b50905060005b84811015613442576134138686838181106133fb576133fb6145dc565b905060200281019061340d91906147b9565b85613ac6565b828281518110613425576134256145dc565b60209081029190910101528061343a81614632565b9150506133de565b50806040516020016134549190614cc9565b604051602081830303815290604052805190602001209150509392505050565b600080826001600160401b0381111561348f5761348f614348565b6040519080825280602002602001820160405280156134b8578160200160208202803683370190505b50905060005b83811015613515576134e68585838181106134db576134db6145dc565b905060600201613df9565b8282815181106134f8576134f86145dc565b60209081029190910101528061350d81614632565b9150506134be565b50806040516020016135279190614cc9565b6040516020818303038152906040528051906020012091505092915050565b60006001600160e01b03198216639e80de3760e01b14806104a357506001600160e01b0319821663163b6d3b60e21b1492915050565b81518351146135b95760405162461bcd60e51b81526020600482015260096024820152681157d5949257d2549160ba1b60448201526064016104ee565b6000805b8451811015613666578381815181106135d8576135d86145dc565b6020026020010151826135eb9190614cff565b915060006001600160a01b031685828151811061360a5761360a6145dc565b60200260200101516001600160a01b0316036136545760405162461bcd60e51b8152602060048201526009602482015268455f5652495f49524160b81b60448201526064016104ee565b8061365e81614632565b9150506135bd565b5061ffff8116612710146136ab5760405162461bcd60e51b815260206004820152600c60248201526b0455f5652495f52504e3130360a41b60448201526064016104ee565b61271061ffff83161115612f015760405162461bcd60e51b815260206004820152600d60248201526c0455f5652495f534f504731303609c1b60448201526064016104ee565b60006001600160e01b0319821663fdae1ba760e01b148061372257506001600160e01b031982166322ba176160e21b145b8061373d57506001600160e01b03198216633ecaa07960e21b145b806104a357506001600160e01b0319821663d5a81f1960e01b1492915050565b60006116537f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f61378c60015490565b6002546040805160208101859052908101839052606081018290524660808201523060a082015260009060c0016040516020818303038152906040528051906020012090509392505050565b60008060006137e78585613e73565b91509150612acb81613eb8565b600061380861012083016101008401614753565b60ff1660000361389f577f16533b1a2b574048998c15c61696aff2836a5106c01e21954538cf393cf8124a8235613845604085016020860161427e565b613855606086016040870161427e565b61386186608001613df9565b6040805160208101969096528501939093526001600160a01b03918216606085015216608083015260a082015260e08084013560c083015201611ac6565b6138b161012083016101008401614753565b60ff16600114806138d657506138cf61012083016101008401614753565b60ff166002145b15611c51577f02e75952f6dbd570765759927f425880efe915c78b4351b9f010366a3a15f8e0823561390e604085016020860161427e565b61391e606086016040870161427e565b856060013561392f87608001613df9565b60e08801356139466101208a016101008b01614753565b6040805160208101999099528801969096526001600160a01b03948516606088015293909216608086015260a085015260c084015260e083015260ff1661010082015261012001611ac6565b61399b8161328a565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b613a3a5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016104ee565b600080846001600160a01b031684604051613a559190614d21565b600060405180830381855af49150503d8060008114613a90576040519150601f19603f3d011682016040523d82523d6000602084013e613a95565b606091505b5091509150613abd8282604051806060016040528060278152602001614df16027913961406e565b95945050505050565b60008160ff16600003613b9c577fda89efe36e8d4174abec2b392e28fde5f06a39ea80761619c7690bf866064524613b01602085018561422a565b613b11604086016020870161427e565b6040860135613b2660a0880160808901614a3f565b613b3660e0890160c08a01614753565b6040805160208101979097526001600160e01b0319909516948601949094526001600160a01b039092166060850152608084015261ffff1660a083015260ff1660c082015260e0015b6040516020818303038152906040528051906020012090506104a3565b8160ff16600103613c7f577f711444f222b4586ccfaca2037481d3fab181017c88fc21fb2f78909a6953ba06613bd5602085018561422a565b613be5604086016020870161427e565b60408601356060870135613bff60a0890160808a01614a3f565b613c0f60c08a0160a08b0161427e565b613c1f60e08b0160c08c01614753565b6040805160208101999099526001600160e01b0319909716968801969096526001600160a01b039485166060880152608087019390935260a086019190915261ffff1660c08501521660e083015260ff1661010082015261012001613b7f565b8160ff16600203611c51577fbd60107b487bdfeb3ec8fcbfe07542913ceca85dc095c07f5cb6b97d028573cd613cb8602085018561422a565b613cc8604086016020870161427e565b60408601356060870135613ce260a0890160808a01614a3f565b613cf260c08a0160a08b0161427e565b613d0260e08b0160c08c01614753565b613d0f60e08c018c614770565b604051602001613d20929190614d33565b60408051601f198184030181529190528051602090910120613d466101008d018d614770565b604051602001613d57929190614d75565b60408051601f198184030181529190528051602090910120613d816101408e016101208f01614a3f565b60408051602081019c909c526001600160e01b0319909a16998b01999099526001600160a01b0397881660608b015260808a019690965260a089019490945261ffff92831660c0890152941660e087015260ff9093166101008601526101208501526101408401521661016082015261018001613b7f565b60007f5b442961536b72a0442e9a53df012289ed70f5c860457d810d2c17836bd8bdce613e29602084018461422a565b613e39604085016020860161427e565b6040805160208101949094526001600160e01b0319909216838301526001600160a01b03166060830152830135608082015260a001611ac6565b6000808251604103613ea95760208301516040840151606085015160001a613e9d878285856140a7565b94509450505050613eb1565b506000905060025b9250929050565b6000816004811115613ecc57613ecc614da7565b03613ed45750565b6001816004811115613ee857613ee8614da7565b03613f355760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016104ee565b6002816004811115613f4957613f49614da7565b03613f965760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016104ee565b6003816004811115613faa57613faa614da7565b036140025760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016104ee565b600481600481111561401657614016614da7565b036105865760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016104ee565b6060831561407d575081611642565b82511561408d5782518084602001fd5b8160405162461bcd60e51b81526004016104ee9190614dbd565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156140de575060009050600361418b565b8460ff16601b141580156140f657508460ff16601c14155b15614107575060009050600461418b565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561415b573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166141845760006001925092505061418b565b9150600090505b94509492505050565b508054600082556002029060005260206000209081019061058691906141d3565b508054600082559060005260206000209081019061058691906141fd565b5b808211156141f95780546001600160a01b0319168155600060018201556002016141d4565b5090565b5b808211156141f957600081556001016141fe565b80356001600160e01b031981168114611c8457600080fd5b60006020828403121561423c57600080fd5b61164282614212565b60006020828403121561425757600080fd5b5035919050565b6001600160a01b038116811461058657600080fd5b8035611c848161425e565b60006020828403121561429057600080fd5b81356116428161425e565b600080604083850312156142ae57600080fd5b82356142b98161425e565b915060208301356142c98161425e565b809150509250929050565b600080602083850312156142e757600080fd5b82356001600160401b03808211156142fe57600080fd5b818501915085601f83011261431257600080fd5b81358181111561432157600080fd5b8660208260051b850101111561433657600080fd5b60209290920196919550909350505050565b634e487b7160e01b600052604160045260246000fd5b60405161014081016001600160401b038111828210171561438157614381614348565b60405290565b604051601f8201601f191681016001600160401b03811182821017156143af576143af614348565b604052919050565b600080604083850312156143ca57600080fd5b82356143d58161425e565b91506020838101356001600160401b03808211156143f257600080fd5b818601915086601f83011261440657600080fd5b81358181111561441857614418614348565b61442a601f8201601f19168501614387565b9150808252878482850101111561444057600080fd5b80848401858401376000848284010152508093505050509250929050565b60008083601f84011261447057600080fd5b5081356001600160401b0381111561448757600080fd5b602083019150836020828501011115613eb157600080fd5b6000806000806000808688036101808112156144ba57600080fd5b87356001600160401b03808211156144d157600080fd5b90890190610140828c0312156144e657600080fd5b909750602089013590808211156144fc57600080fd5b6145088b838c0161445e565b9098509650869150610120603f198401121561452357600080fd5b60408a0195506101608a013592508083111561453e57600080fd5b505061454c89828a0161445e565b979a9699509497509295939492505050565b60008060006060848603121561457357600080fd5b8335925060208401356145858161425e565b929592945050506040919091013590565b60208082526026908201527f41646d696e3a6f6e6c7941646d696e2063616c6c6572206973206e6f7420616e6040820152651020b236b4b760d11b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b6001600160a01b039485168152928416602084015292166040820152606081019190915260800190565b634e487b7160e01b600052601160045260246000fd5b6000600182016146445761464461461c565b5060010190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b6001600160e01b031991909116815260200190565b60006020828403121561470a57600080fd5b8151801515811461164257600080fd5b602080825260059082015264455f494e5360d81b604082015260600190565b60ff8116811461058657600080fd5b8035611c8481614739565b60006020828403121561476557600080fd5b813561164281614739565b6000808335601e1984360301811261478757600080fd5b8301803591506001600160401b038211156147a157600080fd5b6020019150600581901b3603821315613eb157600080fd5b6000823561013e198336030181126147d057600080fd5b9190910192915050565b61ffff8116811461058657600080fd5b8035611c84816147da565b60006001600160401b0382111561480e5761480e614348565b5060051b60200190565b600082601f83011261482957600080fd5b8135602061483e614839836147f5565b614387565b82815260059290921b8401810191818101908684111561485d57600080fd5b8286015b848110156148815780356148748161425e565b8352918301918301614861565b509695505050505050565b600082601f83011261489d57600080fd5b813560206148ad614839836147f5565b82815260059290921b840181019181810190868411156148cc57600080fd5b8286015b848110156148815780356148e3816147da565b83529183019183016148d0565b6000610140823603121561490357600080fd5b61490b61435e565b61491483614212565b815261492260208401614273565b60208201526040830135604082015260608301356060820152614947608084016147ea565b608082015261495860a08401614273565b60a082015261496960c08401614748565b60c082015260e08301356001600160401b038082111561498857600080fd5b61499436838701614818565b60e0840152610100915081850135818111156149af57600080fd5b6149bb3682880161488c565b838501525050506101206149d08185016147ea565b9082015292915050565b80820281158282048414176104a3576104a361461c565b600082614a0e57634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215614a2557600080fd5b5051919050565b818103818111156104a3576104a361461c565b600060208284031215614a5157600080fd5b8135611642816147da565b600060208284031215614a6e57600080fd5b81516116428161425e565b6000808335601e19843603018112614a9057600080fd5b8301803591506001600160401b03821115614aaa57600080fd5b6020019150606081023603821315613eb157600080fd5b600060208284031215614ad357600080fd5b8151611642816147da565b808201808211156104a3576104a361461c565b600082601f830112614b0257600080fd5b81516020614b12614839836147f5565b82815260059290921b84018101918181019086841115614b3157600080fd5b8286015b848110156148815780518352918301918301614b35565b8051611c8481614739565b600080600060608486031215614b6c57600080fd5b83516001600160401b0380821115614b8357600080fd5b818601915086601f830112614b9757600080fd5b81516020614ba7614839836147f5565b82815260059290921b8401810191818101908a841115614bc657600080fd5b948201945b83861015614bed578551614bde8161425e565b82529482019490820190614bcb565b91890151919750909350505080821115614c0657600080fd5b50614c1386828701614af1565b925050614c2260408501614b4c565b90509250925092565b60005b83811015614c46578181015183820152602001614c2e565b50506000910152565b60008151808452614c67816020860160208601614c2b565b601f01601f19169290920160200192915050565b6001600160a01b038781168252868116602083015285166040820152606081018490526080810183905260c060a08201819052600090614cbd90830184614c4f565b98975050505050505050565b815160009082906020808601845b83811015614cf357815185529382019390820190600101614cd7565b50929695505050505050565b61ffff818116838216019080821115614d1a57614d1a61461c565b5092915050565b600082516147d0818460208701614c2b565b60008184825b85811015614d6a578135614d4c8161425e565b6001600160a01b031683526020928301929190910190600101614d39565b509095945050505050565b60008184825b85811015614d6a578135614d8e816147da565b61ffff1683526020928301929190910190600101614d7b565b634e487b7160e01b600052602160045260246000fd5b6020815260006116426020830184614c4f56fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220cad4be57dc627ab82ce9cb90fb0a579c29143058a8c0c92266d1ee3945088f1b64736f6c63430008130033000000000000000000000000307e7a9713dbf6f19a2d2a2b670544f4791c4ec2
Deployed ByteCode
0x6080604052600436106101405760003560e01c806354fd4d50116100b6578063704802751161006f57806370480275146103bb5780638456cb59146103db578063a11b0712146103f0578063c255f87814610411578063cc25319314610432578063cf1d53cf1461045257600080fd5b806354fd4d50146102ce578063572b6c05146102ea5780635c975abb14610337578063653551501461034f578063658c09a81461036f5780636e667db31461038257600080fd5b80633659cfe6116101085780633659cfe6146102315780633d0950a8146102515780633f4ba83a146102715780634c275cac146102865780634f1ef286146102a657806352d1902d146102b957600080fd5b806301ffc9a714610145578063132633401461017a5780631785f53c146101b657806318cdeccc146101d857806324d7806c146101f8575b600080fd5b34801561015157600080fd5b5061016561016036600461422a565b610472565b60405190151581526020015b60405180910390f35b34801561018657600080fd5b506101a8610195366004614245565b6000908152610197602052604090205490565b604051908152602001610171565b3480156101c257600080fd5b506101d66101d136600461427e565b6104a9565b005b3480156101e457600080fd5b506101d66101f336600461429b565b610589565b34801561020457600080fd5b5061016561021336600461427e565b6001600160a01b031660009081526099602052604090205460ff1690565b34801561023d57600080fd5b506101d661024c36600461427e565b61074c565b34801561025d57600080fd5b506101d661026c3660046142d4565b610828565b34801561027d57600080fd5b506101d66108b9565b34801561029257600080fd5b506101d66102a136600461427e565b610908565b6101d66102b43660046143b7565b610a28565b3480156102c557600080fd5b506101a8610af4565b3480156102da57600080fd5b5060405160028152602001610171565b3480156102f657600080fd5b5061016561030536600461427e565b7f000000000000000000000000307e7a9713dbf6f19a2d2a2b670544f4791c4ec26001600160a01b0390811691161490565b34801561034357600080fd5b5060fe5460ff16610165565b34801561035b57600080fd5b506101d661036a36600461427e565b610ba7565b6101d661037d36600461449f565b610cc7565b34801561038e57600080fd5b50610195546103a3906001600160a01b031681565b6040516001600160a01b039091168152602001610171565b3480156103c757600080fd5b506101d66103d636600461427e565b611429565b3480156103e757600080fd5b506101d6611477565b3480156103fc57600080fd5b50610196546103a3906001600160a01b031681565b34801561041d57600080fd5b50610194546103a3906001600160a01b031681565b34801561043e57600080fd5b506101d661044d36600461427e565b6114c4565b34801561045e57600080fd5b506101a861046d36600461455e565b6115e4565b60006001600160e01b0319821663062e289f60e31b14806104a357506301ffc9a760e01b6001600160e01b03198316145b92915050565b609960006104b5611649565b6001600160a01b0316815260208101919091526040016000205460ff166104f75760405162461bcd60e51b81526004016104ee90614596565b60405180910390fd5b6001600160a01b03811660009081526099602052604090205460ff1661057d5760405162461bcd60e51b815260206004820152603560248201527f41646d696e3a72656d6f766541646d696e20747279696e6720746f2072656d6f6044820152743b32903737b71032bc34b9ba34b7339020b236b4b760591b60648201526084016104ee565b61058681611658565b50565b60996000610595611649565b6001600160a01b0316815260208101919091526040016000205460ff166105ce5760405162461bcd60e51b81526004016104ee90614596565b6001600160a01b03821661060f5760405162461bcd60e51b8152602060048201526008602482015267455f57545f49524160c01b60448201526064016104ee565b6001600160a01b038116610657576040516001600160a01b038316904780156108fc02916000818181858888f19350505050158015610652573d6000803e3d6000fd5b505050565b6001600160a01b038116600090815261019860205260408120905b815481101561072557600082828154811061068f5761068f6145dc565b60009182526020909120610195546002909202018054600182015460405163776062c360e01b81529294506001600160a01b039384169363776062c3936106df938a939216918b916004016145f2565b600060405180830381600087803b1580156106f957600080fd5b505af115801561070d573d6000803e3d6000fd5b5050505050808061071d90614632565b915050610672565b506001600160a01b03821660009081526101986020526040812061065291614194565b5050565b6001600160a01b037f00000000000000000000000087533f126700ae06acaeba7e29c5cf71261c08251630036107945760405162461bcd60e51b81526004016104ee9061464b565b7f00000000000000000000000087533f126700ae06acaeba7e29c5cf71261c08256001600160a01b03166107dd600080516020614dd1833981519152546001600160a01b031690565b6001600160a01b0316146108035760405162461bcd60e51b81526004016104ee90614697565b61080c816116b0565b60408051600080825260208201909252610586918391906116f5565b60996000610834611649565b6001600160a01b0316815260208101919091526040016000205460ff1661086d5760405162461bcd60e51b81526004016104ee90614596565b60005b81811015610652576108a783838381811061088d5761088d6145dc565b90506020020160208101906108a2919061427e565b611860565b806108b181614632565b915050610870565b609960006108c5611649565b6001600160a01b0316815260208101919091526040016000205460ff166108fe5760405162461bcd60e51b81526004016104ee90614596565b61090661191e565b565b60996000610914611649565b6001600160a01b0316815260208101919091526040016000205460ff1661094d5760405162461bcd60e51b81526004016104ee90614596565b6040516301ffc9a760e01b81526001600160a01b038216906301ffc9a7906109809063071d7d4b60e21b906004016146e3565b602060405180830381865afa15801561099d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109c191906146f8565b6109dd5760405162461bcd60e51b81526004016104ee9061471a565b61019580546001600160a01b0319166001600160a01b0383169081179091556040517fdf3b866248a7a3e982f0a93fde9cf30633ed3bb09365c16b08260ad033db920790600090a250565b6001600160a01b037f00000000000000000000000087533f126700ae06acaeba7e29c5cf71261c0825163003610a705760405162461bcd60e51b81526004016104ee9061464b565b7f00000000000000000000000087533f126700ae06acaeba7e29c5cf71261c08256001600160a01b0316610ab9600080516020614dd1833981519152546001600160a01b031690565b6001600160a01b031614610adf5760405162461bcd60e51b81526004016104ee90614697565b610ae8826116b0565b610748828260016116f5565b6000306001600160a01b037f00000000000000000000000087533f126700ae06acaeba7e29c5cf71261c08251614610b945760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c000000000000000060648201526084016104ee565b50600080516020614dd183398151915290565b60996000610bb3611649565b6001600160a01b0316815260208101919091526040016000205460ff16610bec5760405162461bcd60e51b81526004016104ee90614596565b6040516301ffc9a760e01b81526001600160a01b038216906301ffc9a790610c1f9063042eca1d60e51b906004016146e3565b602060405180830381865afa158015610c3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6091906146f8565b610c7c5760405162461bcd60e51b81526004016104ee9061471a565b61019480546001600160a01b0319166001600160a01b0383169081179091556040517fa48d197b43b1826afcf98445392676fa169817dd3216002b6fd70e8601ef2b0190600090a250565b610ccf611976565b600260cc5403610d215760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016104ee565b600260cc556000610d3a61014088016101208901614753565b90506000610d47886119bc565b9050610d5888888888888887611c89565b6000610d648980614770565b6000818110610d7557610d756145dc565b9050602002810190610d8791906147b9565b610d90906148f0565b9050610daa610da560a088016080890161422a565b612972565b1561131b57610db76129a8565b6000610dc38a88612a14565b9050606087013515610e1d57610dd98a80614770565b6000818110610dea57610dea6145dc565b9050602002810190610dfc91906147b9565b60600135876060013582610e1091906149da565b610e1a91906149f1565b90505b63fdae1ba760e01b610e3560a0890160808a0161422a565b6001600160e01b03191603610e845780341015610e7f5760405162461bcd60e51b81526020600482015260086024820152671157d157d391539560c21b60448201526064016104ee565b611029565b6322ba176160e21b610e9c60a0890160808a0161422a565b6001600160e01b03191603611029576000610ebd60c0890160a08a0161427e565b905060006001600160a01b03821663dd62ed3e610ee060608c0160408d0161427e565b6101955460405160e084901b6001600160e01b03191681526001600160a01b03928316600482015291166024820152604401602060405180830381865afa158015610f2f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f539190614a13565b905082811015610f935760405162461bcd60e51b815260206004820152600b60248201526a0455f455f4e4545524332360ac1b60448201526064016104ee565b6000610f9f8483614a2c565b9050801561102557600060405180604001604052808c6040016020810190610fc7919061427e565b6001600160a01b0390811682526020918201859052868116600090815261019883526040812080546001808201835591835291849020855160029093020180546001600160a01b031916929093169190911782559290910151910155505b5050505b600061103b60608c0160408d0161427e565b9050600061104f60a08d0160808e01614a3f565b905060018660ff161015801561106c575060c084015160ff166001145b156110845761108160c08d0160a08e01614a3f565b90505b600061271061109761ffff8416866149da565b6110a191906149f1565b905061112661019460009054906101000a90046001600160a01b03166001600160a01b031663707d18486040518163ffffffff1660e01b81526004016020604051808303816000875af11580156110fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111209190614a5c565b82612ad3565b600061114686600001516001600160e01b03191663163b6d3b60e21b1490565b801561115a57506000866080015161ffff16115b1561125b5760a08601516001600160a01b0381166111ea5761019454602088015160405163342ce4cb60e11b81526001600160a01b039182166004820152911690636859c996906024016020604051808303816000875af11580156111c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111e79190614a5c565b90505b6001600160a01b03811661122c5760405162461bcd60e51b8152602060048201526009602482015268455f455f5046524e5360b81b60448201526064016104ee565b6080870151612710906112439061ffff16886149da565b61124d91906149f1565b91506112598183612ad3565b505b60c086015160009060ff1660010361127457508461128c565b8161127f8488614a2c565b6112899190614a2c565b90505b600061129988838c612b78565b90506112c48682856112ab888c614a2c565b6112b59190614a2c565b6112bf9190614a2c565b612ad3565b61130b8d60800160000160208101906112dd919061422a565b8e60800160200160208101906112f3919061427e565b8f6040016020810190611306919061427e565b612dc9565b6113136129a8565b505050505050505b61133561132e60408b0160208c0161427e565b8288612f07565b6060860135156113b75761135c896101000135826020015183604001518960600135613176565b806040015181602001516001600160a01b03168a61010001357f052aa775128ed1cbbd47b4948be31a03a0e96f23361fbabd94fde8e24aedfb0389606001356040516113aa91815260200190565b60405180910390a4611419565b6113c28260016131e9565b806040015181602001516001600160a01b03168a61010001357f052aa775128ed1cbbd47b4948be31a03a0e96f23361fbabd94fde8e24aedfb03846060015160405161141091815260200190565b60405180910390a45b5050600160cc5550505050505050565b60996000611435611649565b6001600160a01b0316815260208101919091526040016000205460ff1661146e5760405162461bcd60e51b81526004016104ee90614596565b61058681611860565b60996000611483611649565b6001600160a01b0316815260208101919091526040016000205460ff166114bc5760405162461bcd60e51b81526004016104ee90614596565b610906613208565b609960006114d0611649565b6001600160a01b0316815260208101919091526040016000205460ff166115095760405162461bcd60e51b81526004016104ee90614596565b6040516301ffc9a760e01b81526001600160a01b038216906301ffc9a79061153c90635a8c1c2960e01b906004016146e3565b602060405180830381865afa158015611559573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061157d91906146f8565b6115995760405162461bcd60e51b81526004016104ee9061471a565b61019680546001600160a01b0319166001600160a01b0383169081179091556040517f39753a6336ef533f6e1785dcab15abdacaf0467b09c6127c32053ad75bcefc6790600090a250565b6000610197600085858560405160200161161a939291909283526001600160a01b03919091166020830152604082015260600190565b6040516020818303038152906040528051906020012081526020019081526020016000205490505b9392505050565b6000611653613246565b905090565b6001600160a01b038116600081815260996020908152604091829020805460ff1916905590519182527fa3b62bc36326052d97ea62d63c3d60308ed4c3ea8ac079dd8499f1e9c4f80c0f91015b60405180910390a150565b609960006116bc611649565b6001600160a01b0316815260208101919091526040016000205460ff166105865760405162461bcd60e51b81526004016104ee90614596565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615611728576106528361328a565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015611782575060408051601f3d908101601f1916820190925261177f91810190614a13565b60015b6117e55760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b60648201526084016104ee565b600080516020614dd183398151915281146118545760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b60648201526084016104ee565b50610652838383613326565b6001600160a01b0381166118ca5760405162461bcd60e51b815260206004820152602b60248201527f41646d696e3a61646441646d696e206e657741646d696e20697320746865207a60448201526a65726f206164647265737360a81b60648201526084016104ee565b6001600160a01b038116600081815260996020908152604091829020805460ff1916600117905590519182527f44d6d25963f097ad14f29f06854a01f575648a1ef82f30e562ccd3889717e33991016116a5565b61192661334b565b60fe805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa611959611649565b6040516001600160a01b03909116815260200160405180910390a1565b60fe5460ff16156109065760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016104ee565b60006119d061014083016101208401614753565b60ff16600003611ae3577f39b77601008263a7668e3e906fb7170db776f21b4b101c313e63194c888f361d611a1f611a088480614770565b611a1a61014087016101208801614753565b613394565b611a2f604085016020860161427e565b611a3f606086016040870161427e565b611a54611a4f6060880188614a79565b613474565b611a6460a0880160808901614a3f565b6040805160208101979097528601949094526001600160a01b0392831660608601529116608084015260a083015261ffff1660c08281019190915283013560e08281019190915283013561010082810191909152830135610120820152610140015b604051602081830303815290604052805190602001209050919050565b611af561014083016101208401614753565b60ff16600103611c07577fd7db0db2ef492c99933d7c642ebe5da2a1b81a50be6ba5b0752806cad27c3cc1611b2d611a088480614770565b611b3d604085016020860161427e565b611b4d606086016040870161427e565b611b5d611a4f6060880188614a79565b611b6d60a0880160808901614a3f565b611b7d60c0890160a08a01614a3f565b60c089013560e08a01356101008b0135611b9f6101408d016101208e01614753565b60408051602081019c909c528b01999099526001600160a01b0397881660608b015296909516608089015260a088019390935261ffff91821660c08801521660e086015261010085015261012084015261014083015260ff1661016082015261018001611ac6565b611c1961014083016101208401614753565b60ff16600203611c51577f9f4eecad4a60dff4b37449aceb09bdac950063fc93d795c35ece8212883dffe2611b2d611a088480614770565b60405162461bcd60e51b815260206004820152600860248201526722afa7a219afa4ab60c11b60448201526064016104ee565b919050565b6000611c9d61014089016101208a01614753565b9050611cb161012086016101008701614753565b60ff168160ff1614611cf25760405162461bcd60e51b815260206004820152600a602482015269455f435046455f564d4d60b01b60448201526064016104ee565b611cfc8880614770565b9050600114611d3c5760405162461bcd60e51b815260206004820152600c60248201526b1157d0d4119157d254d3d05360a21b60448201526064016104ee565b6000611d488980614770565b6000818110611d5957611d596145dc565b9050602002810190611d6b91906147b9565b611d74906148f0565b60208101519091506001600160a01b0316611dbf5760405162461bcd60e51b815260206004820152600b60248201526a1157d0d4119157d4d0525560aa1b60448201526064016104ee565b8060400151600003611e025760405162461bcd60e51b815260206004820152600c60248201526b455f435046455f534149544960a01b60448201526064016104ee565b8560600135600003611e605760008381526101976020526040902054600103611e5b5760405162461bcd60e51b815260206004820152600b60248201526a1157d0d4119157d4d3d31160aa1b60448201526064016104ee565b611ecf565b6000611e7a8a6101000135836020015184604001516115e4565b9050808260600151611e8c9190614a2c565b87606001351115611ecd5760405162461bcd60e51b815260206004820152600b60248201526a1157d0d4119157d4d3d31160aa1b60448201526064016104ee565b505b428660e001351015611f0f5760405162461bcd60e51b8152602060048201526009602482015268455f435046455f454f60b81b60448201526064016104ee565b61019460009054906101000a90046001600160a01b03166001600160a01b031663f815d6cf6040518163ffffffff1660e01b81526004016020604051808303816000875af1158015611f65573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f899190614ac1565b61ffff16611f9d60a08b0160808c01614a3f565b61ffff161015611fe05760405162461bcd60e51b815260206004820152600e60248201526d1157d0d4119157d4d4119315131360921b60448201526064016104ee565b60018260ff16106120bc5761019460009054906101000a90046001600160a01b03166001600160a01b031663f815d6cf6040518163ffffffff1660e01b81526004016020604051808303816000875af1158015612041573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120659190614ac1565b61ffff1661207960c08b0160a08c01614a3f565b61ffff1610156120bc5760405162461bcd60e51b815260206004820152600e60248201526d1157d0d4119157d4d4119315131360921b60448201526064016104ee565b6322ba176160e21b6120d460a088016080890161422a565b6001600160e01b031916036121a857610194546001600160a01b0316635247385c61210560c0890160a08a0161427e565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015612149573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061216d91906146f8565b6121a85760405162461bcd60e51b815260206004820152600c60248201526b455f435046455f4250544e5760a01b60448201526064016104ee565b80516121b390613546565b6121ed5760405162461bcd60e51b815260206004820152600b60248201526a455f435046455f5341494f60a81b60448201526064016104ee565b6060810151156122385760018260ff1610156122385760405162461bcd60e51b815260206004820152600a602482015269455f435046455f564e4360b01b60448201526064016104ee565b60e0810151511561225c5761225c8160e0015182610100015183610120015161357c565b600061226e60408b0160208c0161427e565b6001600160a01b0316036122b25760405162461bcd60e51b815260206004820152600b60248201526a455f435046455f5349434f60a81b60448201526064016104ee565b60006122c460608b0160408c0161427e565b6001600160a01b0316036123085760405162461bcd60e51b815260206004820152600b60248201526a22afa1a82322afa9a4a82960a91b60448201526064016104ee565b60008960c001351180156123205750428960c0013511155b6123595760405162461bcd60e51b815260206004820152600a602482015269455f435046455f53495360b01b60448201526064016104ee565b60e0890135158061236d5750428960e00135115b6123a65760405162461bcd60e51b815260206004820152600a602482015269455f435046455f53494560b01b60448201526064016104ee565b8861010001356000036123e85760405162461bcd60e51b815260206004820152600a60248201526922afa1a82322afa9a4a760b11b60448201526064016104ee565b61010089013586351461242a5760405162461bcd60e51b815260206004820152600a60248201526922afa1a82322afa9a12760b11b60448201526064016104ee565b600061243c604088016020890161427e565b6001600160a01b03160361247f5760405162461bcd60e51b815260206004820152600a60248201526922afa1a82322afa124a160b11b60448201526064016104ee565b6000612491606088016040890161427e565b6001600160a01b0316036124d45760405162461bcd60e51b815260206004820152600a6024820152690455f435046455f4249560b41b60448201526064016104ee565b6124ec6124e760a088016080890161422a565b6136f1565b6125265760405162461bcd60e51b815260206004820152600b60248201526a455f435046455f4249504d60a81b60448201526064016104ee565b60c08601356000036125685760405162461bcd60e51b815260206004820152600b60248201526a0455f435046455f424f49560ac1b60448201526064016104ee565b612578604087016020880161427e565b6001600160a01b031661259160408b0160208c0161427e565b6001600160a01b0316036125d65760405162461bcd60e51b815260206004820152600c60248201526b455f435046455f434141425360a01b60448201526064016104ee565b6000805b6125e760608c018c614a79565b905081101561273f5761262661260060608d018d614a79565b83818110612610576126106145dc565b6124e7926020606090920201908101915061422a565b6126625760405162461bcd60e51b815260206004820152600d60248201526c455f435046455f5341504d504d60981b60448201526064016104ee565b61266f60608c018c614a79565b8281811061267f5761267f6145dc565b905060600201604001356000036126c85760405162461bcd60e51b815260206004820152600d60248201526c0455f435046455f5341504d495609c1b60448201526064016104ee565b6126d860a0890160808a0161422a565b6001600160e01b0319166126ef60608d018d614a79565b838181106126ff576126ff6145dc565b612715926020606090920201908101915061422a565b6001600160e01b0319160361272d576001915061273f565b8061273781614632565b9150506125da565b508061277b5760405162461bcd60e51b815260206004820152600b60248201526a455f435046455f504d4e4d60a81b60448201526064016104ee565b5050600061280888888080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061280292508791506127c7905061375d565b6040805161190160f01b6020808301919091526022820193909352604280820194909452815180820390940184526062019052815191012090565b906137d8565b905061281a60408a0160208b0161427e565b6001600160a01b0316816001600160a01b0316146128675760405162461bcd60e51b815260206004820152600a602482015269455f435046455f49535360b01b60448201526064016104ee565b6000612872876137f4565b90506128bc86868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061280292508591506127c7905061375d565b61019454604051631353b4cb60e21b81526001600160a01b038084166004830152929450911690634d4ed32c90602401602060405180830381865afa158015612909573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061292d91906146f8565b6129665760405162461bcd60e51b815260206004820152600a602482015269455f435046455f49505360b01b60448201526064016104ee565b50505050505050505050565b60006001600160e01b0319821663fdae1ba760e01b14806104a357506001600160e01b031982166322ba176160e21b1492915050565b60005b61019a54811015612a0657610199600061019a83815481106129cf576129cf6145dc565b60009182526020808320909101546001600160a01b03168352820192909252604001812055806129fe81614632565b9150506129ab565b5061090661019a60006141b5565b600080805b612a266060860186614a79565b9050811015612acb57612a3f60a085016080860161422a565b6001600160e01b031916612a566060870187614a79565b83818110612a6657612a666145dc565b612a7c926020606090920201908101915061422a565b6001600160e01b03191603612ab957612a986060860186614a79565b82818110612aa857612aa86145dc565b905060600201604001359150612acb565b80612ac381614632565b915050612a19565b509392505050565b8015610748576001600160a01b038216600090815261019960205260408120549003612b465761019a80546001810182556000919091527fd994f4dad00f9ff89caab117647e768aa59b274f965a222ec6a1586aa6e26bcb0180546001600160a01b0319166001600160a01b0384161790555b6001600160a01b0382166000908152610199602052604081208054839290612b6f908490614ade565b90915550505050565b61019654602084015160408086015160c08701519151634287115760e01b81526001600160a01b03938416600482015260248101919091526044810186905260ff909116606482015260009283926060928392859216906342871157906084016000604051808303816000875af1158015612bf7573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612c1f9190810190614b57565b91945092509050600260ff871610801590612c3957508251155b8015612c4a575060008860e0015151115b15612d4f5760e088015160c0890151909350879060ff16600103612c8d5761012089015161271090612c809061ffff168a6149da565b612c8a91906149f1565b90505b83516001600160401b03811115612ca657612ca6614348565b604051908082528060200260200182016040528015612ccf578160200160208202803683370190505b50925060005b8451811015612d4c5761271061ffff168a61010001518281518110612cfc57612cfc6145dc565b602002602001015161ffff1683612d1391906149da565b612d1d91906149f1565b848281518110612d2f57612d2f6145dc565b602090810291909101015280612d4481614632565b915050612cd5565b50505b60005b8351811015612dbc576000838281518110612d6f57612d6f6145dc565b60200260200101519050612d9c858381518110612d8e57612d8e6145dc565b602002602001015182612ad3565b612da68187614ade565b9550508080612db490614632565b915050612d52565b5092979650505050505050565b60005b61019a54811015612f0157600061019a8281548110612ded57612ded6145dc565b60009182526020808320909101546001600160a01b0316808352610199909152604090912054909150630251e45960e01b6001600160e01b0319871601612e6a576040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015612e64573d6000803e3d6000fd5b50612eec565b631d45e89f60e21b6001600160e01b0319871601612eec576101955460405163776062c360e01b81526001600160a01b039091169063776062c390612eb99088908890879087906004016145f2565b600060405180830381600087803b158015612ed357600080fd5b505af1158015612ee7573d6000803e3d6000fd5b505050505b50508080612ef990614632565b915050612dcc565b50505050565b81602001516001600160a01b03166301ffc9a76380ac58cd60e01b6040518263ffffffff1660e01b8152600401612f3e91906146e3565b602060405180830381865afa158015612f5b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f7f91906146f8565b1561300d57610195546020808401516001600160a01b039092169163f709b906918690612fb2906040870190870161427e565b86604001516040518563ffffffff1660e01b8152600401612fd694939291906145f2565b600060405180830381600087803b158015612ff057600080fd5b505af1158015613004573d6000803e3d6000fd5b50505050505050565b81602001516001600160a01b03166301ffc9a7636cdb3d1360e11b6040518263ffffffff1660e01b815260040161304491906146e3565b602060405180830381865afa158015613061573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061308591906146f8565b156131465760608083015190820135156130a0575060608101355b610195546020808501516001600160a01b0390921691639c1c2ee99187906130ce906040880190880161427e565b604080890151815180830183526002815261060f60f31b602082015291516001600160e01b031960e088901b16815261310e959493928991600401614c7b565b600060405180830381600087803b15801561312857600080fd5b505af115801561313c573d6000803e3d6000fd5b5050505050505050565b60405162461bcd60e51b81526020600482015260056024820152641157d5505560da1b60448201526064016104ee565b8061019760008686866040516020016131ab939291909283526001600160a01b03919091166020830152604082015260600190565b60405160208183030381529060405280519060200120815260200190815260200160002060008282546131de9190614ade565b909155505050505050565b6000828152610197602052604081208054839290612b6f908490614ade565b613210611976565b60fe805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611959611649565b60007f000000000000000000000000307e7a9713dbf6f19a2d2a2b670544f4791c4ec26001600160a01b03163303613285575060131936013560601c90565b503390565b6001600160a01b0381163b6132f75760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016104ee565b600080516020614dd183398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b61332f83613992565b60008251118061333c5750805b1561065257612f0183836139d2565b60fe5460ff166109065760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016104ee565b600080836001600160401b038111156133af576133af614348565b6040519080825280602002602001820160405280156133d8578160200160208202803683370190505b50905060005b84811015613442576134138686838181106133fb576133fb6145dc565b905060200281019061340d91906147b9565b85613ac6565b828281518110613425576134256145dc565b60209081029190910101528061343a81614632565b9150506133de565b50806040516020016134549190614cc9565b604051602081830303815290604052805190602001209150509392505050565b600080826001600160401b0381111561348f5761348f614348565b6040519080825280602002602001820160405280156134b8578160200160208202803683370190505b50905060005b83811015613515576134e68585838181106134db576134db6145dc565b905060600201613df9565b8282815181106134f8576134f86145dc565b60209081029190910101528061350d81614632565b9150506134be565b50806040516020016135279190614cc9565b6040516020818303038152906040528051906020012091505092915050565b60006001600160e01b03198216639e80de3760e01b14806104a357506001600160e01b0319821663163b6d3b60e21b1492915050565b81518351146135b95760405162461bcd60e51b81526020600482015260096024820152681157d5949257d2549160ba1b60448201526064016104ee565b6000805b8451811015613666578381815181106135d8576135d86145dc565b6020026020010151826135eb9190614cff565b915060006001600160a01b031685828151811061360a5761360a6145dc565b60200260200101516001600160a01b0316036136545760405162461bcd60e51b8152602060048201526009602482015268455f5652495f49524160b81b60448201526064016104ee565b8061365e81614632565b9150506135bd565b5061ffff8116612710146136ab5760405162461bcd60e51b815260206004820152600c60248201526b0455f5652495f52504e3130360a41b60448201526064016104ee565b61271061ffff83161115612f015760405162461bcd60e51b815260206004820152600d60248201526c0455f5652495f534f504731303609c1b60448201526064016104ee565b60006001600160e01b0319821663fdae1ba760e01b148061372257506001600160e01b031982166322ba176160e21b145b8061373d57506001600160e01b03198216633ecaa07960e21b145b806104a357506001600160e01b0319821663d5a81f1960e01b1492915050565b60006116537f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f61378c60015490565b6002546040805160208101859052908101839052606081018290524660808201523060a082015260009060c0016040516020818303038152906040528051906020012090509392505050565b60008060006137e78585613e73565b91509150612acb81613eb8565b600061380861012083016101008401614753565b60ff1660000361389f577f16533b1a2b574048998c15c61696aff2836a5106c01e21954538cf393cf8124a8235613845604085016020860161427e565b613855606086016040870161427e565b61386186608001613df9565b6040805160208101969096528501939093526001600160a01b03918216606085015216608083015260a082015260e08084013560c083015201611ac6565b6138b161012083016101008401614753565b60ff16600114806138d657506138cf61012083016101008401614753565b60ff166002145b15611c51577f02e75952f6dbd570765759927f425880efe915c78b4351b9f010366a3a15f8e0823561390e604085016020860161427e565b61391e606086016040870161427e565b856060013561392f87608001613df9565b60e08801356139466101208a016101008b01614753565b6040805160208101999099528801969096526001600160a01b03948516606088015293909216608086015260a085015260c084015260e083015260ff1661010082015261012001611ac6565b61399b8161328a565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b613a3a5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016104ee565b600080846001600160a01b031684604051613a559190614d21565b600060405180830381855af49150503d8060008114613a90576040519150601f19603f3d011682016040523d82523d6000602084013e613a95565b606091505b5091509150613abd8282604051806060016040528060278152602001614df16027913961406e565b95945050505050565b60008160ff16600003613b9c577fda89efe36e8d4174abec2b392e28fde5f06a39ea80761619c7690bf866064524613b01602085018561422a565b613b11604086016020870161427e565b6040860135613b2660a0880160808901614a3f565b613b3660e0890160c08a01614753565b6040805160208101979097526001600160e01b0319909516948601949094526001600160a01b039092166060850152608084015261ffff1660a083015260ff1660c082015260e0015b6040516020818303038152906040528051906020012090506104a3565b8160ff16600103613c7f577f711444f222b4586ccfaca2037481d3fab181017c88fc21fb2f78909a6953ba06613bd5602085018561422a565b613be5604086016020870161427e565b60408601356060870135613bff60a0890160808a01614a3f565b613c0f60c08a0160a08b0161427e565b613c1f60e08b0160c08c01614753565b6040805160208101999099526001600160e01b0319909716968801969096526001600160a01b039485166060880152608087019390935260a086019190915261ffff1660c08501521660e083015260ff1661010082015261012001613b7f565b8160ff16600203611c51577fbd60107b487bdfeb3ec8fcbfe07542913ceca85dc095c07f5cb6b97d028573cd613cb8602085018561422a565b613cc8604086016020870161427e565b60408601356060870135613ce260a0890160808a01614a3f565b613cf260c08a0160a08b0161427e565b613d0260e08b0160c08c01614753565b613d0f60e08c018c614770565b604051602001613d20929190614d33565b60408051601f198184030181529190528051602090910120613d466101008d018d614770565b604051602001613d57929190614d75565b60408051601f198184030181529190528051602090910120613d816101408e016101208f01614a3f565b60408051602081019c909c526001600160e01b0319909a16998b01999099526001600160a01b0397881660608b015260808a019690965260a089019490945261ffff92831660c0890152941660e087015260ff9093166101008601526101208501526101408401521661016082015261018001613b7f565b60007f5b442961536b72a0442e9a53df012289ed70f5c860457d810d2c17836bd8bdce613e29602084018461422a565b613e39604085016020860161427e565b6040805160208101949094526001600160e01b0319909216838301526001600160a01b03166060830152830135608082015260a001611ac6565b6000808251604103613ea95760208301516040840151606085015160001a613e9d878285856140a7565b94509450505050613eb1565b506000905060025b9250929050565b6000816004811115613ecc57613ecc614da7565b03613ed45750565b6001816004811115613ee857613ee8614da7565b03613f355760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016104ee565b6002816004811115613f4957613f49614da7565b03613f965760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016104ee565b6003816004811115613faa57613faa614da7565b036140025760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016104ee565b600481600481111561401657614016614da7565b036105865760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016104ee565b6060831561407d575081611642565b82511561408d5782518084602001fd5b8160405162461bcd60e51b81526004016104ee9190614dbd565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156140de575060009050600361418b565b8460ff16601b141580156140f657508460ff16601c14155b15614107575060009050600461418b565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561415b573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166141845760006001925092505061418b565b9150600090505b94509492505050565b508054600082556002029060005260206000209081019061058691906141d3565b508054600082559060005260206000209081019061058691906141fd565b5b808211156141f95780546001600160a01b0319168155600060018201556002016141d4565b5090565b5b808211156141f957600081556001016141fe565b80356001600160e01b031981168114611c8457600080fd5b60006020828403121561423c57600080fd5b61164282614212565b60006020828403121561425757600080fd5b5035919050565b6001600160a01b038116811461058657600080fd5b8035611c848161425e565b60006020828403121561429057600080fd5b81356116428161425e565b600080604083850312156142ae57600080fd5b82356142b98161425e565b915060208301356142c98161425e565b809150509250929050565b600080602083850312156142e757600080fd5b82356001600160401b03808211156142fe57600080fd5b818501915085601f83011261431257600080fd5b81358181111561432157600080fd5b8660208260051b850101111561433657600080fd5b60209290920196919550909350505050565b634e487b7160e01b600052604160045260246000fd5b60405161014081016001600160401b038111828210171561438157614381614348565b60405290565b604051601f8201601f191681016001600160401b03811182821017156143af576143af614348565b604052919050565b600080604083850312156143ca57600080fd5b82356143d58161425e565b91506020838101356001600160401b03808211156143f257600080fd5b818601915086601f83011261440657600080fd5b81358181111561441857614418614348565b61442a601f8201601f19168501614387565b9150808252878482850101111561444057600080fd5b80848401858401376000848284010152508093505050509250929050565b60008083601f84011261447057600080fd5b5081356001600160401b0381111561448757600080fd5b602083019150836020828501011115613eb157600080fd5b6000806000806000808688036101808112156144ba57600080fd5b87356001600160401b03808211156144d157600080fd5b90890190610140828c0312156144e657600080fd5b909750602089013590808211156144fc57600080fd5b6145088b838c0161445e565b9098509650869150610120603f198401121561452357600080fd5b60408a0195506101608a013592508083111561453e57600080fd5b505061454c89828a0161445e565b979a9699509497509295939492505050565b60008060006060848603121561457357600080fd5b8335925060208401356145858161425e565b929592945050506040919091013590565b60208082526026908201527f41646d696e3a6f6e6c7941646d696e2063616c6c6572206973206e6f7420616e6040820152651020b236b4b760d11b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b6001600160a01b039485168152928416602084015292166040820152606081019190915260800190565b634e487b7160e01b600052601160045260246000fd5b6000600182016146445761464461461c565b5060010190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b6001600160e01b031991909116815260200190565b60006020828403121561470a57600080fd5b8151801515811461164257600080fd5b602080825260059082015264455f494e5360d81b604082015260600190565b60ff8116811461058657600080fd5b8035611c8481614739565b60006020828403121561476557600080fd5b813561164281614739565b6000808335601e1984360301811261478757600080fd5b8301803591506001600160401b038211156147a157600080fd5b6020019150600581901b3603821315613eb157600080fd5b6000823561013e198336030181126147d057600080fd5b9190910192915050565b61ffff8116811461058657600080fd5b8035611c84816147da565b60006001600160401b0382111561480e5761480e614348565b5060051b60200190565b600082601f83011261482957600080fd5b8135602061483e614839836147f5565b614387565b82815260059290921b8401810191818101908684111561485d57600080fd5b8286015b848110156148815780356148748161425e565b8352918301918301614861565b509695505050505050565b600082601f83011261489d57600080fd5b813560206148ad614839836147f5565b82815260059290921b840181019181810190868411156148cc57600080fd5b8286015b848110156148815780356148e3816147da565b83529183019183016148d0565b6000610140823603121561490357600080fd5b61490b61435e565b61491483614212565b815261492260208401614273565b60208201526040830135604082015260608301356060820152614947608084016147ea565b608082015261495860a08401614273565b60a082015261496960c08401614748565b60c082015260e08301356001600160401b038082111561498857600080fd5b61499436838701614818565b60e0840152610100915081850135818111156149af57600080fd5b6149bb3682880161488c565b838501525050506101206149d08185016147ea565b9082015292915050565b80820281158282048414176104a3576104a361461c565b600082614a0e57634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215614a2557600080fd5b5051919050565b818103818111156104a3576104a361461c565b600060208284031215614a5157600080fd5b8135611642816147da565b600060208284031215614a6e57600080fd5b81516116428161425e565b6000808335601e19843603018112614a9057600080fd5b8301803591506001600160401b03821115614aaa57600080fd5b6020019150606081023603821315613eb157600080fd5b600060208284031215614ad357600080fd5b8151611642816147da565b808201808211156104a3576104a361461c565b600082601f830112614b0257600080fd5b81516020614b12614839836147f5565b82815260059290921b84018101918181019086841115614b3157600080fd5b8286015b848110156148815780518352918301918301614b35565b8051611c8481614739565b600080600060608486031215614b6c57600080fd5b83516001600160401b0380821115614b8357600080fd5b818601915086601f830112614b9757600080fd5b81516020614ba7614839836147f5565b82815260059290921b8401810191818101908a841115614bc657600080fd5b948201945b83861015614bed578551614bde8161425e565b82529482019490820190614bcb565b91890151919750909350505080821115614c0657600080fd5b50614c1386828701614af1565b925050614c2260408501614b4c565b90509250925092565b60005b83811015614c46578181015183820152602001614c2e565b50506000910152565b60008151808452614c67816020860160208601614c2b565b601f01601f19169290920160200192915050565b6001600160a01b038781168252868116602083015285166040820152606081018490526080810183905260c060a08201819052600090614cbd90830184614c4f565b98975050505050505050565b815160009082906020808601845b83811015614cf357815185529382019390820190600101614cd7565b50929695505050505050565b61ffff818116838216019080821115614d1a57614d1a61461c565b5092915050565b600082516147d0818460208701614c2b565b60008184825b85811015614d6a578135614d4c8161425e565b6001600160a01b031683526020928301929190910190600101614d39565b509095945050505050565b60008184825b85811015614d6a578135614d8e816147da565b61ffff1683526020928301929190910190600101614d7b565b634e487b7160e01b600052602160045260246000fd5b6020815260006116426020830184614c4f56fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220cad4be57dc627ab82ce9cb90fb0a579c29143058a8c0c92266d1ee3945088f1b64736f6c63430008130033