Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- Exchange
- Optimization enabled
- true
- Compiler version
- v0.8.19+commit.7dd6d404
- Optimization runs
- 200
- EVM Version
- default
- Verified at
- 2024-05-02T01:45:09.753784Z
Constructor Arguments
0x000000000000000000000000307e7a9713dbf6f19a2d2a2b670544f4791c4ec2
Arg [0] (address) : 0x307e7a9713dbf6f19a2d2a2b670544f4791c4ec2
contracts/sbinft/market/v1/exchange/Exchange.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; 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/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/v1/interface/IExchange.sol"; /** * @dev SBINFT Exchange 2.0 */ contract Exchange is Initializable, IExchange, 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) private _saleProgress; // Tip related struct ERC20Tip { address tipper; uint256 amount; } mapping(address => ERC20Tip[]) private _erc20TipDeposite; // Just a temp variable to be used as local function variable // as mapping declaration is not supported inside function mapping(address => uint256) private _tempPayoutAmount; address[] private _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(IExchange).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 onlyAdmin { PausableUpgradeable._pause(); /** * Test cases * 1. Non Admin call */ } /** * @dev See {PausableUpgradeable._unpause()} * * Requirements: * - onlyAdmin can call */ function unpause() external onlyAdmin { PausableUpgradeable._unpause(); /** * Test cases * 1. Non Admin call */ } /** * @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 onlyAdmin { // EM: IPlatformRegistry interface not supported require( IPlatformRegistry(_newPlatformRegistry).supportsInterface( type(IPlatformRegistry).interfaceId ), "E:UPR: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 onlyAdmin { // EM: ITransferProxy interface not supported require( ITransferProxy(_newTransferProxy).supportsInterface( type(ITransferProxy).interfaceId ), "E:UTP: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 onlyAdmin { // EM: IRoyaltyRegistry interface not supported require( IRoyaltyRegistry(_newRoyaltyRegistry).supportsInterface( type(IRoyaltyRegistry).interfaceId ), "E:URR:INS" ); royaltyRegistry = _newRoyaltyRegistry; emit RoyaltyRegistryUpdated(_newRoyaltyRegistry); } /** * @dev Checks if order is sold or not * * @param _saleOrder OrderDomain.SaleOrder order info * @return bool true if sold */ function _isSold( OrderDomain.SaleOrder calldata _saleOrder ) private view returns (bool) { return _saleProgress[OrderDomain._hashSaleOrder(_saleOrder)] == 1; } /** * @dev Updates order state as sold * * @param _saleOrder OrderDomain.SaleOrder order info */ function _setSold(OrderDomain.SaleOrder calldata _saleOrder) private { _saleProgress[OrderDomain._hashSaleOrder(_saleOrder)] = 1; } /** * @dev Check validity of arguments when called exchange * * @param _saleOrder OrderDomain.SaleOrder * @param _buyOrder OrderDomain.BuyOrder */ function _checkParameterForExchange( OrderDomain.SaleOrder calldata _saleOrder, OrderDomain.BuyOrder calldata _buyOrder ) private { // Make sure asset is not already sold out // EM: not enough asset remaining for sale require(_isSold(_saleOrder) == false, "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 1% // EM: SaleOrder invalid pfSaleFeeRate require( _saleOrder.pfSaleFeeRate >= (royaltyRegistry.feeDenominator() / 100), "E:CPFE:SIPF" ); if ( _buyOrder.paymentDetails.paymentMode == OrderDomain.ERC20_PAYMENT_MODE ) { // Whitelist check // EM: BuyOrder paymentToken not whitelisted require( platformRegistry.isWhitelistedERC20( _buyOrder.paymentDetails.paymentToken ), "E:CPFE:BPTNW" ); } // OrderDomain.SaleOrder // EM: SaleOrder invalid assetList require(_saleOrder.assetList.length > 0, "E:CPFE:SIAL"); // OrderDomain.Asset uint256 idx = 0; for (idx = 0; idx < _saleOrder.assetList.length; idx++) { // EM: SaleOrder asset invalid originKind require( OrderDomain._isValidOriginKind(_saleOrder.assetList[idx].originKind), "E:CPFE:SAIO" ); // EM: SaleOrder asset invalid token require(_saleOrder.assetList[idx].token != address(0), "E:CPFE:SAIT"); // EM: SaleOrder asset invalid tokenId require(_saleOrder.assetList[idx].tokenId != 0, "E:CPFE:SAITI"); } // 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"); // OrderDomain.BuyOrder // EM: BuyOrder invalid saleNonce require(_buyOrder.saleNonce != 0, "E:CPFE:BIS"); // 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( OrderDomain._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 (idx = 0; idx < _saleOrder.acceptedPaymentMode.length; idx++) { // EM: SaleOrder acceptedPaymentMode invalid paymentMode require( OrderDomain._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"); } /** * @dev Verify signatures for calling exchange * * @param _saleOrder OrderDomain.SaleOrder * @param _salerSign saler signature * @param _buyOrder OrderDomain.BuyOrder * @param _buyerSign buyer signature * @param _platformSign platform signature */ function _verifySignaturesForExchange( OrderDomain.SaleOrder calldata _saleOrder, bytes calldata _salerSign, OrderDomain.BuyOrder calldata _buyOrder, bytes calldata _buyerSign, bytes calldata _platformSign ) private view { // Prepares ERC712 message hash of Saler signature address recoverdAddress = _domainSeparatorV4() .toTypedDataHash(OrderDomain._hashSaleOrder(_saleOrder)) .recover(_salerSign); // EM: invalid saler signer require(recoverdAddress == _saleOrder.currentOwner, "E:VSE:ISS"); // Prepares ERC712 message hash of Buyer signature bytes32 hashMsgBuyOrder = OrderDomain._hashBuyOrder(_buyOrder); recoverdAddress = _domainSeparatorV4() .toTypedDataHash(hashMsgBuyOrder) .recover(_buyerSign); // EM: invalid buyer signer require(recoverdAddress == _buyOrder.buyer, "E:VSE:IBS"); // Prepares ERC712 message hash of platform signature recoverdAddress = _domainSeparatorV4() .toTypedDataHash(hashMsgBuyOrder) .recover(_platformSign); // EM: invalid platform signer require(platformRegistry.isPlatformSigner(recoverdAddress), "E:VSE:IPS"); } /** * @dev Clears previous payout data * It is used for collective payment to pay one address only once */ function _resetPayoutTemp() private { for (uint256 idx = 0; idx < _tempPayoutAddress.length; idx++) { delete _tempPayoutAmount[_tempPayoutAddress[idx]]; } delete _tempPayoutAddress; } /** * @dev Simulate the PartnerFeeTransfer(Not actual transfer) * * @param _asset OrderDomain.Asset * @param _pricePerAsset uint256 price of the asset */ function _simulatePartnerFeeTransfer( OrderDomain.Asset memory _asset, uint256 _pricePerAsset ) private returns (uint256) { uint256 partnerFee = 0; if ( OrderDomain._isPartnerOrigin(_asset.originKind) && _asset.partnerFeeRate > 0 ) { address payable partnerFeeReceiver = platformRegistry .getPartnerFeeReceiver(_asset.token); // Make sure partner fee recever is set // EM: partner fee recever is not set require(partnerFeeReceiver != address(0), "E:SPFT:PFRNS"); partnerFee = (_pricePerAsset * _asset.partnerFeeRate) / royaltyRegistry.feeDenominator(); _registerPayout(partnerFeeReceiver, partnerFee); } return partnerFee; } /** * @dev Simulate the PartnerFeeTransfer(Not actual transfer) * * @param _asset OrderDomain.Asset * @param _pricePerAsset uint256 price of the asset */ function _simulateRoyaltyTransfer( OrderDomain.Asset memory _asset, uint256 _pricePerAsset ) private 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 ); for (uint256 idx = 0; idx < royaltyReceivers.length; idx++) { uint256 royaltyReceiverCut = royaltyReceiversCut[idx]; _registerPayout(royaltyReceivers[idx], royaltyReceiverCut); totalRoyaltyToSend += royaltyReceiverCut; } return totalRoyaltyToSend; } /** * @dev Transfer NFT * * @param _saleOrder OrderDomain.SaleOrder * @param _buyOrder OrderDomain.BuyOrder */ function _transferNFT( OrderDomain.SaleOrder calldata _saleOrder, OrderDomain.BuyOrder calldata _buyOrder ) private { for (uint256 idx = 0; idx < _saleOrder.assetList.length; idx++) { OrderDomain.Asset memory asset = _saleOrder.assetList[idx]; transferProxy.erc721safeTransferFrom( IERC721(asset.token), _saleOrder.currentOwner, _buyOrder.buyer, asset.tokenId ); } } /** * @dev Payout to all receivers using _tempPayoutAddress and _tempPayoutAmount * when execting exchange * * @param _buyOrder OrderDomain.BuyOrder */ function _payout(OrderDomain.BuyOrder calldata _buyOrder) private { bytes4 paymentMode = _buyOrder.paymentDetails.paymentMode; for (uint256 idx = 0; idx < _tempPayoutAddress.length; idx++) { address payable reciever = payable(_tempPayoutAddress[idx]); uint256 amount = _tempPayoutAmount[reciever]; if (paymentMode == OrderDomain.NATIVE_PAYMENT_MODE) { // Sending ETH reciever.transfer(amount); } else if (paymentMode == OrderDomain.ERC20_PAYMENT_MODE) { // Sending ERC20 transferProxy.erc20safeTransferFrom( IERC20(_buyOrder.paymentDetails.paymentToken), _buyOrder.payer, reciever, amount ); } } } /** * @dev Register payment locally, to be used in _payout * * @param _reciever address * @param _amount uint256 */ function _registerPayout(address _reciever, uint256 _amount) private { if (_amount > 0) { if (_tempPayoutAmount[_reciever] == 0) { _tempPayoutAddress.push(_reciever); } _tempPayoutAmount[_reciever] += _amount; } } /** * @dev See {IExchange.exchange()} * * @param _saleOrder OrderDomain.SaleOrder * @param _salerSign saler signature * @param _buyOrder OrderDomain.BuyOrder * @param _buyerSign buyer signature * @param _platformSign platform signature * * Requirements: * - whenNotPaused * - nonReentrant * * Emits a {Sale} event */ function exchange( OrderDomain.SaleOrder calldata _saleOrder, bytes calldata _salerSign, OrderDomain.BuyOrder calldata _buyOrder, bytes calldata _buyerSign, bytes calldata _platformSign ) external payable virtual override whenNotPaused nonReentrant { // Step1 : Parameters and signatures checks // Check parameters _checkParameterForExchange(_saleOrder, _buyOrder); // Verify signatures _verifySignaturesForExchange( _saleOrder, _salerSign, _buyOrder, _buyerSign, _platformSign ); // Step2 : Payout (if OnchainPaymentMode) : Platform Fee + Partner Fee(If partner) + Royalty + Saler(Secondary onwards) bytes4 paymentMode = _buyOrder.paymentDetails.paymentMode; // OnchainPaymentMode == NATIVE_PAYMENT_MODE || ERC20_PAYMENT_MODE if (OrderDomain._isOnchainPaymentMode(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 = OrderDomain._findTotalSalePrice( _saleOrder, _buyOrder ); // 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 (paymentMode == OrderDomain.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 (paymentMode == OrderDomain.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); } } // Simulate sending platform fee uint256 pfFee = (totalSalePrice * _saleOrder.pfSaleFeeRate) / royaltyRegistry.feeDenominator(); _registerPayout(platformRegistry.getPlatformFeeReceiver(), pfFee); OrderDomain.Asset[] memory assetList = _saleOrder.assetList; // In case of bundle, price of each asset is considerd same. // For example: if a bundle has 5 assets and price of buldle is 100 then price of each asset will be 20 (100 / 5) uint256 pricePerAsset = totalSalePrice / assetList.length; uint256 pfFeePerAsset = pfFee / assetList.length; address paymentReceiver = _saleOrder.paymentReceiver; for (uint256 idx = 0; idx < assetList.length; idx++) { OrderDomain.Asset memory asset = assetList[idx]; // Simulate sending partner fee uint256 partnerFeePerAsset = _simulatePartnerFeeTransfer( asset, pricePerAsset ); uint256 royaltySplitPricePerAsset = 0; if (OrderDomain._isSecondarySale(asset.isSecondarySale)) { // Secondary onwards sale case royaltySplitPricePerAsset = pricePerAsset; } else { // Primary sale case royaltySplitPricePerAsset = pricePerAsset - pfFeePerAsset - partnerFeePerAsset; } // Simulate sending royalty cut uint256 royaltyFeePerAsset = _simulateRoyaltyTransfer( asset, royaltySplitPricePerAsset ); // Simulate sending Saler(Secondary onwards) cut if (OrderDomain._isSecondarySale(asset.isSecondarySale)) { uint256 toSalerPerAsset = pricePerAsset - pfFeePerAsset - partnerFeePerAsset - royaltyFeePerAsset; _registerPayout(paymentReceiver, toSalerPerAsset); } } // Payout _payout(_buyOrder); _resetPayoutTemp(); } // Step3 : Transfer NFT _transferNFT(_saleOrder, _buyOrder); // Step4 : Mark order as sold _setSold(_saleOrder); // Step5 : Emit event for sale // TODO: If needed add more data in the event emit Sale(_buyOrder.saleNonce); } /** * @dev Verify signatures for calling cancel * * @param _saleOrder OrderDomain.SaleOrder * @param _salerSign saler signature * @param _platformSign platform signature */ function _verifySignaturesForCancel( OrderDomain.SaleOrder calldata _saleOrder, bytes calldata _salerSign, bytes calldata _platformSign ) private view { // Prepares ERC712 message hash of Saler signature bytes32 hashMsgSaleOrder = OrderDomain._hashSaleOrder(_saleOrder); address recoverdAddress = _domainSeparatorV4() .toTypedDataHash(hashMsgSaleOrder) .recover(_salerSign); // EM: invalid saler signer require(recoverdAddress == _saleOrder.currentOwner, "E:VSC:ISS"); // Prepares ERC712 message hash of platform signature recoverdAddress = _domainSeparatorV4() .toTypedDataHash(hashMsgSaleOrder) .recover(_platformSign); // EM: invalid platform signer require(platformRegistry.isPlatformSigner(recoverdAddress), "E:VSC:IPS"); } /** * @dev Cancel a sale order * * @param _saleOrder OrderDomain.SaleOrder * @param _salerSign saler signature * @param _platformSign platform signature * * Emits a {OrderCancelled} event */ function cancel( OrderDomain.SaleOrder calldata _saleOrder, bytes calldata _salerSign, bytes calldata _platformSign ) external virtual override nonReentrant whenNotPaused { _verifySignaturesForCancel(_saleOrder, _salerSign, _platformSign); // Mark order as sold _setSold(_saleOrder); // Emit event for OrderCancelled // TODO: If needed add more data in the event emit OrderCancelled(_saleOrder.nonce); } /** * @dev Withdraw Tip * * @param _receiver address payable * @param _erc20Token address. When Native, address is zero. */ function withdrawTip( address payable _receiver, address _erc20Token ) public 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]; } } // fallback() external payable {} }
@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/IExchange.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import "@openzeppelin/contracts-upgradeable/interfaces/IERC165Upgradeable.sol"; import "contracts/sbinft/market/v1/library/OrderDomain.sol"; /** * @title SBINFT Exchange protocol */ interface IExchange is IERC165Upgradeable { // Emits whenever there is a exchange/sale event Sale(uint256 indexed nonce); // Emits whenever an order gets cancelled event OrderCancelled(uint256 indexed nonce); /** * @dev Try to exchange asset in process of Sale * * @param _saleOrder OrderDomain.SaleOrder * @param _salerSign saler signature * @param _buyOrder OrderDomain.BuyOrder * @param _buyerSign buyer signature * @param _platformSign platform signature */ function exchange( OrderDomain.SaleOrder calldata _saleOrder, bytes calldata _salerSign, OrderDomain.BuyOrder calldata _buyOrder, bytes calldata _buyerSign, bytes calldata _platformSign ) external payable; /** * @dev Try to cancel Sale order * * @param _saleOrder OrderDomain.SaleOrder * @param _salerSign saler signature * @param _platformSign platform signature */ function cancel( OrderDomain.SaleOrder calldata _saleOrder, bytes calldata _salerSign, bytes calldata _platformSign ) external; }
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/v1/library/OrderDomain.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; /** * @dev Model data related with Order */ library OrderDomain { // 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")); struct Asset { bytes4 originKind; address token; uint256 tokenId; uint16 partnerFeeRate; // only set when originKind = PARTNER_ORIGIN_KIND uint8 isSecondarySale; } struct Payment { bytes4 paymentMode; // Like NATIVE_PAYMENT_MODE || ERC20_PAYMENT_MODE || ... address paymentToken; // Token contract address uint256 price; } struct SaleOrder { Asset[] assetList; // Array will represent bundle address currentOwner; address paymentReceiver; // Onchain payment receiver, can be same as currentOwner Payment[] acceptedPaymentMode; uint16 pfSaleFeeRate; uint256 start; // Always non zero uint256 end; // Can be zero when there is no end time uint256 nonce; } struct BuyOrder { uint256 saleNonce; address payable buyer; address payable payer; // If no payer means buyer is the payer Payment paymentDetails; uint256 validUntil; // UNIX timestamp to determine the of validity of buyOrder } // ---- EIP712 ---- 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)" ); /** * @dev Prepares keccak256 hash for Asset * * @param _asset OrderDomain.Asset */ function _hashAsset(Asset calldata _asset) internal pure returns (bytes32) { return keccak256( abi.encode( ASSET_TYPEHASH, _asset.originKind, _asset.token, _asset.tokenId, _asset.partnerFeeRate, _asset.isSecondarySale ) ); } /** * @dev Prepares keccak256 hash for Asset list * * @param _assetList OrderDomain.Asset[] */ function _hashAsset( Asset[] calldata _assetList ) internal pure returns (bytes32) { bytes32[] memory keccakData = new bytes32[](_assetList.length); for (uint256 idx = 0; idx < _assetList.length; idx++) { keccakData[idx] = _hashAsset(_assetList[idx]); } 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) { return keccak256( abi.encode( SALE_ORDER_TYPEHASH, _hashAsset(_saleOrder.assetList), _saleOrder.currentOwner, _saleOrder.paymentReceiver, _hashPayment(_saleOrder.acceptedPaymentMode), _saleOrder.pfSaleFeeRate, _saleOrder.start, _saleOrder.end, _saleOrder.nonce ) ); } /** * @dev Prepares keccak256 hash for BuyOrder * * @param _buyOrder OrderDomain.BuyOrder */ function _hashBuyOrder( BuyOrder calldata _buyOrder ) internal pure returns (bytes32) { return keccak256( abi.encode( BUY_ORDER_TYPEHASH, _buyOrder.saleNonce, _buyOrder.buyer, _buyOrder.payer, _hashPayment(_buyOrder.paymentDetails), _buyOrder.validUntil ) ); } // ---- 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":"OrderCancelled","inputs":[{"type":"uint256","name":"nonce","internalType":"uint256","indexed":true}],"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":"Sale","inputs":[{"type":"uint256","name":"nonce","internalType":"uint256","indexed":true}],"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":"nonpayable","outputs":[],"name":"cancel","inputs":[{"type":"tuple","name":"_saleOrder","internalType":"struct OrderDomain.SaleOrder","components":[{"type":"tuple[]","name":"assetList","internalType":"struct OrderDomain.Asset[]","components":[{"type":"bytes4","name":"originKind","internalType":"bytes4"},{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"uint16","name":"partnerFeeRate","internalType":"uint16"},{"type":"uint8","name":"isSecondarySale","internalType":"uint8"}]},{"type":"address","name":"currentOwner","internalType":"address"},{"type":"address","name":"paymentReceiver","internalType":"address"},{"type":"tuple[]","name":"acceptedPaymentMode","internalType":"struct OrderDomain.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":"uint256","name":"start","internalType":"uint256"},{"type":"uint256","name":"end","internalType":"uint256"},{"type":"uint256","name":"nonce","internalType":"uint256"}]},{"type":"bytes","name":"_salerSign","internalType":"bytes"},{"type":"bytes","name":"_platformSign","internalType":"bytes"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"exchange","inputs":[{"type":"tuple","name":"_saleOrder","internalType":"struct OrderDomain.SaleOrder","components":[{"type":"tuple[]","name":"assetList","internalType":"struct OrderDomain.Asset[]","components":[{"type":"bytes4","name":"originKind","internalType":"bytes4"},{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"uint16","name":"partnerFeeRate","internalType":"uint16"},{"type":"uint8","name":"isSecondarySale","internalType":"uint8"}]},{"type":"address","name":"currentOwner","internalType":"address"},{"type":"address","name":"paymentReceiver","internalType":"address"},{"type":"tuple[]","name":"acceptedPaymentMode","internalType":"struct OrderDomain.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":"uint256","name":"start","internalType":"uint256"},{"type":"uint256","name":"end","internalType":"uint256"},{"type":"uint256","name":"nonce","internalType":"uint256"}]},{"type":"bytes","name":"_salerSign","internalType":"bytes"},{"type":"tuple","name":"_buyOrder","internalType":"struct OrderDomain.BuyOrder","components":[{"type":"uint256","name":"saleNonce","internalType":"uint256"},{"type":"address","name":"buyer","internalType":"address payable"},{"type":"address","name":"payer","internalType":"address payable"},{"type":"tuple","name":"paymentDetails","internalType":"struct OrderDomain.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":"bytes","name":"_buyerSign","internalType":"bytes"},{"type":"bytes","name":"_platformSign","internalType":"bytes"}]},{"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":"nonpayable","outputs":[],"name":"withdrawTip","inputs":[{"type":"address","name":"_receiver","internalType":"address payable"},{"type":"address","name":"_erc20Token","internalType":"address"}]}]
Contract Creation Code
0x60c06040523060a0523480156200001557600080fd5b50604051620048b2380380620048b2833981016040819052620000389162000118565b6001600160a01b0381166080526200004f62000056565b506200014a565b600054610100900460ff1615620000c35760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff908116101562000116576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6000602082840312156200012b57600080fd5b81516001600160a01b03811681146200014357600080fd5b9392505050565b60805160a05161471f62000193600039600081816107210152818161076101528181610fa301528181610fe301526110720152600081816102c5015261300b015261471f6000f3fe6080604052600436106101355760003560e01c8063572b6c05116100ab578063704802751161006f578063704802751461038657806378da2409146103a65780638456cb59146103c6578063a11b0712146103db578063c255f878146103fc578063cc2531931461041d57600080fd5b8063572b6c05146102a857806357b80dcc146102f55780635c975abb14610315578063653551501461032d5780636e667db31461034d57600080fd5b80633d0950a8116100fd5780633d0950a81461020a5780633f4ba83a1461022a5780634a7d34381461023f5780634c275cac146102525780634f1ef2861461027257806352d1902d1461028557600080fd5b806301ffc9a71461013a5780631785f53c1461016f57806318cdeccc1461019157806324d7806c146101b15780633659cfe6146101ea575b600080fd5b34801561014657600080fd5b5061015a610155366004613c75565b61043d565b60405190151581526020015b60405180910390f35b34801561017b57600080fd5b5061018f61018a366004613ca5565b610474565b005b34801561019d57600080fd5b5061018f6101ac366004613cc2565b610554565b3480156101bd57600080fd5b5061015a6101cc366004613ca5565b6001600160a01b031660009081526099602052604090205460ff1690565b3480156101f657600080fd5b5061018f610205366004613ca5565b610717565b34801561021657600080fd5b5061018f610225366004613cfb565b6107f3565b34801561023657600080fd5b5061018f610884565b61018f61024d366004613dc9565b6108d3565b34801561025e57600080fd5b5061018f61026d366004613ca5565b610e62565b61018f610280366004613ef2565b610f99565b34801561029157600080fd5b5061029a611065565b604051908152602001610166565b3480156102b457600080fd5b5061015a6102c3366004613ca5565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0390811691161490565b34801561030157600080fd5b5061018f610310366004613f99565b611118565b34801561032157600080fd5b5060fe5460ff1661015a565b34801561033957600080fd5b5061018f610348366004613ca5565b6111c8565b34801561035957600080fd5b506101955461036e906001600160a01b031681565b6040516001600160a01b039091168152602001610166565b34801561039257600080fd5b5061018f6103a1366004613ca5565b6112ff565b3480156103b257600080fd5b5061018f6103c136600461402d565b61134d565b3480156103d257600080fd5b5061018f6114e8565b3480156103e757600080fd5b506101965461036e906001600160a01b031681565b34801561040857600080fd5b506101945461036e906001600160a01b031681565b34801561042957600080fd5b5061018f610438366004613ca5565b611535565b60006001600160e01b031982166307714e7d60e21b148061046e57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6099600061048061166c565b6001600160a01b0316815260208101919091526040016000205460ff166104c25760405162461bcd60e51b81526004016104b990614078565b60405180910390fd5b6001600160a01b03811660009081526099602052604090205460ff166105485760405162461bcd60e51b815260206004820152603560248201527f41646d696e3a72656d6f766541646d696e20747279696e6720746f2072656d6f6044820152743b32903737b71032bc34b9ba34b7339020b236b4b760591b60648201526084016104b9565b6105518161167b565b50565b6099600061056061166c565b6001600160a01b0316815260208101919091526040016000205460ff166105995760405162461bcd60e51b81526004016104b990614078565b6001600160a01b0382166105da5760405162461bcd60e51b8152602060048201526008602482015267453a57543a49524160c01b60448201526064016104b9565b6001600160a01b038116610622576040516001600160a01b038316904780156108fc02916000818181858888f1935050505015801561061d573d6000803e3d6000fd5b505050565b6001600160a01b038116600090815261019860205260408120905b81548110156106f057600082828154811061065a5761065a6140be565b60009182526020909120610195546002909202018054600182015460405163776062c360e01b81529294506001600160a01b039384169363776062c3936106aa938a939216918b916004016140d4565b600060405180830381600087803b1580156106c457600080fd5b505af11580156106d8573d6000803e3d6000fd5b505050505080806106e890614114565b91505061063d565b506001600160a01b03821660009081526101986020526040812061061d91613bda565b5050565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016300361075f5760405162461bcd60e51b81526004016104b99061412d565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166107a86000805160206146a3833981519152546001600160a01b031690565b6001600160a01b0316146107ce5760405162461bcd60e51b81526004016104b990614179565b6107d7816116d3565b6040805160008082526020820190925261055191839190611718565b609960006107ff61166c565b6001600160a01b0316815260208101919091526040016000205460ff166108385760405162461bcd60e51b81526004016104b990614078565b60005b8181101561061d57610872838383818110610858576108586140be565b905060200201602081019061086d9190613ca5565b611883565b8061087c81614114565b91505061083b565b6099600061089061166c565b6001600160a01b0316815260208101919091526040016000205460ff166108c95760405162461bcd60e51b81526004016104b990614078565b6108d1611941565b565b6108db611999565b600260cc540361092d5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016104b9565b600260cc5561093c88866119df565b61094c8888888888888888612335565b600061095e6080870160608801613c75565b9050610969816125d6565b15610e135761097661260c565b60006109828a88612678565b9050630251e45960e01b6001600160e01b03198316016109dc57803410156109d75760405162461bcd60e51b8152602060048201526008602482015267114e914e9391539560c21b60448201526064016104b9565b610b72565b631d45e89f60e21b6001600160e01b0319831601610b72576000610a0660a0890160808a01613ca5565b905060006001600160a01b03821663dd62ed3e610a2960608c0160408d01613ca5565b6101955460405160e084901b6001600160e01b03191681526001600160a01b03928316600482015291166024820152604401602060405180830381865afa158015610a78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9c91906141c5565b905082811015610adc5760405162461bcd60e51b815260206004820152600b60248201526a0453a453a4e4545524332360ac1b60448201526064016104b9565b6000610ae884836141de565b90508015610b6e57600060405180604001604052808c6040016020810190610b109190613ca5565b6001600160a01b0390811682526020918201859052868116600090815261019883526040812080546001808201835591835291849020855160029093020180546001600160a01b031916929093169190911782559290910151910155505b5050505b6101965460408051630c0586bf60e11b815290516000926001600160a01b03169163180b0d7e916004808301926020929190829003018187875af1158015610bbe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610be29190614201565b61ffff16610bf660a08d0160808e0161421e565b610c049061ffff168461423b565b610c0e9190614268565b9050610c9361019460009054906101000a90046001600160a01b03166001600160a01b031663707d18486040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610c69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c8d919061427c565b82612737565b6000610c9f8c80614299565b808060200260200160405190810160405280939291908181526020016000905b82821015610ceb57610cdc60a083028601368190038101906142f0565b81526020019060010190610cbf565b505050505090506000815184610d019190614268565b90506000825184610d129190614268565b905060008e6040016020810190610d299190613ca5565b905060005b8451811015610dfa576000858281518110610d4b57610d4b6140be565b602002602001015190506000610d6182876127dc565b608083015190915060009060ff16600103610d7d575085610d95565b81610d8887896141de565b610d9291906141de565b90505b6000610da18483612986565b608085015190915060ff16600103610de35760008184610dc18a8c6141de565b610dcb91906141de565b610dd591906141de565b9050610de18782612737565b505b505050508080610df290614114565b915050610d2e565b50610e048c612aad565b610e0c61260c565b5050505050505b610e1d8987612c15565b610e2689612d06565b6040518635907fc0a8d68d4d1f533ef6cdb7a49068cbe04356682803cb7983c4ba33ce99100efd90600090a25050600160cc5550505050505050565b60996000610e6e61166c565b6001600160a01b0316815260208101919091526040016000205460ff16610ea75760405162461bcd60e51b81526004016104b990614078565b6040516301ffc9a760e01b815263071d7d4b60e21b60048201526001600160a01b038216906301ffc9a790602401602060405180830381865afa158015610ef2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f16919061437c565b610f4e5760405162461bcd60e51b8152602060048201526009602482015268453a5554503a494e5360b81b60448201526064016104b9565b61019580546001600160a01b0319166001600160a01b0383169081179091556040517fdf3b866248a7a3e982f0a93fde9cf30633ed3bb09365c16b08260ad033db920790600090a250565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163003610fe15760405162461bcd60e51b81526004016104b99061412d565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661102a6000805160206146a3833981519152546001600160a01b031690565b6001600160a01b0316146110505760405162461bcd60e51b81526004016104b990614179565b611059826116d3565b61071382826001611718565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146111055760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c000000000000000060648201526084016104b9565b506000805160206146a383398151915290565b600260cc540361116a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016104b9565b600260cc55611177611999565b6111848585858585612d2a565b61118d85612d06565b60405160e0860135907f61b9399f2f0f32ca39ce8d7be32caed5ec22fe07a6daba3a467ed479ec60658290600090a25050600160cc55505050565b609960006111d461166c565b6001600160a01b0316815260208101919091526040016000205460ff1661120d5760405162461bcd60e51b81526004016104b990614078565b6040516301ffc9a760e01b815263042eca1d60e51b60048201526001600160a01b038216906301ffc9a790602401602060405180830381865afa158015611258573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061127c919061437c565b6112b45760405162461bcd60e51b8152602060048201526009602482015268453a5550523a494e5360b81b60448201526064016104b9565b61019480546001600160a01b0319166001600160a01b0383169081179091556040517fa48d197b43b1826afcf98445392676fa169817dd3216002b6fd70e8601ef2b0190600090a250565b6099600061130b61166c565b6001600160a01b0316815260208101919091526040016000205460ff166113445760405162461bcd60e51b81526004016104b990614078565b61055181611883565b600054610100900460ff161580801561136d5750600054600160ff909116105b806113875750303b158015611387575060005460ff166001145b6113ea5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016104b9565b6000805460ff19166001179055801561140d576000805461ff0019166101001790555b611415612ed9565b61141d612f00565b6114696040518060400160405280600f81526020016e5342494e46542045786368616e676560881b815250604051806040016040528060038152602001620312e360ec1b815250612f3a565b611471612f6b565b611479612f9a565b611481612ed9565b61148a846111c8565b61149383611535565b61149c82610e62565b80156114e2576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b609960006114f461166c565b6001600160a01b0316815260208101919091526040016000205460ff1661152d5760405162461bcd60e51b81526004016104b990614078565b6108d1612fc9565b6099600061154161166c565b6001600160a01b0316815260208101919091526040016000205460ff1661157a5760405162461bcd60e51b81526004016104b990614078565b6040516301ffc9a760e01b8152635a8c1c2960e01b60048201526001600160a01b038216906301ffc9a790602401602060405180830381865afa1580156115c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115e9919061437c565b6116215760405162461bcd60e51b8152602060048201526009602482015268453a5552523a494e5360b81b60448201526064016104b9565b61019680546001600160a01b0319166001600160a01b0383169081179091556040517f39753a6336ef533f6e1785dcab15abdacaf0467b09c6127c32053ad75bcefc6790600090a250565b6000611676613007565b905090565b6001600160a01b038116600081815260996020908152604091829020805460ff1916905590519182527fa3b62bc36326052d97ea62d63c3d60308ed4c3ea8ac079dd8499f1e9c4f80c0f91015b60405180910390a150565b609960006116df61166c565b6001600160a01b0316815260208101919091526040016000205460ff166105515760405162461bcd60e51b81526004016104b990614078565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff161561174b5761061d8361304b565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156117a5575060408051601f3d908101601f191682019092526117a2918101906141c5565b60015b6118085760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b60648201526084016104b9565b6000805160206146a383398151915281146118775760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b60648201526084016104b9565b5061061d8383836130e7565b6001600160a01b0381166118ed5760405162461bcd60e51b815260206004820152602b60248201527f41646d696e3a61646441646d696e206e657741646d696e20697320746865207a60448201526a65726f206164647265737360a81b60648201526084016104b9565b6001600160a01b038116600081815260996020908152604091829020805460ff1916600117905590519182527f44d6d25963f097ad14f29f06854a01f575648a1ef82f30e562ccd3889717e33991016116c8565b61194961310c565b60fe805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa61197c61166c565b6040516001600160a01b03909116815260200160405180910390a1565b60fe5460ff16156108d15760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016104b9565b6119e882613155565b15611a235760405162461bcd60e51b815260206004820152600b60248201526a114e90d411914e94d3d31160aa1b60448201526064016104b9565b428160c001351015611a635760405162461bcd60e51b8152602060048201526009602482015268453a435046453a454f60b81b60448201526064016104b9565b6101965460408051630c0586bf60e11b815290516064926001600160a01b03169163180b0d7e91600480830192602092919082900301816000875af1158015611ab0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ad49190614201565b611ade919061439e565b61ffff16611af260a084016080850161421e565b61ffff161015611b325760405162461bcd60e51b815260206004820152600b60248201526a229d21a823229d29a4a82360a91b60448201526064016104b9565b6322ba176160e21b611b4a6080830160608401613c75565b6001600160e01b03191603611c1e57610194546001600160a01b0316635247385c611b7b60a0840160808501613ca5565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015611bbf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611be3919061437c565b611c1e5760405162461bcd60e51b815260206004820152600c60248201526b453a435046453a4250544e5760a01b60448201526064016104b9565b6000611c2a8380614299565b905011611c675760405162461bcd60e51b815260206004820152600b60248201526a114e90d411914e94d2505360aa1b60448201526064016104b9565b60005b611c748380614299565b9050811015611ddb57611cb5611c8a8480614299565b83818110611c9a57611c9a6140be565b611cb092602060a0909202019081019150613c75565b61317e565b611cef5760405162461bcd60e51b815260206004820152600b60248201526a453a435046453a5341494f60a81b60448201526064016104b9565b6000611cfb8480614299565b83818110611d0b57611d0b6140be565b905060a002016020016020810190611d239190613ca5565b6001600160a01b031603611d675760405162461bcd60e51b815260206004820152600b60248201526a114e90d411914e94d0525560aa1b60448201526064016104b9565b611d718380614299565b82818110611d8157611d816140be565b905060a0020160400135600003611dc95760405162461bcd60e51b815260206004820152600c60248201526b453a435046453a534149544960a01b60448201526064016104b9565b80611dd381614114565b915050611c6a565b6000611ded6040850160208601613ca5565b6001600160a01b031603611e315760405162461bcd60e51b815260206004820152600b60248201526a453a435046453a5349434f60a81b60448201526064016104b9565b6000611e436060850160408601613ca5565b6001600160a01b031603611e875760405162461bcd60e51b815260206004820152600b60248201526a229d21a823229d29a4a82960a91b60448201526064016104b9565b60008360a00135118015611e9f5750428360a0013511155b611ed85760405162461bcd60e51b815260206004820152600a602482015269453a435046453a53495360b01b60448201526064016104b9565b60c08301351580611eec5750428360c00135115b611f255760405162461bcd60e51b815260206004820152600a602482015269453a435046453a53494560b01b60448201526064016104b9565b8260e00135600003611f665760405162461bcd60e51b815260206004820152600a602482015269229d21a823229d29a4a760b11b60448201526064016104b9565b8135600003611fa45760405162461bcd60e51b815260206004820152600a602482015269453a435046453a42495360b01b60448201526064016104b9565b60e0830135823514611fe55760405162461bcd60e51b815260206004820152600a602482015269229d21a823229d29a12760b11b60448201526064016104b9565b6000611ff76040840160208501613ca5565b6001600160a01b03160361203a5760405162461bcd60e51b815260206004820152600a602482015269229d21a823229d2124a160b11b60448201526064016104b9565b600061204c6060840160408501613ca5565b6001600160a01b03160361208f5760405162461bcd60e51b815260206004820152600a6024820152690453a435046453a4249560b41b60448201526064016104b9565b6120a76120a26080840160608501613c75565b6131b4565b6120e15760405162461bcd60e51b815260206004820152600b60248201526a453a435046453a4249504d60a81b60448201526064016104b9565b60a08201356000036121235760405162461bcd60e51b815260206004820152600b60248201526a0453a435046453a424f49560ac1b60448201526064016104b9565b6121336040830160208401613ca5565b6001600160a01b031661214c6040850160208601613ca5565b6001600160a01b0316036121915760405162461bcd60e51b815260206004820152600c60248201526b453a435046453a434141425360a01b60448201526064016104b9565b506000805b6121a360608501856143bf565b90508210156122fa576121e26121bc60608601866143bf565b848181106121cc576121cc6140be565b6120a29260206060909202019081019150613c75565b61221e5760405162461bcd60e51b815260206004820152600d60248201526c453a435046453a5341504d504d60981b60448201526064016104b9565b61222b60608501856143bf565b8381811061223b5761223b6140be565b905060600201604001356000036122845760405162461bcd60e51b815260206004820152600d60248201526c0453a435046453a5341504d495609c1b60448201526064016104b9565b6122946080840160608501613c75565b6001600160e01b0319166122ab60608601866143bf565b848181106122bb576122bb6140be565b6122d19260206060909202019081019150613c75565b6001600160e01b031916036122e8575060016122fa565b816122f281614114565b925050612196565b806114e25760405162461bcd60e51b815260206004820152600b60248201526a453a435046453a504d4e4d60a81b60448201526064016104b9565b60006123c888888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506123c2925061237f91508d9050613220565b61238761331d565b6040805161190160f01b6020808301919091526022820193909352604280820194909452815180820390940184526062019052815191012090565b90613398565b90506123da60408a0160208b01613ca5565b6001600160a01b0316816001600160a01b0316146124265760405162461bcd60e51b8152602060048201526009602482015268453a5653453a49535360b81b60448201526064016104b9565b6000612431876133b4565b905061247b86868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506123c29250859150612387905061331d565b915061248d6040880160208901613ca5565b6001600160a01b0316826001600160a01b0316146124d95760405162461bcd60e51b8152602060048201526009602482015268453a5653453a49425360b81b60448201526064016104b9565b61252184848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506123c29250859150612387905061331d565b61019454604051631353b4cb60e21b81526001600160a01b038084166004830152929450911690634d4ed32c90602401602060405180830381865afa15801561256e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612592919061437c565b6125ca5760405162461bcd60e51b8152602060048201526009602482015268453a5653453a49505360b81b60448201526064016104b9565b50505050505050505050565b60006001600160e01b0319821663fdae1ba760e01b148061046e57506001600160e01b031982166322ba176160e21b1492915050565b60005b61019a5481101561266a57610199600061019a8381548110612633576126336140be565b60009182526020808320909101546001600160a01b031683528201929092526040018120558061266281614114565b91505061260f565b506108d161019a6000613bfb565b600080805b61268a60608601866143bf565b905081101561272f576126a36080850160608601613c75565b6001600160e01b0319166126ba60608701876143bf565b838181106126ca576126ca6140be565b6126e09260206060909202019081019150613c75565b6001600160e01b0319160361271d576126fc60608601866143bf565b8281811061270c5761270c6140be565b90506060020160400135915061272f565b8061272781614114565b91505061267d565b509392505050565b8015610713576001600160a01b0382166000908152610199602052604081205490036127aa5761019a80546001810182556000919091527fd994f4dad00f9ff89caab117647e768aa59b274f965a222ec6a1586aa6e26bcb0180546001600160a01b0319166001600160a01b0384161790555b6001600160a01b03821660009081526101996020526040812080548392906127d3908490614407565b90915550505050565b815160009081906127fd906001600160e01b03191663163b6d3b60e21b1490565b801561281157506000846060015161ffff16115b1561297f5761019454602085015160405163342ce4cb60e11b81526001600160a01b0391821660048201526000929190911690636859c996906024016020604051808303816000875af115801561286c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612890919061427c565b90506001600160a01b0381166128d75760405162461bcd60e51b815260206004820152600c60248201526b453a535046543a5046524e5360a01b60448201526064016104b9565b61019660009054906101000a90046001600160a01b03166001600160a01b031663180b0d7e6040518163ffffffff1660e01b81526004016020604051808303816000875af115801561292d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129519190614201565b61ffff16856060015161ffff1685612969919061423b565b6129739190614268565b915061272f8183612737565b9392505050565b61019654602083015160408085015160808601519151634287115760e01b81526001600160a01b03938416600482015260248101919091526044810185905260ff909116606482015260009283926060928392859216906342871157906084016000604051808303816000875af1158015612a05573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612a2d91908101906144b3565b9194509250905060005b8351811015612aa1576000838281518110612a5457612a546140be565b60200260200101519050612a81858381518110612a7357612a736140be565b602002602001015182612737565b612a8b8187614407565b9550508080612a9990614114565b915050612a37565b50929695505050505050565b6000612abf6080830160608401613c75565b905060005b61019a5481101561061d57600061019a8281548110612ae557612ae56140be565b60009182526020808320909101546001600160a01b0316808352610199909152604090912054909150630251e45960e01b6001600160e01b0319851601612b62576040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015612b5c573d6000803e3d6000fd5b50612c00565b631d45e89f60e21b6001600160e01b0319851601612c0057610195546001600160a01b031663776062c3612b9c60a0880160808901613ca5565b612bac6060890160408a01613ca5565b85856040518563ffffffff1660e01b8152600401612bcd94939291906140d4565b600060405180830381600087803b158015612be757600080fd5b505af1158015612bfb573d6000803e3d6000fd5b505050505b50508080612c0d90614114565b915050612ac4565b60005b612c228380614299565b905081101561061d576000612c378480614299565b83818110612c4757612c476140be565b905060a00201803603810190612c5d91906142f0565b610195546020808301519293506001600160a01b039091169163f709b90691612c8c9060408901908901613ca5565b612c9c6040880160208901613ca5565b85604001516040518563ffffffff1660e01b8152600401612cc094939291906140d4565b600060405180830381600087803b158015612cda57600080fd5b505af1158015612cee573d6000803e3d6000fd5b50505050508080612cfe90614114565b915050612c18565b60016101976000612d1684613220565b815260208101919091526040016000205550565b6000612d3586613220565b90506000612d8186868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506123c29250869150612387905061331d565b9050612d936040880160208901613ca5565b6001600160a01b0316816001600160a01b031614612ddf5760405162461bcd60e51b8152602060048201526009602482015268453a5653433a49535360b81b60448201526064016104b9565b612e2784848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506123c29250869150612387905061331d565b61019454604051631353b4cb60e21b81526001600160a01b038084166004830152929350911690634d4ed32c90602401602060405180830381865afa158015612e74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e98919061437c565b612ed05760405162461bcd60e51b8152602060048201526009602482015268453a5653433a49505360b81b60448201526064016104b9565b50505050505050565b600054610100900460ff166108d15760405162461bcd60e51b81526004016104b990614587565b600054610100900460ff16612f275760405162461bcd60e51b81526004016104b990614587565b612f2f612ed9565b6108d161086d61166c565b600054610100900460ff16612f615760405162461bcd60e51b81526004016104b990614587565b6107138282613444565b600054610100900460ff16612f925760405162461bcd60e51b81526004016104b990614587565b6108d1613485565b600054610100900460ff16612fc15760405162461bcd60e51b81526004016104b990614587565b6108d16134b8565b612fd1611999565b60fe805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861197c61166c565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03163303613046575060131936013560601c90565b503390565b6001600160a01b0381163b6130b85760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016104b9565b6000805160206146a383398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6130f0836134e6565b6000825111806130fd5750805b1561061d576114e28383613526565b60fe5460ff166108d15760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016104b9565b6000610197600061316584613220565b8152602001908152602001600020546001149050919050565b60006001600160e01b03198216639e80de3760e01b148061046e57506001600160e01b0319821663163b6d3b60e21b1492915050565b60006001600160e01b0319821663fdae1ba760e01b14806131e557506001600160e01b031982166322ba176160e21b145b8061320057506001600160e01b03198216633ecaa07960e21b145b8061046e57506001600160e01b0319821663d5a81f1960e01b1492915050565b60007f39b77601008263a7668e3e906fb7170db776f21b4b101c313e63194c888f361d6132556132508480614299565b61361a565b6132656040850160208601613ca5565b6132756060860160408701613ca5565b61328a61328560608801886143bf565b6136ec565b61329a60a088016080890161421e565b6040805160208101979097528601949094526001600160a01b0392831660608601529116608084015260a08381019190915261ffff90911660c0838101919091529084013560e08381019190915290840135610100830152830135610120820152610140015b604051602081830303815290604052805190602001209050919050565b60006116767f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f61334c60015490565b6002546040805160208101859052908101839052606081018290524660808201523060a082015260009060c0016040516020818303038152906040528051906020012090509392505050565b60008060006133a7858561378d565b9150915061272f816137d2565b60007f16533b1a2b574048998c15c61696aff2836a5106c01e21954538cf393cf8124a82356133e96040850160208601613ca5565b6133f96060860160408701613ca5565b61340586606001613988565b6040805160208101969096528501939093526001600160a01b03918216606085015216608083015260a082015260c0808401359082015260e001613300565b600054610100900460ff1661346b5760405162461bcd60e51b81526004016104b990614587565b815160209283012081519190920120600191909155600255565b600054610100900460ff166134ac5760405162461bcd60e51b81526004016104b990614587565b60fe805460ff19169055565b600054610100900460ff166134df5760405162461bcd60e51b81526004016104b990614587565b600160cc55565b6134ef8161304b565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b61358e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016104b9565b600080846001600160a01b0316846040516135a991906145f6565b600060405180830381855af49150503d80600081146135e4576040519150601f19603f3d011682016040523d82523d6000602084013e6135e9565b606091505b509150915061361182826040518060600160405280602781526020016146c360279139613a02565b95945050505050565b600080826001600160401b0381111561363557613635613eac565b60405190808252806020026020018201604052801561365e578160200160208202803683370190505b50905060005b838110156136bb5761368c858583818110613681576136816140be565b905060a00201613a3b565b82828151811061369e5761369e6140be565b6020908102919091010152806136b381614114565b915050613664565b50806040516020016136cd9190614612565b6040516020818303038152906040528051906020012091505092915050565b600080826001600160401b0381111561370757613707613eac565b604051908082528060200260200182016040528015613730578160200160208202803683370190505b50905060005b838110156136bb5761375e858583818110613753576137536140be565b905060600201613988565b828281518110613770576137706140be565b60209081029190910101528061378581614114565b915050613736565b60008082516041036137c35760208301516040840151606085015160001a6137b787828585613aed565b945094505050506137cb565b506000905060025b9250929050565b60008160048111156137e6576137e661463c565b036137ee5750565b60018160048111156138025761380261463c565b0361384f5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016104b9565b60028160048111156138635761386361463c565b036138b05760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016104b9565b60038160048111156138c4576138c461463c565b0361391c5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016104b9565b60048160048111156139305761393061463c565b036105515760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016104b9565b60007f5b442961536b72a0442e9a53df012289ed70f5c860457d810d2c17836bd8bdce6139b86020840184613c75565b6139c86040850160208601613ca5565b6040805160208101949094526001600160e01b0319909216838301526001600160a01b03166060830152830135608082015260a001613300565b60608315613a1157508161297f565b825115613a215782518084602001fd5b8160405162461bcd60e51b81526004016104b99190614652565b60007fda89efe36e8d4174abec2b392e28fde5f06a39ea80761619c7690bf866064524613a6b6020840184613c75565b613a7b6040850160208601613ca5565b6040850135613a90608087016060880161421e565b613aa060a0880160808901614685565b6040805160208101979097526001600160e01b0319909516948601949094526001600160a01b039092166060850152608084015261ffff1660a083015260ff1660c082015260e001613300565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115613b245750600090506003613bd1565b8460ff16601b14158015613b3c57508460ff16601c14155b15613b4d5750600090506004613bd1565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613ba1573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116613bca57600060019250925050613bd1565b9150600090505b94509492505050565b50805460008255600202906000526020600020908101906105519190613c19565b50805460008255906000526020600020908101906105519190613c43565b5b80821115613c3f5780546001600160a01b031916815560006001820155600201613c1a565b5090565b5b80821115613c3f5760008155600101613c44565b80356001600160e01b031981168114613c7057600080fd5b919050565b600060208284031215613c8757600080fd5b61297f82613c58565b6001600160a01b038116811461055157600080fd5b600060208284031215613cb757600080fd5b813561297f81613c90565b60008060408385031215613cd557600080fd5b8235613ce081613c90565b91506020830135613cf081613c90565b809150509250929050565b60008060208385031215613d0e57600080fd5b82356001600160401b0380821115613d2557600080fd5b818501915085601f830112613d3957600080fd5b813581811115613d4857600080fd5b8660208260051b8501011115613d5d57600080fd5b60209290920196919550909350505050565b60006101008284031215613d8257600080fd5b50919050565b60008083601f840112613d9a57600080fd5b5081356001600160401b03811115613db157600080fd5b6020830191508360208285010111156137cb57600080fd5b600080600080600080600080888a03610160811215613de757600080fd5b89356001600160401b0380821115613dfe57600080fd5b613e0a8d838e01613d6f565b9a5060208c0135915080821115613e2057600080fd5b613e2c8d838e01613d88565b909a50985088915060e0603f1984011215613e4657600080fd5b60408c0197506101208c0135925080831115613e6157600080fd5b613e6d8d848e01613d88565b90975095506101408c0135925086915080831115613e8a57600080fd5b5050613e988b828c01613d88565b999c989b5096995094979396929594505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715613eea57613eea613eac565b604052919050565b60008060408385031215613f0557600080fd5b8235613f1081613c90565b91506020838101356001600160401b0380821115613f2d57600080fd5b818601915086601f830112613f4157600080fd5b813581811115613f5357613f53613eac565b613f65601f8201601f19168501613ec2565b91508082528784828501011115613f7b57600080fd5b80848401858401376000848284010152508093505050509250929050565b600080600080600060608688031215613fb157600080fd5b85356001600160401b0380821115613fc857600080fd5b613fd489838a01613d6f565b96506020880135915080821115613fea57600080fd5b613ff689838a01613d88565b9096509450604088013591508082111561400f57600080fd5b5061401c88828901613d88565b969995985093965092949392505050565b60008060006060848603121561404257600080fd5b833561404d81613c90565b9250602084013561405d81613c90565b9150604084013561406d81613c90565b809150509250925092565b60208082526026908201527f41646d696e3a6f6e6c7941646d696e2063616c6c6572206973206e6f7420616e6040820152651020b236b4b760d11b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b6001600160a01b039485168152928416602084015292166040820152606081019190915260800190565b634e487b7160e01b600052601160045260246000fd5b600060018201614126576141266140fe565b5060010190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b6000602082840312156141d757600080fd5b5051919050565b8181038181111561046e5761046e6140fe565b61ffff8116811461055157600080fd5b60006020828403121561421357600080fd5b815161297f816141f1565b60006020828403121561423057600080fd5b813561297f816141f1565b808202811582820484141761046e5761046e6140fe565b634e487b7160e01b600052601260045260246000fd5b60008261427757614277614252565b500490565b60006020828403121561428e57600080fd5b815161297f81613c90565b6000808335601e198436030181126142b057600080fd5b8301803591506001600160401b038211156142ca57600080fd5b602001915060a0810236038213156137cb57600080fd5b60ff8116811461055157600080fd5b600060a0828403121561430257600080fd5b60405160a081018181106001600160401b038211171561432457614324613eac565b60405261433083613c58565b8152602083013561434081613c90565b602082015260408381013590820152606083013561435d816141f1565b60608201526080830135614370816142e1565b60808201529392505050565b60006020828403121561438e57600080fd5b8151801515811461297f57600080fd5b600061ffff808416806143b3576143b3614252565b92169190910492915050565b6000808335601e198436030181126143d657600080fd5b8301803591506001600160401b038211156143f057600080fd5b60200191506060810236038213156137cb57600080fd5b8082018082111561046e5761046e6140fe565b60006001600160401b0382111561443357614433613eac565b5060051b60200190565b600082601f83011261444e57600080fd5b8151602061446361445e8361441a565b613ec2565b82815260059290921b8401810191818101908684111561448257600080fd5b8286015b8481101561449d5780518352918301918301614486565b509695505050505050565b8051613c70816142e1565b6000806000606084860312156144c857600080fd5b83516001600160401b03808211156144df57600080fd5b818601915086601f8301126144f357600080fd5b8151602061450361445e8361441a565b82815260059290921b8401810191818101908a84111561452257600080fd5b948201945b8386101561454957855161453a81613c90565b82529482019490820190614527565b9189015191975090935050508082111561456257600080fd5b5061456f8682870161443d565b92505061457e604085016144a8565b90509250925092565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b838110156145ed5781810151838201526020016145d5565b50506000910152565b600082516146088184602087016145d2565b9190910192915050565b815160009082906020808601845b83811015612aa157815185529382019390820190600101614620565b634e487b7160e01b600052602160045260246000fd5b60208152600082518060208401526146718160408501602087016145d2565b601f01601f19169190910160400192915050565b60006020828403121561469757600080fd5b813561297f816142e156fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220fedc2fe117172b3e17e2bba63a9fdac4ec29a0d0d6097b0d04fe3e6eae12054464736f6c63430008130033000000000000000000000000307e7a9713dbf6f19a2d2a2b670544f4791c4ec2
Deployed ByteCode
0x6080604052600436106101355760003560e01c8063572b6c05116100ab578063704802751161006f578063704802751461038657806378da2409146103a65780638456cb59146103c6578063a11b0712146103db578063c255f878146103fc578063cc2531931461041d57600080fd5b8063572b6c05146102a857806357b80dcc146102f55780635c975abb14610315578063653551501461032d5780636e667db31461034d57600080fd5b80633d0950a8116100fd5780633d0950a81461020a5780633f4ba83a1461022a5780634a7d34381461023f5780634c275cac146102525780634f1ef2861461027257806352d1902d1461028557600080fd5b806301ffc9a71461013a5780631785f53c1461016f57806318cdeccc1461019157806324d7806c146101b15780633659cfe6146101ea575b600080fd5b34801561014657600080fd5b5061015a610155366004613c75565b61043d565b60405190151581526020015b60405180910390f35b34801561017b57600080fd5b5061018f61018a366004613ca5565b610474565b005b34801561019d57600080fd5b5061018f6101ac366004613cc2565b610554565b3480156101bd57600080fd5b5061015a6101cc366004613ca5565b6001600160a01b031660009081526099602052604090205460ff1690565b3480156101f657600080fd5b5061018f610205366004613ca5565b610717565b34801561021657600080fd5b5061018f610225366004613cfb565b6107f3565b34801561023657600080fd5b5061018f610884565b61018f61024d366004613dc9565b6108d3565b34801561025e57600080fd5b5061018f61026d366004613ca5565b610e62565b61018f610280366004613ef2565b610f99565b34801561029157600080fd5b5061029a611065565b604051908152602001610166565b3480156102b457600080fd5b5061015a6102c3366004613ca5565b7f000000000000000000000000307e7a9713dbf6f19a2d2a2b670544f4791c4ec26001600160a01b0390811691161490565b34801561030157600080fd5b5061018f610310366004613f99565b611118565b34801561032157600080fd5b5060fe5460ff1661015a565b34801561033957600080fd5b5061018f610348366004613ca5565b6111c8565b34801561035957600080fd5b506101955461036e906001600160a01b031681565b6040516001600160a01b039091168152602001610166565b34801561039257600080fd5b5061018f6103a1366004613ca5565b6112ff565b3480156103b257600080fd5b5061018f6103c136600461402d565b61134d565b3480156103d257600080fd5b5061018f6114e8565b3480156103e757600080fd5b506101965461036e906001600160a01b031681565b34801561040857600080fd5b506101945461036e906001600160a01b031681565b34801561042957600080fd5b5061018f610438366004613ca5565b611535565b60006001600160e01b031982166307714e7d60e21b148061046e57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6099600061048061166c565b6001600160a01b0316815260208101919091526040016000205460ff166104c25760405162461bcd60e51b81526004016104b990614078565b60405180910390fd5b6001600160a01b03811660009081526099602052604090205460ff166105485760405162461bcd60e51b815260206004820152603560248201527f41646d696e3a72656d6f766541646d696e20747279696e6720746f2072656d6f6044820152743b32903737b71032bc34b9ba34b7339020b236b4b760591b60648201526084016104b9565b6105518161167b565b50565b6099600061056061166c565b6001600160a01b0316815260208101919091526040016000205460ff166105995760405162461bcd60e51b81526004016104b990614078565b6001600160a01b0382166105da5760405162461bcd60e51b8152602060048201526008602482015267453a57543a49524160c01b60448201526064016104b9565b6001600160a01b038116610622576040516001600160a01b038316904780156108fc02916000818181858888f1935050505015801561061d573d6000803e3d6000fd5b505050565b6001600160a01b038116600090815261019860205260408120905b81548110156106f057600082828154811061065a5761065a6140be565b60009182526020909120610195546002909202018054600182015460405163776062c360e01b81529294506001600160a01b039384169363776062c3936106aa938a939216918b916004016140d4565b600060405180830381600087803b1580156106c457600080fd5b505af11580156106d8573d6000803e3d6000fd5b505050505080806106e890614114565b91505061063d565b506001600160a01b03821660009081526101986020526040812061061d91613bda565b5050565b6001600160a01b037f0000000000000000000000002ce2319c8187d0520ab1a4b3f668063e08e5b8bc16300361075f5760405162461bcd60e51b81526004016104b99061412d565b7f0000000000000000000000002ce2319c8187d0520ab1a4b3f668063e08e5b8bc6001600160a01b03166107a86000805160206146a3833981519152546001600160a01b031690565b6001600160a01b0316146107ce5760405162461bcd60e51b81526004016104b990614179565b6107d7816116d3565b6040805160008082526020820190925261055191839190611718565b609960006107ff61166c565b6001600160a01b0316815260208101919091526040016000205460ff166108385760405162461bcd60e51b81526004016104b990614078565b60005b8181101561061d57610872838383818110610858576108586140be565b905060200201602081019061086d9190613ca5565b611883565b8061087c81614114565b91505061083b565b6099600061089061166c565b6001600160a01b0316815260208101919091526040016000205460ff166108c95760405162461bcd60e51b81526004016104b990614078565b6108d1611941565b565b6108db611999565b600260cc540361092d5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016104b9565b600260cc5561093c88866119df565b61094c8888888888888888612335565b600061095e6080870160608801613c75565b9050610969816125d6565b15610e135761097661260c565b60006109828a88612678565b9050630251e45960e01b6001600160e01b03198316016109dc57803410156109d75760405162461bcd60e51b8152602060048201526008602482015267114e914e9391539560c21b60448201526064016104b9565b610b72565b631d45e89f60e21b6001600160e01b0319831601610b72576000610a0660a0890160808a01613ca5565b905060006001600160a01b03821663dd62ed3e610a2960608c0160408d01613ca5565b6101955460405160e084901b6001600160e01b03191681526001600160a01b03928316600482015291166024820152604401602060405180830381865afa158015610a78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9c91906141c5565b905082811015610adc5760405162461bcd60e51b815260206004820152600b60248201526a0453a453a4e4545524332360ac1b60448201526064016104b9565b6000610ae884836141de565b90508015610b6e57600060405180604001604052808c6040016020810190610b109190613ca5565b6001600160a01b0390811682526020918201859052868116600090815261019883526040812080546001808201835591835291849020855160029093020180546001600160a01b031916929093169190911782559290910151910155505b5050505b6101965460408051630c0586bf60e11b815290516000926001600160a01b03169163180b0d7e916004808301926020929190829003018187875af1158015610bbe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610be29190614201565b61ffff16610bf660a08d0160808e0161421e565b610c049061ffff168461423b565b610c0e9190614268565b9050610c9361019460009054906101000a90046001600160a01b03166001600160a01b031663707d18486040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610c69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c8d919061427c565b82612737565b6000610c9f8c80614299565b808060200260200160405190810160405280939291908181526020016000905b82821015610ceb57610cdc60a083028601368190038101906142f0565b81526020019060010190610cbf565b505050505090506000815184610d019190614268565b90506000825184610d129190614268565b905060008e6040016020810190610d299190613ca5565b905060005b8451811015610dfa576000858281518110610d4b57610d4b6140be565b602002602001015190506000610d6182876127dc565b608083015190915060009060ff16600103610d7d575085610d95565b81610d8887896141de565b610d9291906141de565b90505b6000610da18483612986565b608085015190915060ff16600103610de35760008184610dc18a8c6141de565b610dcb91906141de565b610dd591906141de565b9050610de18782612737565b505b505050508080610df290614114565b915050610d2e565b50610e048c612aad565b610e0c61260c565b5050505050505b610e1d8987612c15565b610e2689612d06565b6040518635907fc0a8d68d4d1f533ef6cdb7a49068cbe04356682803cb7983c4ba33ce99100efd90600090a25050600160cc5550505050505050565b60996000610e6e61166c565b6001600160a01b0316815260208101919091526040016000205460ff16610ea75760405162461bcd60e51b81526004016104b990614078565b6040516301ffc9a760e01b815263071d7d4b60e21b60048201526001600160a01b038216906301ffc9a790602401602060405180830381865afa158015610ef2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f16919061437c565b610f4e5760405162461bcd60e51b8152602060048201526009602482015268453a5554503a494e5360b81b60448201526064016104b9565b61019580546001600160a01b0319166001600160a01b0383169081179091556040517fdf3b866248a7a3e982f0a93fde9cf30633ed3bb09365c16b08260ad033db920790600090a250565b6001600160a01b037f0000000000000000000000002ce2319c8187d0520ab1a4b3f668063e08e5b8bc163003610fe15760405162461bcd60e51b81526004016104b99061412d565b7f0000000000000000000000002ce2319c8187d0520ab1a4b3f668063e08e5b8bc6001600160a01b031661102a6000805160206146a3833981519152546001600160a01b031690565b6001600160a01b0316146110505760405162461bcd60e51b81526004016104b990614179565b611059826116d3565b61071382826001611718565b6000306001600160a01b037f0000000000000000000000002ce2319c8187d0520ab1a4b3f668063e08e5b8bc16146111055760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c000000000000000060648201526084016104b9565b506000805160206146a383398151915290565b600260cc540361116a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016104b9565b600260cc55611177611999565b6111848585858585612d2a565b61118d85612d06565b60405160e0860135907f61b9399f2f0f32ca39ce8d7be32caed5ec22fe07a6daba3a467ed479ec60658290600090a25050600160cc55505050565b609960006111d461166c565b6001600160a01b0316815260208101919091526040016000205460ff1661120d5760405162461bcd60e51b81526004016104b990614078565b6040516301ffc9a760e01b815263042eca1d60e51b60048201526001600160a01b038216906301ffc9a790602401602060405180830381865afa158015611258573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061127c919061437c565b6112b45760405162461bcd60e51b8152602060048201526009602482015268453a5550523a494e5360b81b60448201526064016104b9565b61019480546001600160a01b0319166001600160a01b0383169081179091556040517fa48d197b43b1826afcf98445392676fa169817dd3216002b6fd70e8601ef2b0190600090a250565b6099600061130b61166c565b6001600160a01b0316815260208101919091526040016000205460ff166113445760405162461bcd60e51b81526004016104b990614078565b61055181611883565b600054610100900460ff161580801561136d5750600054600160ff909116105b806113875750303b158015611387575060005460ff166001145b6113ea5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016104b9565b6000805460ff19166001179055801561140d576000805461ff0019166101001790555b611415612ed9565b61141d612f00565b6114696040518060400160405280600f81526020016e5342494e46542045786368616e676560881b815250604051806040016040528060038152602001620312e360ec1b815250612f3a565b611471612f6b565b611479612f9a565b611481612ed9565b61148a846111c8565b61149383611535565b61149c82610e62565b80156114e2576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b609960006114f461166c565b6001600160a01b0316815260208101919091526040016000205460ff1661152d5760405162461bcd60e51b81526004016104b990614078565b6108d1612fc9565b6099600061154161166c565b6001600160a01b0316815260208101919091526040016000205460ff1661157a5760405162461bcd60e51b81526004016104b990614078565b6040516301ffc9a760e01b8152635a8c1c2960e01b60048201526001600160a01b038216906301ffc9a790602401602060405180830381865afa1580156115c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115e9919061437c565b6116215760405162461bcd60e51b8152602060048201526009602482015268453a5552523a494e5360b81b60448201526064016104b9565b61019680546001600160a01b0319166001600160a01b0383169081179091556040517f39753a6336ef533f6e1785dcab15abdacaf0467b09c6127c32053ad75bcefc6790600090a250565b6000611676613007565b905090565b6001600160a01b038116600081815260996020908152604091829020805460ff1916905590519182527fa3b62bc36326052d97ea62d63c3d60308ed4c3ea8ac079dd8499f1e9c4f80c0f91015b60405180910390a150565b609960006116df61166c565b6001600160a01b0316815260208101919091526040016000205460ff166105515760405162461bcd60e51b81526004016104b990614078565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff161561174b5761061d8361304b565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156117a5575060408051601f3d908101601f191682019092526117a2918101906141c5565b60015b6118085760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b60648201526084016104b9565b6000805160206146a383398151915281146118775760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b60648201526084016104b9565b5061061d8383836130e7565b6001600160a01b0381166118ed5760405162461bcd60e51b815260206004820152602b60248201527f41646d696e3a61646441646d696e206e657741646d696e20697320746865207a60448201526a65726f206164647265737360a81b60648201526084016104b9565b6001600160a01b038116600081815260996020908152604091829020805460ff1916600117905590519182527f44d6d25963f097ad14f29f06854a01f575648a1ef82f30e562ccd3889717e33991016116c8565b61194961310c565b60fe805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa61197c61166c565b6040516001600160a01b03909116815260200160405180910390a1565b60fe5460ff16156108d15760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016104b9565b6119e882613155565b15611a235760405162461bcd60e51b815260206004820152600b60248201526a114e90d411914e94d3d31160aa1b60448201526064016104b9565b428160c001351015611a635760405162461bcd60e51b8152602060048201526009602482015268453a435046453a454f60b81b60448201526064016104b9565b6101965460408051630c0586bf60e11b815290516064926001600160a01b03169163180b0d7e91600480830192602092919082900301816000875af1158015611ab0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ad49190614201565b611ade919061439e565b61ffff16611af260a084016080850161421e565b61ffff161015611b325760405162461bcd60e51b815260206004820152600b60248201526a229d21a823229d29a4a82360a91b60448201526064016104b9565b6322ba176160e21b611b4a6080830160608401613c75565b6001600160e01b03191603611c1e57610194546001600160a01b0316635247385c611b7b60a0840160808501613ca5565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015611bbf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611be3919061437c565b611c1e5760405162461bcd60e51b815260206004820152600c60248201526b453a435046453a4250544e5760a01b60448201526064016104b9565b6000611c2a8380614299565b905011611c675760405162461bcd60e51b815260206004820152600b60248201526a114e90d411914e94d2505360aa1b60448201526064016104b9565b60005b611c748380614299565b9050811015611ddb57611cb5611c8a8480614299565b83818110611c9a57611c9a6140be565b611cb092602060a0909202019081019150613c75565b61317e565b611cef5760405162461bcd60e51b815260206004820152600b60248201526a453a435046453a5341494f60a81b60448201526064016104b9565b6000611cfb8480614299565b83818110611d0b57611d0b6140be565b905060a002016020016020810190611d239190613ca5565b6001600160a01b031603611d675760405162461bcd60e51b815260206004820152600b60248201526a114e90d411914e94d0525560aa1b60448201526064016104b9565b611d718380614299565b82818110611d8157611d816140be565b905060a0020160400135600003611dc95760405162461bcd60e51b815260206004820152600c60248201526b453a435046453a534149544960a01b60448201526064016104b9565b80611dd381614114565b915050611c6a565b6000611ded6040850160208601613ca5565b6001600160a01b031603611e315760405162461bcd60e51b815260206004820152600b60248201526a453a435046453a5349434f60a81b60448201526064016104b9565b6000611e436060850160408601613ca5565b6001600160a01b031603611e875760405162461bcd60e51b815260206004820152600b60248201526a229d21a823229d29a4a82960a91b60448201526064016104b9565b60008360a00135118015611e9f5750428360a0013511155b611ed85760405162461bcd60e51b815260206004820152600a602482015269453a435046453a53495360b01b60448201526064016104b9565b60c08301351580611eec5750428360c00135115b611f255760405162461bcd60e51b815260206004820152600a602482015269453a435046453a53494560b01b60448201526064016104b9565b8260e00135600003611f665760405162461bcd60e51b815260206004820152600a602482015269229d21a823229d29a4a760b11b60448201526064016104b9565b8135600003611fa45760405162461bcd60e51b815260206004820152600a602482015269453a435046453a42495360b01b60448201526064016104b9565b60e0830135823514611fe55760405162461bcd60e51b815260206004820152600a602482015269229d21a823229d29a12760b11b60448201526064016104b9565b6000611ff76040840160208501613ca5565b6001600160a01b03160361203a5760405162461bcd60e51b815260206004820152600a602482015269229d21a823229d2124a160b11b60448201526064016104b9565b600061204c6060840160408501613ca5565b6001600160a01b03160361208f5760405162461bcd60e51b815260206004820152600a6024820152690453a435046453a4249560b41b60448201526064016104b9565b6120a76120a26080840160608501613c75565b6131b4565b6120e15760405162461bcd60e51b815260206004820152600b60248201526a453a435046453a4249504d60a81b60448201526064016104b9565b60a08201356000036121235760405162461bcd60e51b815260206004820152600b60248201526a0453a435046453a424f49560ac1b60448201526064016104b9565b6121336040830160208401613ca5565b6001600160a01b031661214c6040850160208601613ca5565b6001600160a01b0316036121915760405162461bcd60e51b815260206004820152600c60248201526b453a435046453a434141425360a01b60448201526064016104b9565b506000805b6121a360608501856143bf565b90508210156122fa576121e26121bc60608601866143bf565b848181106121cc576121cc6140be565b6120a29260206060909202019081019150613c75565b61221e5760405162461bcd60e51b815260206004820152600d60248201526c453a435046453a5341504d504d60981b60448201526064016104b9565b61222b60608501856143bf565b8381811061223b5761223b6140be565b905060600201604001356000036122845760405162461bcd60e51b815260206004820152600d60248201526c0453a435046453a5341504d495609c1b60448201526064016104b9565b6122946080840160608501613c75565b6001600160e01b0319166122ab60608601866143bf565b848181106122bb576122bb6140be565b6122d19260206060909202019081019150613c75565b6001600160e01b031916036122e8575060016122fa565b816122f281614114565b925050612196565b806114e25760405162461bcd60e51b815260206004820152600b60248201526a453a435046453a504d4e4d60a81b60448201526064016104b9565b60006123c888888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506123c2925061237f91508d9050613220565b61238761331d565b6040805161190160f01b6020808301919091526022820193909352604280820194909452815180820390940184526062019052815191012090565b90613398565b90506123da60408a0160208b01613ca5565b6001600160a01b0316816001600160a01b0316146124265760405162461bcd60e51b8152602060048201526009602482015268453a5653453a49535360b81b60448201526064016104b9565b6000612431876133b4565b905061247b86868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506123c29250859150612387905061331d565b915061248d6040880160208901613ca5565b6001600160a01b0316826001600160a01b0316146124d95760405162461bcd60e51b8152602060048201526009602482015268453a5653453a49425360b81b60448201526064016104b9565b61252184848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506123c29250859150612387905061331d565b61019454604051631353b4cb60e21b81526001600160a01b038084166004830152929450911690634d4ed32c90602401602060405180830381865afa15801561256e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612592919061437c565b6125ca5760405162461bcd60e51b8152602060048201526009602482015268453a5653453a49505360b81b60448201526064016104b9565b50505050505050505050565b60006001600160e01b0319821663fdae1ba760e01b148061046e57506001600160e01b031982166322ba176160e21b1492915050565b60005b61019a5481101561266a57610199600061019a8381548110612633576126336140be565b60009182526020808320909101546001600160a01b031683528201929092526040018120558061266281614114565b91505061260f565b506108d161019a6000613bfb565b600080805b61268a60608601866143bf565b905081101561272f576126a36080850160608601613c75565b6001600160e01b0319166126ba60608701876143bf565b838181106126ca576126ca6140be565b6126e09260206060909202019081019150613c75565b6001600160e01b0319160361271d576126fc60608601866143bf565b8281811061270c5761270c6140be565b90506060020160400135915061272f565b8061272781614114565b91505061267d565b509392505050565b8015610713576001600160a01b0382166000908152610199602052604081205490036127aa5761019a80546001810182556000919091527fd994f4dad00f9ff89caab117647e768aa59b274f965a222ec6a1586aa6e26bcb0180546001600160a01b0319166001600160a01b0384161790555b6001600160a01b03821660009081526101996020526040812080548392906127d3908490614407565b90915550505050565b815160009081906127fd906001600160e01b03191663163b6d3b60e21b1490565b801561281157506000846060015161ffff16115b1561297f5761019454602085015160405163342ce4cb60e11b81526001600160a01b0391821660048201526000929190911690636859c996906024016020604051808303816000875af115801561286c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612890919061427c565b90506001600160a01b0381166128d75760405162461bcd60e51b815260206004820152600c60248201526b453a535046543a5046524e5360a01b60448201526064016104b9565b61019660009054906101000a90046001600160a01b03166001600160a01b031663180b0d7e6040518163ffffffff1660e01b81526004016020604051808303816000875af115801561292d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129519190614201565b61ffff16856060015161ffff1685612969919061423b565b6129739190614268565b915061272f8183612737565b9392505050565b61019654602083015160408085015160808601519151634287115760e01b81526001600160a01b03938416600482015260248101919091526044810185905260ff909116606482015260009283926060928392859216906342871157906084016000604051808303816000875af1158015612a05573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612a2d91908101906144b3565b9194509250905060005b8351811015612aa1576000838281518110612a5457612a546140be565b60200260200101519050612a81858381518110612a7357612a736140be565b602002602001015182612737565b612a8b8187614407565b9550508080612a9990614114565b915050612a37565b50929695505050505050565b6000612abf6080830160608401613c75565b905060005b61019a5481101561061d57600061019a8281548110612ae557612ae56140be565b60009182526020808320909101546001600160a01b0316808352610199909152604090912054909150630251e45960e01b6001600160e01b0319851601612b62576040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015612b5c573d6000803e3d6000fd5b50612c00565b631d45e89f60e21b6001600160e01b0319851601612c0057610195546001600160a01b031663776062c3612b9c60a0880160808901613ca5565b612bac6060890160408a01613ca5565b85856040518563ffffffff1660e01b8152600401612bcd94939291906140d4565b600060405180830381600087803b158015612be757600080fd5b505af1158015612bfb573d6000803e3d6000fd5b505050505b50508080612c0d90614114565b915050612ac4565b60005b612c228380614299565b905081101561061d576000612c378480614299565b83818110612c4757612c476140be565b905060a00201803603810190612c5d91906142f0565b610195546020808301519293506001600160a01b039091169163f709b90691612c8c9060408901908901613ca5565b612c9c6040880160208901613ca5565b85604001516040518563ffffffff1660e01b8152600401612cc094939291906140d4565b600060405180830381600087803b158015612cda57600080fd5b505af1158015612cee573d6000803e3d6000fd5b50505050508080612cfe90614114565b915050612c18565b60016101976000612d1684613220565b815260208101919091526040016000205550565b6000612d3586613220565b90506000612d8186868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506123c29250869150612387905061331d565b9050612d936040880160208901613ca5565b6001600160a01b0316816001600160a01b031614612ddf5760405162461bcd60e51b8152602060048201526009602482015268453a5653433a49535360b81b60448201526064016104b9565b612e2784848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506123c29250869150612387905061331d565b61019454604051631353b4cb60e21b81526001600160a01b038084166004830152929350911690634d4ed32c90602401602060405180830381865afa158015612e74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e98919061437c565b612ed05760405162461bcd60e51b8152602060048201526009602482015268453a5653433a49505360b81b60448201526064016104b9565b50505050505050565b600054610100900460ff166108d15760405162461bcd60e51b81526004016104b990614587565b600054610100900460ff16612f275760405162461bcd60e51b81526004016104b990614587565b612f2f612ed9565b6108d161086d61166c565b600054610100900460ff16612f615760405162461bcd60e51b81526004016104b990614587565b6107138282613444565b600054610100900460ff16612f925760405162461bcd60e51b81526004016104b990614587565b6108d1613485565b600054610100900460ff16612fc15760405162461bcd60e51b81526004016104b990614587565b6108d16134b8565b612fd1611999565b60fe805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861197c61166c565b60007f000000000000000000000000307e7a9713dbf6f19a2d2a2b670544f4791c4ec26001600160a01b03163303613046575060131936013560601c90565b503390565b6001600160a01b0381163b6130b85760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016104b9565b6000805160206146a383398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6130f0836134e6565b6000825111806130fd5750805b1561061d576114e28383613526565b60fe5460ff166108d15760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016104b9565b6000610197600061316584613220565b8152602001908152602001600020546001149050919050565b60006001600160e01b03198216639e80de3760e01b148061046e57506001600160e01b0319821663163b6d3b60e21b1492915050565b60006001600160e01b0319821663fdae1ba760e01b14806131e557506001600160e01b031982166322ba176160e21b145b8061320057506001600160e01b03198216633ecaa07960e21b145b8061046e57506001600160e01b0319821663d5a81f1960e01b1492915050565b60007f39b77601008263a7668e3e906fb7170db776f21b4b101c313e63194c888f361d6132556132508480614299565b61361a565b6132656040850160208601613ca5565b6132756060860160408701613ca5565b61328a61328560608801886143bf565b6136ec565b61329a60a088016080890161421e565b6040805160208101979097528601949094526001600160a01b0392831660608601529116608084015260a08381019190915261ffff90911660c0838101919091529084013560e08381019190915290840135610100830152830135610120820152610140015b604051602081830303815290604052805190602001209050919050565b60006116767f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f61334c60015490565b6002546040805160208101859052908101839052606081018290524660808201523060a082015260009060c0016040516020818303038152906040528051906020012090509392505050565b60008060006133a7858561378d565b9150915061272f816137d2565b60007f16533b1a2b574048998c15c61696aff2836a5106c01e21954538cf393cf8124a82356133e96040850160208601613ca5565b6133f96060860160408701613ca5565b61340586606001613988565b6040805160208101969096528501939093526001600160a01b03918216606085015216608083015260a082015260c0808401359082015260e001613300565b600054610100900460ff1661346b5760405162461bcd60e51b81526004016104b990614587565b815160209283012081519190920120600191909155600255565b600054610100900460ff166134ac5760405162461bcd60e51b81526004016104b990614587565b60fe805460ff19169055565b600054610100900460ff166134df5760405162461bcd60e51b81526004016104b990614587565b600160cc55565b6134ef8161304b565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b61358e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016104b9565b600080846001600160a01b0316846040516135a991906145f6565b600060405180830381855af49150503d80600081146135e4576040519150601f19603f3d011682016040523d82523d6000602084013e6135e9565b606091505b509150915061361182826040518060600160405280602781526020016146c360279139613a02565b95945050505050565b600080826001600160401b0381111561363557613635613eac565b60405190808252806020026020018201604052801561365e578160200160208202803683370190505b50905060005b838110156136bb5761368c858583818110613681576136816140be565b905060a00201613a3b565b82828151811061369e5761369e6140be565b6020908102919091010152806136b381614114565b915050613664565b50806040516020016136cd9190614612565b6040516020818303038152906040528051906020012091505092915050565b600080826001600160401b0381111561370757613707613eac565b604051908082528060200260200182016040528015613730578160200160208202803683370190505b50905060005b838110156136bb5761375e858583818110613753576137536140be565b905060600201613988565b828281518110613770576137706140be565b60209081029190910101528061378581614114565b915050613736565b60008082516041036137c35760208301516040840151606085015160001a6137b787828585613aed565b945094505050506137cb565b506000905060025b9250929050565b60008160048111156137e6576137e661463c565b036137ee5750565b60018160048111156138025761380261463c565b0361384f5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016104b9565b60028160048111156138635761386361463c565b036138b05760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016104b9565b60038160048111156138c4576138c461463c565b0361391c5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016104b9565b60048160048111156139305761393061463c565b036105515760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016104b9565b60007f5b442961536b72a0442e9a53df012289ed70f5c860457d810d2c17836bd8bdce6139b86020840184613c75565b6139c86040850160208601613ca5565b6040805160208101949094526001600160e01b0319909216838301526001600160a01b03166060830152830135608082015260a001613300565b60608315613a1157508161297f565b825115613a215782518084602001fd5b8160405162461bcd60e51b81526004016104b99190614652565b60007fda89efe36e8d4174abec2b392e28fde5f06a39ea80761619c7690bf866064524613a6b6020840184613c75565b613a7b6040850160208601613ca5565b6040850135613a90608087016060880161421e565b613aa060a0880160808901614685565b6040805160208101979097526001600160e01b0319909516948601949094526001600160a01b039092166060850152608084015261ffff1660a083015260ff1660c082015260e001613300565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115613b245750600090506003613bd1565b8460ff16601b14158015613b3c57508460ff16601c14155b15613b4d5750600090506004613bd1565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613ba1573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116613bca57600060019250925050613bd1565b9150600090505b94509492505050565b50805460008255600202906000526020600020908101906105519190613c19565b50805460008255906000526020600020908101906105519190613c43565b5b80821115613c3f5780546001600160a01b031916815560006001820155600201613c1a565b5090565b5b80821115613c3f5760008155600101613c44565b80356001600160e01b031981168114613c7057600080fd5b919050565b600060208284031215613c8757600080fd5b61297f82613c58565b6001600160a01b038116811461055157600080fd5b600060208284031215613cb757600080fd5b813561297f81613c90565b60008060408385031215613cd557600080fd5b8235613ce081613c90565b91506020830135613cf081613c90565b809150509250929050565b60008060208385031215613d0e57600080fd5b82356001600160401b0380821115613d2557600080fd5b818501915085601f830112613d3957600080fd5b813581811115613d4857600080fd5b8660208260051b8501011115613d5d57600080fd5b60209290920196919550909350505050565b60006101008284031215613d8257600080fd5b50919050565b60008083601f840112613d9a57600080fd5b5081356001600160401b03811115613db157600080fd5b6020830191508360208285010111156137cb57600080fd5b600080600080600080600080888a03610160811215613de757600080fd5b89356001600160401b0380821115613dfe57600080fd5b613e0a8d838e01613d6f565b9a5060208c0135915080821115613e2057600080fd5b613e2c8d838e01613d88565b909a50985088915060e0603f1984011215613e4657600080fd5b60408c0197506101208c0135925080831115613e6157600080fd5b613e6d8d848e01613d88565b90975095506101408c0135925086915080831115613e8a57600080fd5b5050613e988b828c01613d88565b999c989b5096995094979396929594505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715613eea57613eea613eac565b604052919050565b60008060408385031215613f0557600080fd5b8235613f1081613c90565b91506020838101356001600160401b0380821115613f2d57600080fd5b818601915086601f830112613f4157600080fd5b813581811115613f5357613f53613eac565b613f65601f8201601f19168501613ec2565b91508082528784828501011115613f7b57600080fd5b80848401858401376000848284010152508093505050509250929050565b600080600080600060608688031215613fb157600080fd5b85356001600160401b0380821115613fc857600080fd5b613fd489838a01613d6f565b96506020880135915080821115613fea57600080fd5b613ff689838a01613d88565b9096509450604088013591508082111561400f57600080fd5b5061401c88828901613d88565b969995985093965092949392505050565b60008060006060848603121561404257600080fd5b833561404d81613c90565b9250602084013561405d81613c90565b9150604084013561406d81613c90565b809150509250925092565b60208082526026908201527f41646d696e3a6f6e6c7941646d696e2063616c6c6572206973206e6f7420616e6040820152651020b236b4b760d11b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b6001600160a01b039485168152928416602084015292166040820152606081019190915260800190565b634e487b7160e01b600052601160045260246000fd5b600060018201614126576141266140fe565b5060010190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b6000602082840312156141d757600080fd5b5051919050565b8181038181111561046e5761046e6140fe565b61ffff8116811461055157600080fd5b60006020828403121561421357600080fd5b815161297f816141f1565b60006020828403121561423057600080fd5b813561297f816141f1565b808202811582820484141761046e5761046e6140fe565b634e487b7160e01b600052601260045260246000fd5b60008261427757614277614252565b500490565b60006020828403121561428e57600080fd5b815161297f81613c90565b6000808335601e198436030181126142b057600080fd5b8301803591506001600160401b038211156142ca57600080fd5b602001915060a0810236038213156137cb57600080fd5b60ff8116811461055157600080fd5b600060a0828403121561430257600080fd5b60405160a081018181106001600160401b038211171561432457614324613eac565b60405261433083613c58565b8152602083013561434081613c90565b602082015260408381013590820152606083013561435d816141f1565b60608201526080830135614370816142e1565b60808201529392505050565b60006020828403121561438e57600080fd5b8151801515811461297f57600080fd5b600061ffff808416806143b3576143b3614252565b92169190910492915050565b6000808335601e198436030181126143d657600080fd5b8301803591506001600160401b038211156143f057600080fd5b60200191506060810236038213156137cb57600080fd5b8082018082111561046e5761046e6140fe565b60006001600160401b0382111561443357614433613eac565b5060051b60200190565b600082601f83011261444e57600080fd5b8151602061446361445e8361441a565b613ec2565b82815260059290921b8401810191818101908684111561448257600080fd5b8286015b8481101561449d5780518352918301918301614486565b509695505050505050565b8051613c70816142e1565b6000806000606084860312156144c857600080fd5b83516001600160401b03808211156144df57600080fd5b818601915086601f8301126144f357600080fd5b8151602061450361445e8361441a565b82815260059290921b8401810191818101908a84111561452257600080fd5b948201945b8386101561454957855161453a81613c90565b82529482019490820190614527565b9189015191975090935050508082111561456257600080fd5b5061456f8682870161443d565b92505061457e604085016144a8565b90509250925092565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b838110156145ed5781810151838201526020016145d5565b50506000910152565b600082516146088184602087016145d2565b9190910192915050565b815160009082906020808601845b83811015612aa157815185529382019390820190600101614620565b634e487b7160e01b600052602160045260246000fd5b60208152600082518060208401526146718160408501602087016145d2565b601f01601f19169190910160400192915050565b60006020828403121561469757600080fd5b813561297f816142e156fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220fedc2fe117172b3e17e2bba63a9fdac4ec29a0d0d6097b0d04fe3e6eae12054464736f6c63430008130033