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-13T09:02:49.137014Z
Constructor Arguments
0x0000000000000000000000002564c8ac021fa8cddf83c5e9e63a8edaf37c907d
Arg [0] (address) : 0x2564c8ac021fa8cddf83c5e9e63a8edaf37c907d
contracts/sbinft/market/v3-direct/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 Used instead of constructor(must be called once) * * @param _platformRegistry address of PlatformRegistry * @param _royaltyManager address of RoyaltyRegistry * @param _transferProxy address of TransferProxy * * Emits a {PlatformRegistryUpdated} event * Emits a {RoyaltyManagerUpdated} event * Emits a {TransferProxyUpdated} event */ function __Exchange_init( IPlatformRegistry _platformRegistry, IRoyaltyRegistry _royaltyManager, ITransferProxy _transferProxy ) external initializer { __ERC165_init(); AdminUpgradeable.__Admin_init(); __EIP712_init("SBINFT Exchange", "1.0"); __Pausable_init(); __ReentrancyGuard_init(); __UUPSUpgradeable_init(); updatePlatformRegistry(_platformRegistry); updateRoyaltyRegistry(_royaltyManager); updateTransferProxy(_transferProxy); } /** * @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":"__Exchange_init","inputs":[{"type":"address","name":"_platformRegistry","internalType":"contract IPlatformRegistry"},{"type":"address","name":"_royaltyManager","internalType":"contract IRoyaltyRegistry"},{"type":"address","name":"_transferProxy","internalType":"contract ITransferProxy"}]},{"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
0x60c06040523060a0523480156200001557600080fd5b50604051620053c8380380620053c8833981016040819052620000389162000118565b6001600160a01b0381166080526200004f62000056565b506200014a565b600054610100900460ff1615620000c35760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff908116101562000116576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6000602082840312156200012b57600080fd5b81516001600160a01b03811681146200014357600080fd5b9392505050565b60805160a0516152356200019360003960008181610781015281816107c101528181610a5d01528181610a9d0152610b2c01526000818161031201526134fa01526152356000f3fe60806040526004361061014b5760003560e01c8063572b6c05116100b657806378da24091161006f57806378da2409146103e65780638456cb5914610406578063a11b07121461041b578063c255f8781461043c578063cc2531931461045d578063cf1d53cf1461047d57600080fd5b8063572b6c05146102f55780635c975abb14610342578063653551501461035a578063658c09a81461037a5780636e667db31461038d57806370480275146103c657600080fd5b80633d0950a8116101085780633d0950a81461025c5780633f4ba83a1461027c5780634c275cac146102915780634f1ef286146102b157806352d1902d146102c457806354fd4d50146102d957600080fd5b806301ffc9a71461015057806313263340146101855780631785f53c146101c157806318cdeccc146101e357806324d7806c146102035780633659cfe61461023c575b600080fd5b34801561015c57600080fd5b5061017061016b36600461457c565b61049d565b60405190151581526020015b60405180910390f35b34801561019157600080fd5b506101b36101a0366004614597565b6000908152610197602052604090205490565b60405190815260200161017c565b3480156101cd57600080fd5b506101e16101dc3660046145d0565b6104d4565b005b3480156101ef57600080fd5b506101e16101fe3660046145ed565b6105b4565b34801561020f57600080fd5b5061017061021e3660046145d0565b6001600160a01b031660009081526099602052604090205460ff1690565b34801561024857600080fd5b506101e16102573660046145d0565b610777565b34801561026857600080fd5b506101e1610277366004614626565b610853565b34801561028857600080fd5b506101e16108e4565b34801561029d57600080fd5b506101e16102ac3660046145d0565b610933565b6101e16102bf366004614709565b610a53565b3480156102d057600080fd5b506101b3610b1f565b3480156102e557600080fd5b506040516002815260200161017c565b34801561030157600080fd5b506101706103103660046145d0565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0390811691161490565b34801561034e57600080fd5b5060fe5460ff16610170565b34801561036657600080fd5b506101e16103753660046145d0565b610bd2565b6101e16103883660046147f1565b610cf2565b34801561039957600080fd5b50610195546103ae906001600160a01b031681565b6040516001600160a01b03909116815260200161017c565b3480156103d257600080fd5b506101e16103e13660046145d0565b611454565b3480156103f257600080fd5b506101e16104013660046148b0565b6114a2565b34801561041257600080fd5b506101e161163d565b34801561042757600080fd5b50610196546103ae906001600160a01b031681565b34801561044857600080fd5b50610194546103ae906001600160a01b031681565b34801561046957600080fd5b506101e16104783660046145d0565b61168a565b34801561048957600080fd5b506101b36104983660046148fb565b6117aa565b60006001600160e01b0319821663062e289f60e31b14806104ce57506301ffc9a760e01b6001600160e01b03198316145b92915050565b609960006104e061180f565b6001600160a01b0316815260208101919091526040016000205460ff166105225760405162461bcd60e51b815260040161051990614933565b60405180910390fd5b6001600160a01b03811660009081526099602052604090205460ff166105a85760405162461bcd60e51b815260206004820152603560248201527f41646d696e3a72656d6f766541646d696e20747279696e6720746f2072656d6f6044820152743b32903737b71032bc34b9ba34b7339020b236b4b760591b6064820152608401610519565b6105b18161181e565b50565b609960006105c061180f565b6001600160a01b0316815260208101919091526040016000205460ff166105f95760405162461bcd60e51b815260040161051990614933565b6001600160a01b03821661063a5760405162461bcd60e51b8152602060048201526008602482015267455f57545f49524160c01b6044820152606401610519565b6001600160a01b038116610682576040516001600160a01b038316904780156108fc02916000818181858888f1935050505015801561067d573d6000803e3d6000fd5b505050565b6001600160a01b038116600090815261019860205260408120905b81548110156107505760008282815481106106ba576106ba614979565b60009182526020909120610195546002909202018054600182015460405163776062c360e01b81529294506001600160a01b039384169363776062c39361070a938a939216918b9160040161498f565b600060405180830381600087803b15801561072457600080fd5b505af1158015610738573d6000803e3d6000fd5b50505050508080610748906149cf565b91505061069d565b506001600160a01b03821660009081526101986020526040812061067d916144e6565b5050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036107bf5760405162461bcd60e51b8152600401610519906149e8565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166108086000805160206151b9833981519152546001600160a01b031690565b6001600160a01b03161461082e5760405162461bcd60e51b815260040161051990614a34565b61083781611876565b604080516000808252602082019092526105b1918391906118bb565b6099600061085f61180f565b6001600160a01b0316815260208101919091526040016000205460ff166108985760405162461bcd60e51b815260040161051990614933565b60005b8181101561067d576108d28383838181106108b8576108b8614979565b90506020020160208101906108cd91906145d0565b611a26565b806108dc816149cf565b91505061089b565b609960006108f061180f565b6001600160a01b0316815260208101919091526040016000205460ff166109295760405162461bcd60e51b815260040161051990614933565b610931611ae4565b565b6099600061093f61180f565b6001600160a01b0316815260208101919091526040016000205460ff166109785760405162461bcd60e51b815260040161051990614933565b6040516301ffc9a760e01b81526001600160a01b038216906301ffc9a7906109ab9063071d7d4b60e21b90600401614a80565b602060405180830381865afa1580156109c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ec9190614a95565b610a085760405162461bcd60e51b815260040161051990614ab7565b61019580546001600160a01b0319166001600160a01b0383169081179091556040517fdf3b866248a7a3e982f0a93fde9cf30633ed3bb09365c16b08260ad033db920790600090a250565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163003610a9b5760405162461bcd60e51b8152600401610519906149e8565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610ae46000805160206151b9833981519152546001600160a01b031690565b6001600160a01b031614610b0a5760405162461bcd60e51b815260040161051990614a34565b610b1382611876565b610773828260016118bb565b6000306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610bbf5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401610519565b506000805160206151b983398151915290565b60996000610bde61180f565b6001600160a01b0316815260208101919091526040016000205460ff16610c175760405162461bcd60e51b815260040161051990614933565b6040516301ffc9a760e01b81526001600160a01b038216906301ffc9a790610c4a9063042eca1d60e51b90600401614a80565b602060405180830381865afa158015610c67573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c8b9190614a95565b610ca75760405162461bcd60e51b815260040161051990614ab7565b61019480546001600160a01b0319166001600160a01b0383169081179091556040517fa48d197b43b1826afcf98445392676fa169817dd3216002b6fd70e8601ef2b0190600090a250565b610cfa611b3c565b600260cc5403610d4c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610519565b600260cc556000610d6561014088016101208901614af0565b90506000610d7288611b82565b9050610d8388888888888887611e4f565b6000610d8f8980614b0d565b6000818110610da057610da0614979565b9050602002810190610db29190614b56565b610dbb90614c8d565b9050610dd5610dd060a088016080890161457c565b612b38565b1561134657610de2612b6e565b6000610dee8a88612bda565b9050606087013515610e4857610e048a80614b0d565b6000818110610e1557610e15614979565b9050602002810190610e279190614b56565b60600135876060013582610e3b9190614d77565b610e459190614d8e565b90505b63fdae1ba760e01b610e6060a0890160808a0161457c565b6001600160e01b03191603610eaf5780341015610eaa5760405162461bcd60e51b81526020600482015260086024820152671157d157d391539560c21b6044820152606401610519565b611054565b6322ba176160e21b610ec760a0890160808a0161457c565b6001600160e01b03191603611054576000610ee860c0890160a08a016145d0565b905060006001600160a01b03821663dd62ed3e610f0b60608c0160408d016145d0565b6101955460405160e084901b6001600160e01b03191681526001600160a01b03928316600482015291166024820152604401602060405180830381865afa158015610f5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f7e9190614db0565b905082811015610fbe5760405162461bcd60e51b815260206004820152600b60248201526a0455f455f4e4545524332360ac1b6044820152606401610519565b6000610fca8483614dc9565b9050801561105057600060405180604001604052808c6040016020810190610ff291906145d0565b6001600160a01b0390811682526020918201859052868116600090815261019883526040812080546001808201835591835291849020855160029093020180546001600160a01b031916929093169190911782559290910151910155505b5050505b600061106660608c0160408d016145d0565b9050600061107a60a08d0160808e01614ddc565b905060018660ff1610158015611097575060c084015160ff166001145b156110af576110ac60c08d0160a08e01614ddc565b90505b60006127106110c261ffff841686614d77565b6110cc9190614d8e565b905061115161019460009054906101000a90046001600160a01b03166001600160a01b031663707d18486040518163ffffffff1660e01b81526004016020604051808303816000875af1158015611127573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061114b9190614df9565b82612c99565b600061117186600001516001600160e01b03191663163b6d3b60e21b1490565b801561118557506000866080015161ffff16115b156112865760a08601516001600160a01b0381166112155761019454602088015160405163342ce4cb60e11b81526001600160a01b039182166004820152911690636859c996906024016020604051808303816000875af11580156111ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112129190614df9565b90505b6001600160a01b0381166112575760405162461bcd60e51b8152602060048201526009602482015268455f455f5046524e5360b81b6044820152606401610519565b60808701516127109061126e9061ffff1688614d77565b6112789190614d8e565b91506112848183612c99565b505b60c086015160009060ff1660010361129f5750846112b7565b816112aa8488614dc9565b6112b49190614dc9565b90505b60006112c488838c612d3e565b90506112ef8682856112d6888c614dc9565b6112e09190614dc9565b6112ea9190614dc9565b612c99565b6113368d6080016000016020810190611308919061457c565b8e608001602001602081019061131e91906145d0565b8f604001602081019061133191906145d0565b612f8f565b61133e612b6e565b505050505050505b61136061135960408b0160208c016145d0565b82886130c7565b6060860135156113e257611387896101000135826020015183604001518960600135613336565b806040015181602001516001600160a01b03168a61010001357f052aa775128ed1cbbd47b4948be31a03a0e96f23361fbabd94fde8e24aedfb0389606001356040516113d591815260200190565b60405180910390a4611444565b6113ed8260016133a9565b806040015181602001516001600160a01b03168a61010001357f052aa775128ed1cbbd47b4948be31a03a0e96f23361fbabd94fde8e24aedfb03846060015160405161143b91815260200190565b60405180910390a45b5050600160cc5550505050505050565b6099600061146061180f565b6001600160a01b0316815260208101919091526040016000205460ff166114995760405162461bcd60e51b815260040161051990614933565b6105b181611a26565b600054610100900460ff16158080156114c25750600054600160ff909116105b806114dc5750303b1580156114dc575060005460ff166001145b61153f5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610519565b6000805460ff191660011790558015611562576000805461ff0019166101001790555b61156a6133c8565b6115726133ef565b6115be6040518060400160405280600f81526020016e5342494e46542045786368616e676560881b815250604051806040016040528060038152602001620312e360ec1b815250613429565b6115c661345a565b6115ce613489565b6115d66133c8565b6115df84610bd2565b6115e88361168a565b6115f182610933565b8015611637576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b6099600061164961180f565b6001600160a01b0316815260208101919091526040016000205460ff166116825760405162461bcd60e51b815260040161051990614933565b6109316134b8565b6099600061169661180f565b6001600160a01b0316815260208101919091526040016000205460ff166116cf5760405162461bcd60e51b815260040161051990614933565b6040516301ffc9a760e01b81526001600160a01b038216906301ffc9a79061170290635a8c1c2960e01b90600401614a80565b602060405180830381865afa15801561171f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117439190614a95565b61175f5760405162461bcd60e51b815260040161051990614ab7565b61019680546001600160a01b0319166001600160a01b0383169081179091556040517f39753a6336ef533f6e1785dcab15abdacaf0467b09c6127c32053ad75bcefc6790600090a250565b600061019760008585856040516020016117e0939291909283526001600160a01b03919091166020830152604082015260600190565b6040516020818303038152906040528051906020012081526020019081526020016000205490505b9392505050565b60006118196134f6565b905090565b6001600160a01b038116600081815260996020908152604091829020805460ff1916905590519182527fa3b62bc36326052d97ea62d63c3d60308ed4c3ea8ac079dd8499f1e9c4f80c0f91015b60405180910390a150565b6099600061188261180f565b6001600160a01b0316815260208101919091526040016000205460ff166105b15760405162461bcd60e51b815260040161051990614933565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156118ee5761067d8361353a565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015611948575060408051601f3d908101601f1916820190925261194591810190614db0565b60015b6119ab5760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610519565b6000805160206151b98339815191528114611a1a5760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610519565b5061067d8383836135d6565b6001600160a01b038116611a905760405162461bcd60e51b815260206004820152602b60248201527f41646d696e3a61646441646d696e206e657741646d696e20697320746865207a60448201526a65726f206164647265737360a81b6064820152608401610519565b6001600160a01b038116600081815260996020908152604091829020805460ff1916600117905590519182527f44d6d25963f097ad14f29f06854a01f575648a1ef82f30e562ccd3889717e339910161186b565b611aec6135fb565b60fe805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa611b1f61180f565b6040516001600160a01b03909116815260200160405180910390a1565b60fe5460ff16156109315760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610519565b6000611b9661014083016101208401614af0565b60ff16600003611ca9577f39b77601008263a7668e3e906fb7170db776f21b4b101c313e63194c888f361d611be5611bce8480614b0d565b611be061014087016101208801614af0565b613644565b611bf560408501602086016145d0565b611c0560608601604087016145d0565b611c1a611c156060880188614e16565b613724565b611c2a60a0880160808901614ddc565b6040805160208101979097528601949094526001600160a01b0392831660608601529116608084015260a083015261ffff1660c08281019190915283013560e08281019190915283013561010082810191909152830135610120820152610140015b604051602081830303815290604052805190602001209050919050565b611cbb61014083016101208401614af0565b60ff16600103611dcd577fd7db0db2ef492c99933d7c642ebe5da2a1b81a50be6ba5b0752806cad27c3cc1611cf3611bce8480614b0d565b611d0360408501602086016145d0565b611d1360608601604087016145d0565b611d23611c156060880188614e16565b611d3360a0880160808901614ddc565b611d4360c0890160a08a01614ddc565b60c089013560e08a01356101008b0135611d656101408d016101208e01614af0565b60408051602081019c909c528b01999099526001600160a01b0397881660608b015296909516608089015260a088019390935261ffff91821660c08801521660e086015261010085015261012084015261014083015260ff1661016082015261018001611c8c565b611ddf61014083016101208401614af0565b60ff16600203611e17577f9f4eecad4a60dff4b37449aceb09bdac950063fc93d795c35ece8212883dffe2611cf3611bce8480614b0d565b60405162461bcd60e51b815260206004820152600860248201526722afa7a219afa4ab60c11b6044820152606401610519565b919050565b6000611e6361014089016101208a01614af0565b9050611e7761012086016101008701614af0565b60ff168160ff1614611eb85760405162461bcd60e51b815260206004820152600a602482015269455f435046455f564d4d60b01b6044820152606401610519565b611ec28880614b0d565b9050600114611f025760405162461bcd60e51b815260206004820152600c60248201526b1157d0d4119157d254d3d05360a21b6044820152606401610519565b6000611f0e8980614b0d565b6000818110611f1f57611f1f614979565b9050602002810190611f319190614b56565b611f3a90614c8d565b60208101519091506001600160a01b0316611f855760405162461bcd60e51b815260206004820152600b60248201526a1157d0d4119157d4d0525560aa1b6044820152606401610519565b8060400151600003611fc85760405162461bcd60e51b815260206004820152600c60248201526b455f435046455f534149544960a01b6044820152606401610519565b856060013560000361202657600083815261019760205260409020546001036120215760405162461bcd60e51b815260206004820152600b60248201526a1157d0d4119157d4d3d31160aa1b6044820152606401610519565b612095565b60006120408a6101000135836020015184604001516117aa565b90508082606001516120529190614dc9565b876060013511156120935760405162461bcd60e51b815260206004820152600b60248201526a1157d0d4119157d4d3d31160aa1b6044820152606401610519565b505b428660e0013510156120d55760405162461bcd60e51b8152602060048201526009602482015268455f435046455f454f60b81b6044820152606401610519565b61019460009054906101000a90046001600160a01b03166001600160a01b031663f815d6cf6040518163ffffffff1660e01b81526004016020604051808303816000875af115801561212b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061214f9190614e5e565b61ffff1661216360a08b0160808c01614ddc565b61ffff1610156121a65760405162461bcd60e51b815260206004820152600e60248201526d1157d0d4119157d4d4119315131360921b6044820152606401610519565b60018260ff16106122825761019460009054906101000a90046001600160a01b03166001600160a01b031663f815d6cf6040518163ffffffff1660e01b81526004016020604051808303816000875af1158015612207573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061222b9190614e5e565b61ffff1661223f60c08b0160a08c01614ddc565b61ffff1610156122825760405162461bcd60e51b815260206004820152600e60248201526d1157d0d4119157d4d4119315131360921b6044820152606401610519565b6322ba176160e21b61229a60a088016080890161457c565b6001600160e01b0319160361236e57610194546001600160a01b0316635247385c6122cb60c0890160a08a016145d0565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa15801561230f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123339190614a95565b61236e5760405162461bcd60e51b815260206004820152600c60248201526b455f435046455f4250544e5760a01b6044820152606401610519565b8051612379906137f6565b6123b35760405162461bcd60e51b815260206004820152600b60248201526a455f435046455f5341494f60a81b6044820152606401610519565b6060810151156123fe5760018260ff1610156123fe5760405162461bcd60e51b815260206004820152600a602482015269455f435046455f564e4360b01b6044820152606401610519565b60e08101515115612422576124228160e0015182610100015183610120015161382c565b600061243460408b0160208c016145d0565b6001600160a01b0316036124785760405162461bcd60e51b815260206004820152600b60248201526a455f435046455f5349434f60a81b6044820152606401610519565b600061248a60608b0160408c016145d0565b6001600160a01b0316036124ce5760405162461bcd60e51b815260206004820152600b60248201526a22afa1a82322afa9a4a82960a91b6044820152606401610519565b60008960c001351180156124e65750428960c0013511155b61251f5760405162461bcd60e51b815260206004820152600a602482015269455f435046455f53495360b01b6044820152606401610519565b60e089013515806125335750428960e00135115b61256c5760405162461bcd60e51b815260206004820152600a602482015269455f435046455f53494560b01b6044820152606401610519565b8861010001356000036125ae5760405162461bcd60e51b815260206004820152600a60248201526922afa1a82322afa9a4a760b11b6044820152606401610519565b6101008901358635146125f05760405162461bcd60e51b815260206004820152600a60248201526922afa1a82322afa9a12760b11b6044820152606401610519565b600061260260408801602089016145d0565b6001600160a01b0316036126455760405162461bcd60e51b815260206004820152600a60248201526922afa1a82322afa124a160b11b6044820152606401610519565b600061265760608801604089016145d0565b6001600160a01b03160361269a5760405162461bcd60e51b815260206004820152600a6024820152690455f435046455f4249560b41b6044820152606401610519565b6126b26126ad60a088016080890161457c565b6139a1565b6126ec5760405162461bcd60e51b815260206004820152600b60248201526a455f435046455f4249504d60a81b6044820152606401610519565b60c086013560000361272e5760405162461bcd60e51b815260206004820152600b60248201526a0455f435046455f424f49560ac1b6044820152606401610519565b61273e60408701602088016145d0565b6001600160a01b031661275760408b0160208c016145d0565b6001600160a01b03160361279c5760405162461bcd60e51b815260206004820152600c60248201526b455f435046455f434141425360a01b6044820152606401610519565b6000805b6127ad60608c018c614e16565b9050811015612905576127ec6127c660608d018d614e16565b838181106127d6576127d6614979565b6126ad926020606090920201908101915061457c565b6128285760405162461bcd60e51b815260206004820152600d60248201526c455f435046455f5341504d504d60981b6044820152606401610519565b61283560608c018c614e16565b8281811061284557612845614979565b9050606002016040013560000361288e5760405162461bcd60e51b815260206004820152600d60248201526c0455f435046455f5341504d495609c1b6044820152606401610519565b61289e60a0890160808a0161457c565b6001600160e01b0319166128b560608d018d614e16565b838181106128c5576128c5614979565b6128db926020606090920201908101915061457c565b6001600160e01b031916036128f35760019150612905565b806128fd816149cf565b9150506127a0565b50806129415760405162461bcd60e51b815260206004820152600b60248201526a455f435046455f504d4e4d60a81b6044820152606401610519565b505060006129ce88888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506129c8925087915061298d9050613a0d565b6040805161190160f01b6020808301919091526022820193909352604280820194909452815180820390940184526062019052815191012090565b90613a88565b90506129e060408a0160208b016145d0565b6001600160a01b0316816001600160a01b031614612a2d5760405162461bcd60e51b815260206004820152600a602482015269455f435046455f49535360b01b6044820152606401610519565b6000612a3887613aa4565b9050612a8286868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506129c8925085915061298d9050613a0d565b61019454604051631353b4cb60e21b81526001600160a01b038084166004830152929450911690634d4ed32c90602401602060405180830381865afa158015612acf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612af39190614a95565b612b2c5760405162461bcd60e51b815260206004820152600a602482015269455f435046455f49505360b01b6044820152606401610519565b50505050505050505050565b60006001600160e01b0319821663fdae1ba760e01b14806104ce57506001600160e01b031982166322ba176160e21b1492915050565b60005b61019a54811015612bcc57610199600061019a8381548110612b9557612b95614979565b60009182526020808320909101546001600160a01b0316835282019290925260400181205580612bc4816149cf565b915050612b71565b5061093161019a6000614507565b600080805b612bec6060860186614e16565b9050811015612c9157612c0560a085016080860161457c565b6001600160e01b031916612c1c6060870187614e16565b83818110612c2c57612c2c614979565b612c42926020606090920201908101915061457c565b6001600160e01b03191603612c7f57612c5e6060860186614e16565b82818110612c6e57612c6e614979565b905060600201604001359150612c91565b80612c89816149cf565b915050612bdf565b509392505050565b8015610773576001600160a01b038216600090815261019960205260408120549003612d0c5761019a80546001810182556000919091527fd994f4dad00f9ff89caab117647e768aa59b274f965a222ec6a1586aa6e26bcb0180546001600160a01b0319166001600160a01b0384161790555b6001600160a01b0382166000908152610199602052604081208054839290612d35908490614e7b565b90915550505050565b61019654602084015160408086015160c08701519151634287115760e01b81526001600160a01b03938416600482015260248101919091526044810186905260ff909116606482015260009283926060928392859216906342871157906084016000604051808303816000875af1158015612dbd573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612de59190810190614ef4565b91945092509050600260ff871610801590612dff57508251155b8015612e10575060008860e0015151115b15612f155760e088015160c0890151909350879060ff16600103612e535761012089015161271090612e469061ffff168a614d77565b612e509190614d8e565b90505b83516001600160401b03811115612e6c57612e6c61469a565b604051908082528060200260200182016040528015612e95578160200160208202803683370190505b50925060005b8451811015612f125761271061ffff168a61010001518281518110612ec257612ec2614979565b602002602001015161ffff1683612ed99190614d77565b612ee39190614d8e565b848281518110612ef557612ef5614979565b602090810291909101015280612f0a816149cf565b915050612e9b565b50505b60005b8351811015612f82576000838281518110612f3557612f35614979565b60200260200101519050612f62858381518110612f5457612f54614979565b602002602001015182612c99565b612f6c8187614e7b565b9550508080612f7a906149cf565b915050612f18565b5092979650505050505050565b60005b61019a5481101561163757600061019a8281548110612fb357612fb3614979565b60009182526020808320909101546001600160a01b0316808352610199909152604090912054909150630251e45960e01b6001600160e01b0319871601613030576040516001600160a01b0383169082156108fc029083906000818181858888f1935050505015801561302a573d6000803e3d6000fd5b506130b2565b631d45e89f60e21b6001600160e01b03198716016130b2576101955460405163776062c360e01b81526001600160a01b039091169063776062c39061307f90889088908790879060040161498f565b600060405180830381600087803b15801561309957600080fd5b505af11580156130ad573d6000803e3d6000fd5b505050505b505080806130bf906149cf565b915050612f92565b81602001516001600160a01b03166301ffc9a76380ac58cd60e01b6040518263ffffffff1660e01b81526004016130fe9190614a80565b602060405180830381865afa15801561311b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061313f9190614a95565b156131cd57610195546020808401516001600160a01b039092169163f709b90691869061317290604087019087016145d0565b86604001516040518563ffffffff1660e01b8152600401613196949392919061498f565b600060405180830381600087803b1580156131b057600080fd5b505af11580156131c4573d6000803e3d6000fd5b50505050505050565b81602001516001600160a01b03166301ffc9a7636cdb3d1360e11b6040518263ffffffff1660e01b81526004016132049190614a80565b602060405180830381865afa158015613221573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132459190614a95565b15613306576060808301519082013515613260575060608101355b610195546020808501516001600160a01b0390921691639c1c2ee991879061328e90604088019088016145d0565b604080890151815180830183526002815261060f60f31b602082015291516001600160e01b031960e088901b1681526132ce959493928991600401615018565b600060405180830381600087803b1580156132e857600080fd5b505af11580156132fc573d6000803e3d6000fd5b5050505050505050565b60405162461bcd60e51b81526020600482015260056024820152641157d5505560da1b6044820152606401610519565b80610197600086868660405160200161336b939291909283526001600160a01b03919091166020830152604082015260600190565b604051602081830303815290604052805190602001208152602001908152602001600020600082825461339e9190614e7b565b909155505050505050565b6000828152610197602052604081208054839290612d35908490614e7b565b600054610100900460ff166109315760405162461bcd60e51b815260040161051990615066565b600054610100900460ff166134165760405162461bcd60e51b815260040161051990615066565b61341e6133c8565b6109316108cd61180f565b600054610100900460ff166134505760405162461bcd60e51b815260040161051990615066565b6107738282613c42565b600054610100900460ff166134815760405162461bcd60e51b815260040161051990615066565b610931613c83565b600054610100900460ff166134b05760405162461bcd60e51b815260040161051990615066565b610931613cb6565b6134c0611b3c565b60fe805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611b1f61180f565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03163303613535575060131936013560601c90565b503390565b6001600160a01b0381163b6135a75760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610519565b6000805160206151b983398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6135df83613ce4565b6000825111806135ec5750805b1561067d576116378383613d24565b60fe5460ff166109315760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610519565b600080836001600160401b0381111561365f5761365f61469a565b604051908082528060200260200182016040528015613688578160200160208202803683370190505b50905060005b848110156136f2576136c38686838181106136ab576136ab614979565b90506020028101906136bd9190614b56565b85613e18565b8282815181106136d5576136d5614979565b6020908102919091010152806136ea816149cf565b91505061368e565b508060405160200161370491906150b1565b604051602081830303815290604052805190602001209150509392505050565b600080826001600160401b0381111561373f5761373f61469a565b604051908082528060200260200182016040528015613768578160200160208202803683370190505b50905060005b838110156137c55761379685858381811061378b5761378b614979565b90506060020161414b565b8282815181106137a8576137a8614979565b6020908102919091010152806137bd816149cf565b91505061376e565b50806040516020016137d791906150b1565b6040516020818303038152906040528051906020012091505092915050565b60006001600160e01b03198216639e80de3760e01b14806104ce57506001600160e01b0319821663163b6d3b60e21b1492915050565b81518351146138695760405162461bcd60e51b81526020600482015260096024820152681157d5949257d2549160ba1b6044820152606401610519565b6000805b84518110156139165783818151811061388857613888614979565b60200260200101518261389b91906150e7565b915060006001600160a01b03168582815181106138ba576138ba614979565b60200260200101516001600160a01b0316036139045760405162461bcd60e51b8152602060048201526009602482015268455f5652495f49524160b81b6044820152606401610519565b8061390e816149cf565b91505061386d565b5061ffff81166127101461395b5760405162461bcd60e51b815260206004820152600c60248201526b0455f5652495f52504e3130360a41b6044820152606401610519565b61271061ffff831611156116375760405162461bcd60e51b815260206004820152600d60248201526c0455f5652495f534f504731303609c1b6044820152606401610519565b60006001600160e01b0319821663fdae1ba760e01b14806139d257506001600160e01b031982166322ba176160e21b145b806139ed57506001600160e01b03198216633ecaa07960e21b145b806104ce57506001600160e01b0319821663d5a81f1960e01b1492915050565b60006118197f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f613a3c60015490565b6002546040805160208101859052908101839052606081018290524660808201523060a082015260009060c0016040516020818303038152906040528051906020012090509392505050565b6000806000613a9785856141c5565b91509150612c918161420a565b6000613ab861012083016101008401614af0565b60ff16600003613b4f577f16533b1a2b574048998c15c61696aff2836a5106c01e21954538cf393cf8124a8235613af560408501602086016145d0565b613b0560608601604087016145d0565b613b118660800161414b565b6040805160208101969096528501939093526001600160a01b03918216606085015216608083015260a082015260e08084013560c083015201611c8c565b613b6161012083016101008401614af0565b60ff1660011480613b865750613b7f61012083016101008401614af0565b60ff166002145b15611e17577f02e75952f6dbd570765759927f425880efe915c78b4351b9f010366a3a15f8e08235613bbe60408501602086016145d0565b613bce60608601604087016145d0565b8560600135613bdf8760800161414b565b60e0880135613bf66101208a016101008b01614af0565b6040805160208101999099528801969096526001600160a01b03948516606088015293909216608086015260a085015260c084015260e083015260ff1661010082015261012001611c8c565b600054610100900460ff16613c695760405162461bcd60e51b815260040161051990615066565b815160209283012081519190920120600191909155600255565b600054610100900460ff16613caa5760405162461bcd60e51b815260040161051990615066565b60fe805460ff19169055565b600054610100900460ff16613cdd5760405162461bcd60e51b815260040161051990615066565b600160cc55565b613ced8161353a565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b613d8c5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610519565b600080846001600160a01b031684604051613da79190615109565b600060405180830381855af49150503d8060008114613de2576040519150601f19603f3d011682016040523d82523d6000602084013e613de7565b606091505b5091509150613e0f82826040518060600160405280602781526020016151d9602791396143c0565b95945050505050565b60008160ff16600003613eee577fda89efe36e8d4174abec2b392e28fde5f06a39ea80761619c7690bf866064524613e53602085018561457c565b613e6360408601602087016145d0565b6040860135613e7860a0880160808901614ddc565b613e8860e0890160c08a01614af0565b6040805160208101979097526001600160e01b0319909516948601949094526001600160a01b039092166060850152608084015261ffff1660a083015260ff1660c082015260e0015b6040516020818303038152906040528051906020012090506104ce565b8160ff16600103613fd1577f711444f222b4586ccfaca2037481d3fab181017c88fc21fb2f78909a6953ba06613f27602085018561457c565b613f3760408601602087016145d0565b60408601356060870135613f5160a0890160808a01614ddc565b613f6160c08a0160a08b016145d0565b613f7160e08b0160c08c01614af0565b6040805160208101999099526001600160e01b0319909716968801969096526001600160a01b039485166060880152608087019390935260a086019190915261ffff1660c08501521660e083015260ff1661010082015261012001613ed1565b8160ff16600203611e17577fbd60107b487bdfeb3ec8fcbfe07542913ceca85dc095c07f5cb6b97d028573cd61400a602085018561457c565b61401a60408601602087016145d0565b6040860135606087013561403460a0890160808a01614ddc565b61404460c08a0160a08b016145d0565b61405460e08b0160c08c01614af0565b61406160e08c018c614b0d565b60405160200161407292919061511b565b60408051601f1981840301815291905280516020909101206140986101008d018d614b0d565b6040516020016140a992919061515d565b60408051601f1981840301815291905280516020909101206140d36101408e016101208f01614ddc565b60408051602081019c909c526001600160e01b0319909a16998b01999099526001600160a01b0397881660608b015260808a019690965260a089019490945261ffff92831660c0890152941660e087015260ff9093166101008601526101208501526101408401521661016082015261018001613ed1565b60007f5b442961536b72a0442e9a53df012289ed70f5c860457d810d2c17836bd8bdce61417b602084018461457c565b61418b60408501602086016145d0565b6040805160208101949094526001600160e01b0319909216838301526001600160a01b03166060830152830135608082015260a001611c8c565b60008082516041036141fb5760208301516040840151606085015160001a6141ef878285856143f9565b94509450505050614203565b506000905060025b9250929050565b600081600481111561421e5761421e61518f565b036142265750565b600181600481111561423a5761423a61518f565b036142875760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610519565b600281600481111561429b5761429b61518f565b036142e85760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610519565b60038160048111156142fc576142fc61518f565b036143545760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610519565b60048160048111156143685761436861518f565b036105b15760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610519565b606083156143cf575081611808565b8251156143df5782518084602001fd5b8160405162461bcd60e51b815260040161051991906151a5565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561443057506000905060036144dd565b8460ff16601b1415801561444857508460ff16601c14155b1561445957506000905060046144dd565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156144ad573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166144d6576000600192509250506144dd565b9150600090505b94509492505050565b50805460008255600202906000526020600020908101906105b19190614525565b50805460008255906000526020600020908101906105b1919061454f565b5b8082111561454b5780546001600160a01b031916815560006001820155600201614526565b5090565b5b8082111561454b5760008155600101614550565b80356001600160e01b031981168114611e4a57600080fd5b60006020828403121561458e57600080fd5b61180882614564565b6000602082840312156145a957600080fd5b5035919050565b6001600160a01b03811681146105b157600080fd5b8035611e4a816145b0565b6000602082840312156145e257600080fd5b8135611808816145b0565b6000806040838503121561460057600080fd5b823561460b816145b0565b9150602083013561461b816145b0565b809150509250929050565b6000806020838503121561463957600080fd5b82356001600160401b038082111561465057600080fd5b818501915085601f83011261466457600080fd5b81358181111561467357600080fd5b8660208260051b850101111561468857600080fd5b60209290920196919550909350505050565b634e487b7160e01b600052604160045260246000fd5b60405161014081016001600160401b03811182821017156146d3576146d361469a565b60405290565b604051601f8201601f191681016001600160401b03811182821017156147015761470161469a565b604052919050565b6000806040838503121561471c57600080fd5b8235614727816145b0565b91506020838101356001600160401b038082111561474457600080fd5b818601915086601f83011261475857600080fd5b81358181111561476a5761476a61469a565b61477c601f8201601f191685016146d9565b9150808252878482850101111561479257600080fd5b80848401858401376000848284010152508093505050509250929050565b60008083601f8401126147c257600080fd5b5081356001600160401b038111156147d957600080fd5b60208301915083602082850101111561420357600080fd5b60008060008060008086880361018081121561480c57600080fd5b87356001600160401b038082111561482357600080fd5b90890190610140828c03121561483857600080fd5b9097506020890135908082111561484e57600080fd5b61485a8b838c016147b0565b9098509650869150610120603f198401121561487557600080fd5b60408a0195506101608a013592508083111561489057600080fd5b505061489e89828a016147b0565b979a9699509497509295939492505050565b6000806000606084860312156148c557600080fd5b83356148d0816145b0565b925060208401356148e0816145b0565b915060408401356148f0816145b0565b809150509250925092565b60008060006060848603121561491057600080fd5b833592506020840135614922816145b0565b929592945050506040919091013590565b60208082526026908201527f41646d696e3a6f6e6c7941646d696e2063616c6c6572206973206e6f7420616e6040820152651020b236b4b760d11b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b6001600160a01b039485168152928416602084015292166040820152606081019190915260800190565b634e487b7160e01b600052601160045260246000fd5b6000600182016149e1576149e16149b9565b5060010190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b6001600160e01b031991909116815260200190565b600060208284031215614aa757600080fd5b8151801515811461180857600080fd5b602080825260059082015264455f494e5360d81b604082015260600190565b60ff811681146105b157600080fd5b8035611e4a81614ad6565b600060208284031215614b0257600080fd5b813561180881614ad6565b6000808335601e19843603018112614b2457600080fd5b8301803591506001600160401b03821115614b3e57600080fd5b6020019150600581901b360382131561420357600080fd5b6000823561013e19833603018112614b6d57600080fd5b9190910192915050565b61ffff811681146105b157600080fd5b8035611e4a81614b77565b60006001600160401b03821115614bab57614bab61469a565b5060051b60200190565b600082601f830112614bc657600080fd5b81356020614bdb614bd683614b92565b6146d9565b82815260059290921b84018101918181019086841115614bfa57600080fd5b8286015b84811015614c1e578035614c11816145b0565b8352918301918301614bfe565b509695505050505050565b600082601f830112614c3a57600080fd5b81356020614c4a614bd683614b92565b82815260059290921b84018101918181019086841115614c6957600080fd5b8286015b84811015614c1e578035614c8081614b77565b8352918301918301614c6d565b60006101408236031215614ca057600080fd5b614ca86146b0565b614cb183614564565b8152614cbf602084016145c5565b60208201526040830135604082015260608301356060820152614ce460808401614b87565b6080820152614cf560a084016145c5565b60a0820152614d0660c08401614ae5565b60c082015260e08301356001600160401b0380821115614d2557600080fd5b614d3136838701614bb5565b60e084015261010091508185013581811115614d4c57600080fd5b614d5836828801614c29565b83850152505050610120614d6d818501614b87565b9082015292915050565b80820281158282048414176104ce576104ce6149b9565b600082614dab57634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215614dc257600080fd5b5051919050565b818103818111156104ce576104ce6149b9565b600060208284031215614dee57600080fd5b813561180881614b77565b600060208284031215614e0b57600080fd5b8151611808816145b0565b6000808335601e19843603018112614e2d57600080fd5b8301803591506001600160401b03821115614e4757600080fd5b602001915060608102360382131561420357600080fd5b600060208284031215614e7057600080fd5b815161180881614b77565b808201808211156104ce576104ce6149b9565b600082601f830112614e9f57600080fd5b81516020614eaf614bd683614b92565b82815260059290921b84018101918181019086841115614ece57600080fd5b8286015b84811015614c1e5780518352918301918301614ed2565b8051611e4a81614ad6565b600080600060608486031215614f0957600080fd5b83516001600160401b0380821115614f2057600080fd5b818601915086601f830112614f3457600080fd5b81516020614f44614bd683614b92565b82815260059290921b8401810191818101908a841115614f6357600080fd5b948201945b83861015614f8a578551614f7b816145b0565b82529482019490820190614f68565b91890151919750909350505080821115614fa357600080fd5b50614fb086828701614e8e565b925050614fbf60408501614ee9565b90509250925092565b60005b83811015614fe3578181015183820152602001614fcb565b50506000910152565b60008151808452615004816020860160208601614fc8565b601f01601f19169290920160200192915050565b6001600160a01b038781168252868116602083015285166040820152606081018490526080810183905260c060a0820181905260009061505a90830184614fec565b98975050505050505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b815160009082906020808601845b838110156150db578151855293820193908201906001016150bf565b50929695505050505050565b61ffff818116838216019080821115615102576151026149b9565b5092915050565b60008251614b6d818460208701614fc8565b60008184825b85811015615152578135615134816145b0565b6001600160a01b031683526020928301929190910190600101615121565b509095945050505050565b60008184825b8581101561515257813561517681614b77565b61ffff1683526020928301929190910190600101615163565b634e487b7160e01b600052602160045260246000fd5b6020815260006118086020830184614fec56fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220af0e24becd3214da481aa132d1b6808af7d90a100941a4acc420d81bb42adf3864736f6c634300081300330000000000000000000000002564c8ac021fa8cddf83c5e9e63a8edaf37c907d
Deployed ByteCode
0x60806040526004361061014b5760003560e01c8063572b6c05116100b657806378da24091161006f57806378da2409146103e65780638456cb5914610406578063a11b07121461041b578063c255f8781461043c578063cc2531931461045d578063cf1d53cf1461047d57600080fd5b8063572b6c05146102f55780635c975abb14610342578063653551501461035a578063658c09a81461037a5780636e667db31461038d57806370480275146103c657600080fd5b80633d0950a8116101085780633d0950a81461025c5780633f4ba83a1461027c5780634c275cac146102915780634f1ef286146102b157806352d1902d146102c457806354fd4d50146102d957600080fd5b806301ffc9a71461015057806313263340146101855780631785f53c146101c157806318cdeccc146101e357806324d7806c146102035780633659cfe61461023c575b600080fd5b34801561015c57600080fd5b5061017061016b36600461457c565b61049d565b60405190151581526020015b60405180910390f35b34801561019157600080fd5b506101b36101a0366004614597565b6000908152610197602052604090205490565b60405190815260200161017c565b3480156101cd57600080fd5b506101e16101dc3660046145d0565b6104d4565b005b3480156101ef57600080fd5b506101e16101fe3660046145ed565b6105b4565b34801561020f57600080fd5b5061017061021e3660046145d0565b6001600160a01b031660009081526099602052604090205460ff1690565b34801561024857600080fd5b506101e16102573660046145d0565b610777565b34801561026857600080fd5b506101e1610277366004614626565b610853565b34801561028857600080fd5b506101e16108e4565b34801561029d57600080fd5b506101e16102ac3660046145d0565b610933565b6101e16102bf366004614709565b610a53565b3480156102d057600080fd5b506101b3610b1f565b3480156102e557600080fd5b506040516002815260200161017c565b34801561030157600080fd5b506101706103103660046145d0565b7f0000000000000000000000002564c8ac021fa8cddf83c5e9e63a8edaf37c907d6001600160a01b0390811691161490565b34801561034e57600080fd5b5060fe5460ff16610170565b34801561036657600080fd5b506101e16103753660046145d0565b610bd2565b6101e16103883660046147f1565b610cf2565b34801561039957600080fd5b50610195546103ae906001600160a01b031681565b6040516001600160a01b03909116815260200161017c565b3480156103d257600080fd5b506101e16103e13660046145d0565b611454565b3480156103f257600080fd5b506101e16104013660046148b0565b6114a2565b34801561041257600080fd5b506101e161163d565b34801561042757600080fd5b50610196546103ae906001600160a01b031681565b34801561044857600080fd5b50610194546103ae906001600160a01b031681565b34801561046957600080fd5b506101e16104783660046145d0565b61168a565b34801561048957600080fd5b506101b36104983660046148fb565b6117aa565b60006001600160e01b0319821663062e289f60e31b14806104ce57506301ffc9a760e01b6001600160e01b03198316145b92915050565b609960006104e061180f565b6001600160a01b0316815260208101919091526040016000205460ff166105225760405162461bcd60e51b815260040161051990614933565b60405180910390fd5b6001600160a01b03811660009081526099602052604090205460ff166105a85760405162461bcd60e51b815260206004820152603560248201527f41646d696e3a72656d6f766541646d696e20747279696e6720746f2072656d6f6044820152743b32903737b71032bc34b9ba34b7339020b236b4b760591b6064820152608401610519565b6105b18161181e565b50565b609960006105c061180f565b6001600160a01b0316815260208101919091526040016000205460ff166105f95760405162461bcd60e51b815260040161051990614933565b6001600160a01b03821661063a5760405162461bcd60e51b8152602060048201526008602482015267455f57545f49524160c01b6044820152606401610519565b6001600160a01b038116610682576040516001600160a01b038316904780156108fc02916000818181858888f1935050505015801561067d573d6000803e3d6000fd5b505050565b6001600160a01b038116600090815261019860205260408120905b81548110156107505760008282815481106106ba576106ba614979565b60009182526020909120610195546002909202018054600182015460405163776062c360e01b81529294506001600160a01b039384169363776062c39361070a938a939216918b9160040161498f565b600060405180830381600087803b15801561072457600080fd5b505af1158015610738573d6000803e3d6000fd5b50505050508080610748906149cf565b91505061069d565b506001600160a01b03821660009081526101986020526040812061067d916144e6565b5050565b6001600160a01b037f000000000000000000000000b5ebea1214bdb6488af948d230a89b5ee90170d61630036107bf5760405162461bcd60e51b8152600401610519906149e8565b7f000000000000000000000000b5ebea1214bdb6488af948d230a89b5ee90170d66001600160a01b03166108086000805160206151b9833981519152546001600160a01b031690565b6001600160a01b03161461082e5760405162461bcd60e51b815260040161051990614a34565b61083781611876565b604080516000808252602082019092526105b1918391906118bb565b6099600061085f61180f565b6001600160a01b0316815260208101919091526040016000205460ff166108985760405162461bcd60e51b815260040161051990614933565b60005b8181101561067d576108d28383838181106108b8576108b8614979565b90506020020160208101906108cd91906145d0565b611a26565b806108dc816149cf565b91505061089b565b609960006108f061180f565b6001600160a01b0316815260208101919091526040016000205460ff166109295760405162461bcd60e51b815260040161051990614933565b610931611ae4565b565b6099600061093f61180f565b6001600160a01b0316815260208101919091526040016000205460ff166109785760405162461bcd60e51b815260040161051990614933565b6040516301ffc9a760e01b81526001600160a01b038216906301ffc9a7906109ab9063071d7d4b60e21b90600401614a80565b602060405180830381865afa1580156109c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ec9190614a95565b610a085760405162461bcd60e51b815260040161051990614ab7565b61019580546001600160a01b0319166001600160a01b0383169081179091556040517fdf3b866248a7a3e982f0a93fde9cf30633ed3bb09365c16b08260ad033db920790600090a250565b6001600160a01b037f000000000000000000000000b5ebea1214bdb6488af948d230a89b5ee90170d6163003610a9b5760405162461bcd60e51b8152600401610519906149e8565b7f000000000000000000000000b5ebea1214bdb6488af948d230a89b5ee90170d66001600160a01b0316610ae46000805160206151b9833981519152546001600160a01b031690565b6001600160a01b031614610b0a5760405162461bcd60e51b815260040161051990614a34565b610b1382611876565b610773828260016118bb565b6000306001600160a01b037f000000000000000000000000b5ebea1214bdb6488af948d230a89b5ee90170d61614610bbf5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401610519565b506000805160206151b983398151915290565b60996000610bde61180f565b6001600160a01b0316815260208101919091526040016000205460ff16610c175760405162461bcd60e51b815260040161051990614933565b6040516301ffc9a760e01b81526001600160a01b038216906301ffc9a790610c4a9063042eca1d60e51b90600401614a80565b602060405180830381865afa158015610c67573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c8b9190614a95565b610ca75760405162461bcd60e51b815260040161051990614ab7565b61019480546001600160a01b0319166001600160a01b0383169081179091556040517fa48d197b43b1826afcf98445392676fa169817dd3216002b6fd70e8601ef2b0190600090a250565b610cfa611b3c565b600260cc5403610d4c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610519565b600260cc556000610d6561014088016101208901614af0565b90506000610d7288611b82565b9050610d8388888888888887611e4f565b6000610d8f8980614b0d565b6000818110610da057610da0614979565b9050602002810190610db29190614b56565b610dbb90614c8d565b9050610dd5610dd060a088016080890161457c565b612b38565b1561134657610de2612b6e565b6000610dee8a88612bda565b9050606087013515610e4857610e048a80614b0d565b6000818110610e1557610e15614979565b9050602002810190610e279190614b56565b60600135876060013582610e3b9190614d77565b610e459190614d8e565b90505b63fdae1ba760e01b610e6060a0890160808a0161457c565b6001600160e01b03191603610eaf5780341015610eaa5760405162461bcd60e51b81526020600482015260086024820152671157d157d391539560c21b6044820152606401610519565b611054565b6322ba176160e21b610ec760a0890160808a0161457c565b6001600160e01b03191603611054576000610ee860c0890160a08a016145d0565b905060006001600160a01b03821663dd62ed3e610f0b60608c0160408d016145d0565b6101955460405160e084901b6001600160e01b03191681526001600160a01b03928316600482015291166024820152604401602060405180830381865afa158015610f5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f7e9190614db0565b905082811015610fbe5760405162461bcd60e51b815260206004820152600b60248201526a0455f455f4e4545524332360ac1b6044820152606401610519565b6000610fca8483614dc9565b9050801561105057600060405180604001604052808c6040016020810190610ff291906145d0565b6001600160a01b0390811682526020918201859052868116600090815261019883526040812080546001808201835591835291849020855160029093020180546001600160a01b031916929093169190911782559290910151910155505b5050505b600061106660608c0160408d016145d0565b9050600061107a60a08d0160808e01614ddc565b905060018660ff1610158015611097575060c084015160ff166001145b156110af576110ac60c08d0160a08e01614ddc565b90505b60006127106110c261ffff841686614d77565b6110cc9190614d8e565b905061115161019460009054906101000a90046001600160a01b03166001600160a01b031663707d18486040518163ffffffff1660e01b81526004016020604051808303816000875af1158015611127573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061114b9190614df9565b82612c99565b600061117186600001516001600160e01b03191663163b6d3b60e21b1490565b801561118557506000866080015161ffff16115b156112865760a08601516001600160a01b0381166112155761019454602088015160405163342ce4cb60e11b81526001600160a01b039182166004820152911690636859c996906024016020604051808303816000875af11580156111ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112129190614df9565b90505b6001600160a01b0381166112575760405162461bcd60e51b8152602060048201526009602482015268455f455f5046524e5360b81b6044820152606401610519565b60808701516127109061126e9061ffff1688614d77565b6112789190614d8e565b91506112848183612c99565b505b60c086015160009060ff1660010361129f5750846112b7565b816112aa8488614dc9565b6112b49190614dc9565b90505b60006112c488838c612d3e565b90506112ef8682856112d6888c614dc9565b6112e09190614dc9565b6112ea9190614dc9565b612c99565b6113368d6080016000016020810190611308919061457c565b8e608001602001602081019061131e91906145d0565b8f604001602081019061133191906145d0565b612f8f565b61133e612b6e565b505050505050505b61136061135960408b0160208c016145d0565b82886130c7565b6060860135156113e257611387896101000135826020015183604001518960600135613336565b806040015181602001516001600160a01b03168a61010001357f052aa775128ed1cbbd47b4948be31a03a0e96f23361fbabd94fde8e24aedfb0389606001356040516113d591815260200190565b60405180910390a4611444565b6113ed8260016133a9565b806040015181602001516001600160a01b03168a61010001357f052aa775128ed1cbbd47b4948be31a03a0e96f23361fbabd94fde8e24aedfb03846060015160405161143b91815260200190565b60405180910390a45b5050600160cc5550505050505050565b6099600061146061180f565b6001600160a01b0316815260208101919091526040016000205460ff166114995760405162461bcd60e51b815260040161051990614933565b6105b181611a26565b600054610100900460ff16158080156114c25750600054600160ff909116105b806114dc5750303b1580156114dc575060005460ff166001145b61153f5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610519565b6000805460ff191660011790558015611562576000805461ff0019166101001790555b61156a6133c8565b6115726133ef565b6115be6040518060400160405280600f81526020016e5342494e46542045786368616e676560881b815250604051806040016040528060038152602001620312e360ec1b815250613429565b6115c661345a565b6115ce613489565b6115d66133c8565b6115df84610bd2565b6115e88361168a565b6115f182610933565b8015611637576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b6099600061164961180f565b6001600160a01b0316815260208101919091526040016000205460ff166116825760405162461bcd60e51b815260040161051990614933565b6109316134b8565b6099600061169661180f565b6001600160a01b0316815260208101919091526040016000205460ff166116cf5760405162461bcd60e51b815260040161051990614933565b6040516301ffc9a760e01b81526001600160a01b038216906301ffc9a79061170290635a8c1c2960e01b90600401614a80565b602060405180830381865afa15801561171f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117439190614a95565b61175f5760405162461bcd60e51b815260040161051990614ab7565b61019680546001600160a01b0319166001600160a01b0383169081179091556040517f39753a6336ef533f6e1785dcab15abdacaf0467b09c6127c32053ad75bcefc6790600090a250565b600061019760008585856040516020016117e0939291909283526001600160a01b03919091166020830152604082015260600190565b6040516020818303038152906040528051906020012081526020019081526020016000205490505b9392505050565b60006118196134f6565b905090565b6001600160a01b038116600081815260996020908152604091829020805460ff1916905590519182527fa3b62bc36326052d97ea62d63c3d60308ed4c3ea8ac079dd8499f1e9c4f80c0f91015b60405180910390a150565b6099600061188261180f565b6001600160a01b0316815260208101919091526040016000205460ff166105b15760405162461bcd60e51b815260040161051990614933565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156118ee5761067d8361353a565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015611948575060408051601f3d908101601f1916820190925261194591810190614db0565b60015b6119ab5760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610519565b6000805160206151b98339815191528114611a1a5760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610519565b5061067d8383836135d6565b6001600160a01b038116611a905760405162461bcd60e51b815260206004820152602b60248201527f41646d696e3a61646441646d696e206e657741646d696e20697320746865207a60448201526a65726f206164647265737360a81b6064820152608401610519565b6001600160a01b038116600081815260996020908152604091829020805460ff1916600117905590519182527f44d6d25963f097ad14f29f06854a01f575648a1ef82f30e562ccd3889717e339910161186b565b611aec6135fb565b60fe805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa611b1f61180f565b6040516001600160a01b03909116815260200160405180910390a1565b60fe5460ff16156109315760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610519565b6000611b9661014083016101208401614af0565b60ff16600003611ca9577f39b77601008263a7668e3e906fb7170db776f21b4b101c313e63194c888f361d611be5611bce8480614b0d565b611be061014087016101208801614af0565b613644565b611bf560408501602086016145d0565b611c0560608601604087016145d0565b611c1a611c156060880188614e16565b613724565b611c2a60a0880160808901614ddc565b6040805160208101979097528601949094526001600160a01b0392831660608601529116608084015260a083015261ffff1660c08281019190915283013560e08281019190915283013561010082810191909152830135610120820152610140015b604051602081830303815290604052805190602001209050919050565b611cbb61014083016101208401614af0565b60ff16600103611dcd577fd7db0db2ef492c99933d7c642ebe5da2a1b81a50be6ba5b0752806cad27c3cc1611cf3611bce8480614b0d565b611d0360408501602086016145d0565b611d1360608601604087016145d0565b611d23611c156060880188614e16565b611d3360a0880160808901614ddc565b611d4360c0890160a08a01614ddc565b60c089013560e08a01356101008b0135611d656101408d016101208e01614af0565b60408051602081019c909c528b01999099526001600160a01b0397881660608b015296909516608089015260a088019390935261ffff91821660c08801521660e086015261010085015261012084015261014083015260ff1661016082015261018001611c8c565b611ddf61014083016101208401614af0565b60ff16600203611e17577f9f4eecad4a60dff4b37449aceb09bdac950063fc93d795c35ece8212883dffe2611cf3611bce8480614b0d565b60405162461bcd60e51b815260206004820152600860248201526722afa7a219afa4ab60c11b6044820152606401610519565b919050565b6000611e6361014089016101208a01614af0565b9050611e7761012086016101008701614af0565b60ff168160ff1614611eb85760405162461bcd60e51b815260206004820152600a602482015269455f435046455f564d4d60b01b6044820152606401610519565b611ec28880614b0d565b9050600114611f025760405162461bcd60e51b815260206004820152600c60248201526b1157d0d4119157d254d3d05360a21b6044820152606401610519565b6000611f0e8980614b0d565b6000818110611f1f57611f1f614979565b9050602002810190611f319190614b56565b611f3a90614c8d565b60208101519091506001600160a01b0316611f855760405162461bcd60e51b815260206004820152600b60248201526a1157d0d4119157d4d0525560aa1b6044820152606401610519565b8060400151600003611fc85760405162461bcd60e51b815260206004820152600c60248201526b455f435046455f534149544960a01b6044820152606401610519565b856060013560000361202657600083815261019760205260409020546001036120215760405162461bcd60e51b815260206004820152600b60248201526a1157d0d4119157d4d3d31160aa1b6044820152606401610519565b612095565b60006120408a6101000135836020015184604001516117aa565b90508082606001516120529190614dc9565b876060013511156120935760405162461bcd60e51b815260206004820152600b60248201526a1157d0d4119157d4d3d31160aa1b6044820152606401610519565b505b428660e0013510156120d55760405162461bcd60e51b8152602060048201526009602482015268455f435046455f454f60b81b6044820152606401610519565b61019460009054906101000a90046001600160a01b03166001600160a01b031663f815d6cf6040518163ffffffff1660e01b81526004016020604051808303816000875af115801561212b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061214f9190614e5e565b61ffff1661216360a08b0160808c01614ddc565b61ffff1610156121a65760405162461bcd60e51b815260206004820152600e60248201526d1157d0d4119157d4d4119315131360921b6044820152606401610519565b60018260ff16106122825761019460009054906101000a90046001600160a01b03166001600160a01b031663f815d6cf6040518163ffffffff1660e01b81526004016020604051808303816000875af1158015612207573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061222b9190614e5e565b61ffff1661223f60c08b0160a08c01614ddc565b61ffff1610156122825760405162461bcd60e51b815260206004820152600e60248201526d1157d0d4119157d4d4119315131360921b6044820152606401610519565b6322ba176160e21b61229a60a088016080890161457c565b6001600160e01b0319160361236e57610194546001600160a01b0316635247385c6122cb60c0890160a08a016145d0565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa15801561230f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123339190614a95565b61236e5760405162461bcd60e51b815260206004820152600c60248201526b455f435046455f4250544e5760a01b6044820152606401610519565b8051612379906137f6565b6123b35760405162461bcd60e51b815260206004820152600b60248201526a455f435046455f5341494f60a81b6044820152606401610519565b6060810151156123fe5760018260ff1610156123fe5760405162461bcd60e51b815260206004820152600a602482015269455f435046455f564e4360b01b6044820152606401610519565b60e08101515115612422576124228160e0015182610100015183610120015161382c565b600061243460408b0160208c016145d0565b6001600160a01b0316036124785760405162461bcd60e51b815260206004820152600b60248201526a455f435046455f5349434f60a81b6044820152606401610519565b600061248a60608b0160408c016145d0565b6001600160a01b0316036124ce5760405162461bcd60e51b815260206004820152600b60248201526a22afa1a82322afa9a4a82960a91b6044820152606401610519565b60008960c001351180156124e65750428960c0013511155b61251f5760405162461bcd60e51b815260206004820152600a602482015269455f435046455f53495360b01b6044820152606401610519565b60e089013515806125335750428960e00135115b61256c5760405162461bcd60e51b815260206004820152600a602482015269455f435046455f53494560b01b6044820152606401610519565b8861010001356000036125ae5760405162461bcd60e51b815260206004820152600a60248201526922afa1a82322afa9a4a760b11b6044820152606401610519565b6101008901358635146125f05760405162461bcd60e51b815260206004820152600a60248201526922afa1a82322afa9a12760b11b6044820152606401610519565b600061260260408801602089016145d0565b6001600160a01b0316036126455760405162461bcd60e51b815260206004820152600a60248201526922afa1a82322afa124a160b11b6044820152606401610519565b600061265760608801604089016145d0565b6001600160a01b03160361269a5760405162461bcd60e51b815260206004820152600a6024820152690455f435046455f4249560b41b6044820152606401610519565b6126b26126ad60a088016080890161457c565b6139a1565b6126ec5760405162461bcd60e51b815260206004820152600b60248201526a455f435046455f4249504d60a81b6044820152606401610519565b60c086013560000361272e5760405162461bcd60e51b815260206004820152600b60248201526a0455f435046455f424f49560ac1b6044820152606401610519565b61273e60408701602088016145d0565b6001600160a01b031661275760408b0160208c016145d0565b6001600160a01b03160361279c5760405162461bcd60e51b815260206004820152600c60248201526b455f435046455f434141425360a01b6044820152606401610519565b6000805b6127ad60608c018c614e16565b9050811015612905576127ec6127c660608d018d614e16565b838181106127d6576127d6614979565b6126ad926020606090920201908101915061457c565b6128285760405162461bcd60e51b815260206004820152600d60248201526c455f435046455f5341504d504d60981b6044820152606401610519565b61283560608c018c614e16565b8281811061284557612845614979565b9050606002016040013560000361288e5760405162461bcd60e51b815260206004820152600d60248201526c0455f435046455f5341504d495609c1b6044820152606401610519565b61289e60a0890160808a0161457c565b6001600160e01b0319166128b560608d018d614e16565b838181106128c5576128c5614979565b6128db926020606090920201908101915061457c565b6001600160e01b031916036128f35760019150612905565b806128fd816149cf565b9150506127a0565b50806129415760405162461bcd60e51b815260206004820152600b60248201526a455f435046455f504d4e4d60a81b6044820152606401610519565b505060006129ce88888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506129c8925087915061298d9050613a0d565b6040805161190160f01b6020808301919091526022820193909352604280820194909452815180820390940184526062019052815191012090565b90613a88565b90506129e060408a0160208b016145d0565b6001600160a01b0316816001600160a01b031614612a2d5760405162461bcd60e51b815260206004820152600a602482015269455f435046455f49535360b01b6044820152606401610519565b6000612a3887613aa4565b9050612a8286868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506129c8925085915061298d9050613a0d565b61019454604051631353b4cb60e21b81526001600160a01b038084166004830152929450911690634d4ed32c90602401602060405180830381865afa158015612acf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612af39190614a95565b612b2c5760405162461bcd60e51b815260206004820152600a602482015269455f435046455f49505360b01b6044820152606401610519565b50505050505050505050565b60006001600160e01b0319821663fdae1ba760e01b14806104ce57506001600160e01b031982166322ba176160e21b1492915050565b60005b61019a54811015612bcc57610199600061019a8381548110612b9557612b95614979565b60009182526020808320909101546001600160a01b0316835282019290925260400181205580612bc4816149cf565b915050612b71565b5061093161019a6000614507565b600080805b612bec6060860186614e16565b9050811015612c9157612c0560a085016080860161457c565b6001600160e01b031916612c1c6060870187614e16565b83818110612c2c57612c2c614979565b612c42926020606090920201908101915061457c565b6001600160e01b03191603612c7f57612c5e6060860186614e16565b82818110612c6e57612c6e614979565b905060600201604001359150612c91565b80612c89816149cf565b915050612bdf565b509392505050565b8015610773576001600160a01b038216600090815261019960205260408120549003612d0c5761019a80546001810182556000919091527fd994f4dad00f9ff89caab117647e768aa59b274f965a222ec6a1586aa6e26bcb0180546001600160a01b0319166001600160a01b0384161790555b6001600160a01b0382166000908152610199602052604081208054839290612d35908490614e7b565b90915550505050565b61019654602084015160408086015160c08701519151634287115760e01b81526001600160a01b03938416600482015260248101919091526044810186905260ff909116606482015260009283926060928392859216906342871157906084016000604051808303816000875af1158015612dbd573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612de59190810190614ef4565b91945092509050600260ff871610801590612dff57508251155b8015612e10575060008860e0015151115b15612f155760e088015160c0890151909350879060ff16600103612e535761012089015161271090612e469061ffff168a614d77565b612e509190614d8e565b90505b83516001600160401b03811115612e6c57612e6c61469a565b604051908082528060200260200182016040528015612e95578160200160208202803683370190505b50925060005b8451811015612f125761271061ffff168a61010001518281518110612ec257612ec2614979565b602002602001015161ffff1683612ed99190614d77565b612ee39190614d8e565b848281518110612ef557612ef5614979565b602090810291909101015280612f0a816149cf565b915050612e9b565b50505b60005b8351811015612f82576000838281518110612f3557612f35614979565b60200260200101519050612f62858381518110612f5457612f54614979565b602002602001015182612c99565b612f6c8187614e7b565b9550508080612f7a906149cf565b915050612f18565b5092979650505050505050565b60005b61019a5481101561163757600061019a8281548110612fb357612fb3614979565b60009182526020808320909101546001600160a01b0316808352610199909152604090912054909150630251e45960e01b6001600160e01b0319871601613030576040516001600160a01b0383169082156108fc029083906000818181858888f1935050505015801561302a573d6000803e3d6000fd5b506130b2565b631d45e89f60e21b6001600160e01b03198716016130b2576101955460405163776062c360e01b81526001600160a01b039091169063776062c39061307f90889088908790879060040161498f565b600060405180830381600087803b15801561309957600080fd5b505af11580156130ad573d6000803e3d6000fd5b505050505b505080806130bf906149cf565b915050612f92565b81602001516001600160a01b03166301ffc9a76380ac58cd60e01b6040518263ffffffff1660e01b81526004016130fe9190614a80565b602060405180830381865afa15801561311b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061313f9190614a95565b156131cd57610195546020808401516001600160a01b039092169163f709b90691869061317290604087019087016145d0565b86604001516040518563ffffffff1660e01b8152600401613196949392919061498f565b600060405180830381600087803b1580156131b057600080fd5b505af11580156131c4573d6000803e3d6000fd5b50505050505050565b81602001516001600160a01b03166301ffc9a7636cdb3d1360e11b6040518263ffffffff1660e01b81526004016132049190614a80565b602060405180830381865afa158015613221573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132459190614a95565b15613306576060808301519082013515613260575060608101355b610195546020808501516001600160a01b0390921691639c1c2ee991879061328e90604088019088016145d0565b604080890151815180830183526002815261060f60f31b602082015291516001600160e01b031960e088901b1681526132ce959493928991600401615018565b600060405180830381600087803b1580156132e857600080fd5b505af11580156132fc573d6000803e3d6000fd5b5050505050505050565b60405162461bcd60e51b81526020600482015260056024820152641157d5505560da1b6044820152606401610519565b80610197600086868660405160200161336b939291909283526001600160a01b03919091166020830152604082015260600190565b604051602081830303815290604052805190602001208152602001908152602001600020600082825461339e9190614e7b565b909155505050505050565b6000828152610197602052604081208054839290612d35908490614e7b565b600054610100900460ff166109315760405162461bcd60e51b815260040161051990615066565b600054610100900460ff166134165760405162461bcd60e51b815260040161051990615066565b61341e6133c8565b6109316108cd61180f565b600054610100900460ff166134505760405162461bcd60e51b815260040161051990615066565b6107738282613c42565b600054610100900460ff166134815760405162461bcd60e51b815260040161051990615066565b610931613c83565b600054610100900460ff166134b05760405162461bcd60e51b815260040161051990615066565b610931613cb6565b6134c0611b3c565b60fe805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611b1f61180f565b60007f0000000000000000000000002564c8ac021fa8cddf83c5e9e63a8edaf37c907d6001600160a01b03163303613535575060131936013560601c90565b503390565b6001600160a01b0381163b6135a75760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610519565b6000805160206151b983398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6135df83613ce4565b6000825111806135ec5750805b1561067d576116378383613d24565b60fe5460ff166109315760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610519565b600080836001600160401b0381111561365f5761365f61469a565b604051908082528060200260200182016040528015613688578160200160208202803683370190505b50905060005b848110156136f2576136c38686838181106136ab576136ab614979565b90506020028101906136bd9190614b56565b85613e18565b8282815181106136d5576136d5614979565b6020908102919091010152806136ea816149cf565b91505061368e565b508060405160200161370491906150b1565b604051602081830303815290604052805190602001209150509392505050565b600080826001600160401b0381111561373f5761373f61469a565b604051908082528060200260200182016040528015613768578160200160208202803683370190505b50905060005b838110156137c55761379685858381811061378b5761378b614979565b90506060020161414b565b8282815181106137a8576137a8614979565b6020908102919091010152806137bd816149cf565b91505061376e565b50806040516020016137d791906150b1565b6040516020818303038152906040528051906020012091505092915050565b60006001600160e01b03198216639e80de3760e01b14806104ce57506001600160e01b0319821663163b6d3b60e21b1492915050565b81518351146138695760405162461bcd60e51b81526020600482015260096024820152681157d5949257d2549160ba1b6044820152606401610519565b6000805b84518110156139165783818151811061388857613888614979565b60200260200101518261389b91906150e7565b915060006001600160a01b03168582815181106138ba576138ba614979565b60200260200101516001600160a01b0316036139045760405162461bcd60e51b8152602060048201526009602482015268455f5652495f49524160b81b6044820152606401610519565b8061390e816149cf565b91505061386d565b5061ffff81166127101461395b5760405162461bcd60e51b815260206004820152600c60248201526b0455f5652495f52504e3130360a41b6044820152606401610519565b61271061ffff831611156116375760405162461bcd60e51b815260206004820152600d60248201526c0455f5652495f534f504731303609c1b6044820152606401610519565b60006001600160e01b0319821663fdae1ba760e01b14806139d257506001600160e01b031982166322ba176160e21b145b806139ed57506001600160e01b03198216633ecaa07960e21b145b806104ce57506001600160e01b0319821663d5a81f1960e01b1492915050565b60006118197f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f613a3c60015490565b6002546040805160208101859052908101839052606081018290524660808201523060a082015260009060c0016040516020818303038152906040528051906020012090509392505050565b6000806000613a9785856141c5565b91509150612c918161420a565b6000613ab861012083016101008401614af0565b60ff16600003613b4f577f16533b1a2b574048998c15c61696aff2836a5106c01e21954538cf393cf8124a8235613af560408501602086016145d0565b613b0560608601604087016145d0565b613b118660800161414b565b6040805160208101969096528501939093526001600160a01b03918216606085015216608083015260a082015260e08084013560c083015201611c8c565b613b6161012083016101008401614af0565b60ff1660011480613b865750613b7f61012083016101008401614af0565b60ff166002145b15611e17577f02e75952f6dbd570765759927f425880efe915c78b4351b9f010366a3a15f8e08235613bbe60408501602086016145d0565b613bce60608601604087016145d0565b8560600135613bdf8760800161414b565b60e0880135613bf66101208a016101008b01614af0565b6040805160208101999099528801969096526001600160a01b03948516606088015293909216608086015260a085015260c084015260e083015260ff1661010082015261012001611c8c565b600054610100900460ff16613c695760405162461bcd60e51b815260040161051990615066565b815160209283012081519190920120600191909155600255565b600054610100900460ff16613caa5760405162461bcd60e51b815260040161051990615066565b60fe805460ff19169055565b600054610100900460ff16613cdd5760405162461bcd60e51b815260040161051990615066565b600160cc55565b613ced8161353a565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b613d8c5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610519565b600080846001600160a01b031684604051613da79190615109565b600060405180830381855af49150503d8060008114613de2576040519150601f19603f3d011682016040523d82523d6000602084013e613de7565b606091505b5091509150613e0f82826040518060600160405280602781526020016151d9602791396143c0565b95945050505050565b60008160ff16600003613eee577fda89efe36e8d4174abec2b392e28fde5f06a39ea80761619c7690bf866064524613e53602085018561457c565b613e6360408601602087016145d0565b6040860135613e7860a0880160808901614ddc565b613e8860e0890160c08a01614af0565b6040805160208101979097526001600160e01b0319909516948601949094526001600160a01b039092166060850152608084015261ffff1660a083015260ff1660c082015260e0015b6040516020818303038152906040528051906020012090506104ce565b8160ff16600103613fd1577f711444f222b4586ccfaca2037481d3fab181017c88fc21fb2f78909a6953ba06613f27602085018561457c565b613f3760408601602087016145d0565b60408601356060870135613f5160a0890160808a01614ddc565b613f6160c08a0160a08b016145d0565b613f7160e08b0160c08c01614af0565b6040805160208101999099526001600160e01b0319909716968801969096526001600160a01b039485166060880152608087019390935260a086019190915261ffff1660c08501521660e083015260ff1661010082015261012001613ed1565b8160ff16600203611e17577fbd60107b487bdfeb3ec8fcbfe07542913ceca85dc095c07f5cb6b97d028573cd61400a602085018561457c565b61401a60408601602087016145d0565b6040860135606087013561403460a0890160808a01614ddc565b61404460c08a0160a08b016145d0565b61405460e08b0160c08c01614af0565b61406160e08c018c614b0d565b60405160200161407292919061511b565b60408051601f1981840301815291905280516020909101206140986101008d018d614b0d565b6040516020016140a992919061515d565b60408051601f1981840301815291905280516020909101206140d36101408e016101208f01614ddc565b60408051602081019c909c526001600160e01b0319909a16998b01999099526001600160a01b0397881660608b015260808a019690965260a089019490945261ffff92831660c0890152941660e087015260ff9093166101008601526101208501526101408401521661016082015261018001613ed1565b60007f5b442961536b72a0442e9a53df012289ed70f5c860457d810d2c17836bd8bdce61417b602084018461457c565b61418b60408501602086016145d0565b6040805160208101949094526001600160e01b0319909216838301526001600160a01b03166060830152830135608082015260a001611c8c565b60008082516041036141fb5760208301516040840151606085015160001a6141ef878285856143f9565b94509450505050614203565b506000905060025b9250929050565b600081600481111561421e5761421e61518f565b036142265750565b600181600481111561423a5761423a61518f565b036142875760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610519565b600281600481111561429b5761429b61518f565b036142e85760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610519565b60038160048111156142fc576142fc61518f565b036143545760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610519565b60048160048111156143685761436861518f565b036105b15760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610519565b606083156143cf575081611808565b8251156143df5782518084602001fd5b8160405162461bcd60e51b815260040161051991906151a5565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561443057506000905060036144dd565b8460ff16601b1415801561444857508460ff16601c14155b1561445957506000905060046144dd565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156144ad573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166144d6576000600192509250506144dd565b9150600090505b94509492505050565b50805460008255600202906000526020600020908101906105b19190614525565b50805460008255906000526020600020908101906105b1919061454f565b5b8082111561454b5780546001600160a01b031916815560006001820155600201614526565b5090565b5b8082111561454b5760008155600101614550565b80356001600160e01b031981168114611e4a57600080fd5b60006020828403121561458e57600080fd5b61180882614564565b6000602082840312156145a957600080fd5b5035919050565b6001600160a01b03811681146105b157600080fd5b8035611e4a816145b0565b6000602082840312156145e257600080fd5b8135611808816145b0565b6000806040838503121561460057600080fd5b823561460b816145b0565b9150602083013561461b816145b0565b809150509250929050565b6000806020838503121561463957600080fd5b82356001600160401b038082111561465057600080fd5b818501915085601f83011261466457600080fd5b81358181111561467357600080fd5b8660208260051b850101111561468857600080fd5b60209290920196919550909350505050565b634e487b7160e01b600052604160045260246000fd5b60405161014081016001600160401b03811182821017156146d3576146d361469a565b60405290565b604051601f8201601f191681016001600160401b03811182821017156147015761470161469a565b604052919050565b6000806040838503121561471c57600080fd5b8235614727816145b0565b91506020838101356001600160401b038082111561474457600080fd5b818601915086601f83011261475857600080fd5b81358181111561476a5761476a61469a565b61477c601f8201601f191685016146d9565b9150808252878482850101111561479257600080fd5b80848401858401376000848284010152508093505050509250929050565b60008083601f8401126147c257600080fd5b5081356001600160401b038111156147d957600080fd5b60208301915083602082850101111561420357600080fd5b60008060008060008086880361018081121561480c57600080fd5b87356001600160401b038082111561482357600080fd5b90890190610140828c03121561483857600080fd5b9097506020890135908082111561484e57600080fd5b61485a8b838c016147b0565b9098509650869150610120603f198401121561487557600080fd5b60408a0195506101608a013592508083111561489057600080fd5b505061489e89828a016147b0565b979a9699509497509295939492505050565b6000806000606084860312156148c557600080fd5b83356148d0816145b0565b925060208401356148e0816145b0565b915060408401356148f0816145b0565b809150509250925092565b60008060006060848603121561491057600080fd5b833592506020840135614922816145b0565b929592945050506040919091013590565b60208082526026908201527f41646d696e3a6f6e6c7941646d696e2063616c6c6572206973206e6f7420616e6040820152651020b236b4b760d11b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b6001600160a01b039485168152928416602084015292166040820152606081019190915260800190565b634e487b7160e01b600052601160045260246000fd5b6000600182016149e1576149e16149b9565b5060010190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b6001600160e01b031991909116815260200190565b600060208284031215614aa757600080fd5b8151801515811461180857600080fd5b602080825260059082015264455f494e5360d81b604082015260600190565b60ff811681146105b157600080fd5b8035611e4a81614ad6565b600060208284031215614b0257600080fd5b813561180881614ad6565b6000808335601e19843603018112614b2457600080fd5b8301803591506001600160401b03821115614b3e57600080fd5b6020019150600581901b360382131561420357600080fd5b6000823561013e19833603018112614b6d57600080fd5b9190910192915050565b61ffff811681146105b157600080fd5b8035611e4a81614b77565b60006001600160401b03821115614bab57614bab61469a565b5060051b60200190565b600082601f830112614bc657600080fd5b81356020614bdb614bd683614b92565b6146d9565b82815260059290921b84018101918181019086841115614bfa57600080fd5b8286015b84811015614c1e578035614c11816145b0565b8352918301918301614bfe565b509695505050505050565b600082601f830112614c3a57600080fd5b81356020614c4a614bd683614b92565b82815260059290921b84018101918181019086841115614c6957600080fd5b8286015b84811015614c1e578035614c8081614b77565b8352918301918301614c6d565b60006101408236031215614ca057600080fd5b614ca86146b0565b614cb183614564565b8152614cbf602084016145c5565b60208201526040830135604082015260608301356060820152614ce460808401614b87565b6080820152614cf560a084016145c5565b60a0820152614d0660c08401614ae5565b60c082015260e08301356001600160401b0380821115614d2557600080fd5b614d3136838701614bb5565b60e084015261010091508185013581811115614d4c57600080fd5b614d5836828801614c29565b83850152505050610120614d6d818501614b87565b9082015292915050565b80820281158282048414176104ce576104ce6149b9565b600082614dab57634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215614dc257600080fd5b5051919050565b818103818111156104ce576104ce6149b9565b600060208284031215614dee57600080fd5b813561180881614b77565b600060208284031215614e0b57600080fd5b8151611808816145b0565b6000808335601e19843603018112614e2d57600080fd5b8301803591506001600160401b03821115614e4757600080fd5b602001915060608102360382131561420357600080fd5b600060208284031215614e7057600080fd5b815161180881614b77565b808201808211156104ce576104ce6149b9565b600082601f830112614e9f57600080fd5b81516020614eaf614bd683614b92565b82815260059290921b84018101918181019086841115614ece57600080fd5b8286015b84811015614c1e5780518352918301918301614ed2565b8051611e4a81614ad6565b600080600060608486031215614f0957600080fd5b83516001600160401b0380821115614f2057600080fd5b818601915086601f830112614f3457600080fd5b81516020614f44614bd683614b92565b82815260059290921b8401810191818101908a841115614f6357600080fd5b948201945b83861015614f8a578551614f7b816145b0565b82529482019490820190614f68565b91890151919750909350505080821115614fa357600080fd5b50614fb086828701614e8e565b925050614fbf60408501614ee9565b90509250925092565b60005b83811015614fe3578181015183820152602001614fcb565b50506000910152565b60008151808452615004816020860160208601614fc8565b601f01601f19169290920160200192915050565b6001600160a01b038781168252868116602083015285166040820152606081018490526080810183905260c060a0820181905260009061505a90830184614fec565b98975050505050505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b815160009082906020808601845b838110156150db578151855293820193908201906001016150bf565b50929695505050505050565b61ffff818116838216019080821115615102576151026149b9565b5092915050565b60008251614b6d818460208701614fc8565b60008184825b85811015615152578135615134816145b0565b6001600160a01b031683526020928301929190910190600101615121565b509095945050505050565b60008184825b8581101561515257813561517681614b77565b61ffff1683526020928301929190910190600101615163565b634e487b7160e01b600052602160045260246000fd5b6020815260006118086020830184614fec56fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220af0e24becd3214da481aa132d1b6808af7d90a100941a4acc420d81bb42adf3864736f6c63430008130033