Source Code
Overview
ETH Balance
0 ETH
More Info
ContractCreator
Multi Chain
Multichain Addresses
0 address found via
Loading...
Loading
Contract Name:
SubscriptionRegistry
Compiler Version
v0.8.19+commit.7dd6d404
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT // ENVELOP(NIFTSY) Team. Subscription Registry Contract V2 pragma solidity 0.8.19; import "Ownable.sol"; import "SafeERC20.sol"; import "ITrustedWrapper.sol"; import "LibEnvelopTypes.sol"; import "ISubscriptionRegistry.sol"; /// The subscription platform operates with the following role model /// (it is assumed that the actor with the role is implemented as a contract). /// `Service Provider` is a contract whose services are sold by subscription. /// `Agent` - a contract that sells a subscription on behalf ofservice provider. /// May receive sales commission /// `Platform` - SubscriptionRegistry contract that performs processingsubscriptions, /// fares, tickets struct SubscriptionType { uint256 timelockPeriod; // in seconds e.g. 3600*24*30*12 = 31104000 = 1 year uint256 ticketValidPeriod; // in seconds e.g. 3600*24*30 = 2592000 = 1 month uint256 counter; // For case when ticket valid for N usage, e.g. for Min N NFTs bool isAvailable; // USe for stop using tariff because we can`t remove tariff from array address beneficiary; // Who will receive payment for tickets } struct PayOption { address paymentToken; // token contract address or zero address for native token(ETC etc) uint256 paymentAmount; // ticket price exclude any fees uint16 agentFeePercent; // 100%-10000, 20%-2000, 3%-300 } struct Tariff { SubscriptionType subscription; // link to subscriptionType PayOption[] payWith; // payment option array. Use it for price in defferent tokens } // native subscribtionManager tickets format struct Ticket { uint256 validUntil; // Unixdate, tickets not valid after uint256 countsLeft; // for tarif with fixed use counter } /// @title Base contract in Envelop Subscription Platform /// @author Envelop Team /// @notice You can use this contract for make and operate any on-chain subscriptions /// @dev Contract that performs processing subscriptions, fares(tariffs), tickets /// @custom:please see example folder. contract SubscriptionRegistry is Ownable { using SafeERC20 for IERC20; uint256 constant public PERCENT_DENOMINATOR = 10000; /// @notice Envelop Multisig contract address public platformOwner; /// @notice Platform owner can receive fee from each payments uint16 public platformFeePercent = 50; // 100%-10000, 20%-2000, 3%-300 /// @notice address used for wrapp & lock incoming assets address public mainWrapper; /// @notice Used in case upgrade this contract address public previousRegistry; /// @notice Used in case upgrade this contract address public proxyRegistry; /// @notice Only white listed assets can be used on platform mapping(address => bool) public whiteListedForPayments; /// @notice from service(=smart contract address) to tarifs mapping(address => Tariff[]) public availableTariffs; /// @notice from service to agent to available tarifs(tarif index); mapping(address => mapping(address => uint256[])) public agentServiceRegistry; /// @notice mapping from user addres to service contract address to ticket mapping(address => mapping(address => Ticket)) public userTickets; event PlatfromFeeChanged(uint16 indexed newPercent); event WhitelistPaymentTokenChanged(address indexed asset, bool indexed state); event TariffChanged(address indexed service, uint256 indexed tariffIndex); event TicketIssued( address indexed service, address indexed agent, address indexed forUser, uint256 tariffIndex ); constructor(address _platformOwner) { require(_platformOwner != address(0),'Zero platform fee receiver'); platformOwner = _platformOwner; } /** * @notice Add new tariff for caller * @dev Call this method from ServiceProvider * for setup new tariff * using `Tariff` data type(please see above) * * @param _newTariff full encded Tariff object * @return last added tariff index in Tariff[] array * for current Service Provider (msg.sender) */ function registerServiceTariff(Tariff calldata _newTariff) external returns(uint256) { // TODO // Tarif structure check // PayWith array whiteList check return _addTariff(msg.sender, _newTariff); } /** * @notice Edit tariff for caller * @dev Call this method from ServiceProvider * for setup new tariff * using `Tariff` data type(please see above) * * @param _tariffIndex - index in `availableTariffs` array * @param _timelockPeriod - see SubscriptionType notice above * @param _ticketValidPeriod - see SubscriptionType notice above * @param _counter - see SubscriptionType notice above * @param _isAvailable - see SubscriptionType notice above * @param _beneficiary - see SubscriptionType notice above */ function editServiceTariff( uint256 _tariffIndex, uint256 _timelockPeriod, uint256 _ticketValidPeriod, uint256 _counter, bool _isAvailable, address _beneficiary ) external { // TODO // Tariff structure check // PayWith array whiteList check _editTariff( msg.sender, _tariffIndex, _timelockPeriod, _ticketValidPeriod, _counter, _isAvailable, _beneficiary ); } /** * @notice Add tariff PayOption for exact service * @dev Call this method from ServiceProvider * for add tariff PayOption * * @param _tariffIndex - index in `availableTariffs` array * @param _paymentToken - see PayOption notice above * @param _paymentAmount - see PayOption notice above * @param _agentFeePercent - see PayOption notice above * @return last added PaymentOption index in array * for _tariffIndex Tariff of caller Service Provider (msg.sender) */ function addTariffPayOption( uint256 _tariffIndex, address _paymentToken, uint256 _paymentAmount, uint16 _agentFeePercent ) external returns(uint256) { return _addTariffPayOption( msg.sender, _tariffIndex, _paymentToken, _paymentAmount, _agentFeePercent ); } /** * @notice Edit tariff PayOption for exact service * @dev Call this method from ServiceProvider * for edit tariff PayOption * * @param _tariffIndex - index in `availableTariffs` array * @param _payWithIndex - index in `tariff.payWith` array * @param _paymentToken - see PayOption notice above * @param _paymentAmount - see PayOption notice above * @param _agentFeePercent - see PayOption notice above * for _tariffIndex Tariff of caller Service Provider (msg.sender) */ function editTariffPayOption( uint256 _tariffIndex, uint256 _payWithIndex, address _paymentToken, uint256 _paymentAmount, uint16 _agentFeePercent ) external { _editTariffPayOption( msg.sender, _tariffIndex, _payWithIndex, _paymentToken, _paymentAmount, _agentFeePercent ); } /** * @notice Authorize agent for caller service provider * @dev Call this method from ServiceProvider * * @param _agent - address of contract that implement Agent role * @param _serviceTariffIndexes - array of index in `availableTariffs` array * that available for given `_agent` * @return full array of actual tarifs for this agent */ function authorizeAgentForService( address _agent, uint256[] calldata _serviceTariffIndexes ) external virtual returns (uint256[] memory) { // remove previouse tariffs delete agentServiceRegistry[msg.sender][_agent]; uint256[] storage currentServiceTariffsOfAgent = agentServiceRegistry[msg.sender][_agent]; // check that adding tariffs still available for(uint256 i; i < _serviceTariffIndexes.length; ++ i) { if (availableTariffs[msg.sender][_serviceTariffIndexes[i]].subscription.isAvailable){ currentServiceTariffsOfAgent.push(_serviceTariffIndexes[i]); } } return currentServiceTariffsOfAgent; } /** * @notice By Ticket for subscription * @dev Call this method from Agent * * @param _service - Service Provider address * @param _tariffIndex - index in `availableTariffs` array * @param _payWithIndex - index in `tariff.payWith` array * @param _buyFor - address for whome this ticket would be bought * @param _payer - address of payer for this ticket * @return ticket structure that would be use for validate service process */ function buySubscription( address _service, uint256 _tariffIndex, uint256 _payWithIndex, address _buyFor, address _payer ) external payable returns(Ticket memory ticket) { // Cant buy ticket for nobody require(_buyFor != address(0),'Cant buy ticket for nobody'); require( availableTariffs[_service][_tariffIndex].subscription.isAvailable, 'This subscription not available' ); // Not used in this implementation // require( // availableTariffs[_service][_tariffIndex].payWith[_payWithIndex].paymentAmount > 0, // 'This Payment option not available' // ); // Check that agent is authorized for purchace of this service require( _isAgentAuthorized(msg.sender, _service, _tariffIndex), 'Agent not authorized for this service tariff' ); (bool isValid, bool needFix) = _isTicketValid(_buyFor, _service); require(!isValid, 'Only one valid ticket at time'); //lets safe user ticket (only one ticket available in this version) ticket = Ticket( availableTariffs[_service][_tariffIndex].subscription.ticketValidPeriod + block.timestamp, availableTariffs[_service][_tariffIndex].subscription.counter ); userTickets[_buyFor][_service] = ticket; // Lets receive payment tokens FROM sender if (availableTariffs[_service][_tariffIndex].payWith[_payWithIndex].paymentAmount > 0){ _processPayment(_service, _tariffIndex, _payWithIndex, _payer); } emit TicketIssued(_service, msg.sender, _buyFor, _tariffIndex); } /** * @notice Check that `_user` have still valid ticket for this service. * Decrement ticket counter in case it > 0 * @dev Call this method from ServiceProvider * * @param _user - address of user who has an ticket and who trying get service * @return ok True in case ticket is valid */ function checkAndFixUserSubscription( address _user ) external returns (bool ok){ address _service = msg.sender; // Check user ticket (bool isValid, bool needFix) = _isTicketValid(_user, msg.sender); // Proxy to previos if (!isValid && previousRegistry != address(0)) { (isValid, needFix) = ISubscriptionRegistry(previousRegistry).checkUserSubscription( _user, _service ); // Case when valid ticket stored in previousManager if (isValid ) { if (needFix){ ISubscriptionRegistry(previousRegistry).fixUserSubscription( _user, _service ); } ok = true; return ok; } } require(isValid,'Valid ticket not found'); // Fix action (for subscription with counter) if (needFix){ _fixUserSubscription(_user, msg.sender); } ok = true; } /** * @notice Decrement ticket counter in case it > 0 * @dev Call this method from new SubscriptionRegistry in case of upgrade * * @param _user - address of user who has an ticket and who trying get service * @param _serviceFromProxy - address of service from more new SubscriptionRegistry contract */ function fixUserSubscription( address _user, address _serviceFromProxy ) public { require(proxyRegistry !=address(0) && msg.sender == proxyRegistry, 'Only for future registry' ); _fixUserSubscription(_user, _serviceFromProxy); } //////////////////////////////////////////////////////////////// /** * @notice Check that `_user` have still valid ticket for this service. * @dev Call this method from any context * * @param _user - address of user who has an ticket and who trying get service * @param _service - address of Service Provider * @return ok True in case ticket is valid * @return needFix True in case ticket has counter > 0 */ function checkUserSubscription( address _user, address _service ) external view returns (bool ok, bool needFix) { (ok, needFix) = _isTicketValid(_user, _service); if (!ok && previousRegistry != address(0)) { (ok, needFix) = ISubscriptionRegistry(previousRegistry).checkUserSubscription( _user, _service ); } } /** * @notice Returns `_user` ticket for this service. * @dev Call this method from any context * * @param _user - address of user who has an ticket and who trying get service * @param _service - address of Service Provider * @return ticket */ function getUserTicketForService( address _service, address _user ) public view returns(Ticket memory) { return userTickets[_user][_service]; } /** * @notice Returns array of Tariff for `_service` * @dev Call this method from any context * * @param _service - address of Service Provider * @return Tariff array */ function getTariffsForService(address _service) external view returns (Tariff[] memory) { return availableTariffs[_service]; } /** * @notice Returns ticket price include any fees * @dev Call this method from any context * * @param _service - address of Service Provider * @param _tariffIndex - index in `availableTariffs` array * @param _payWithIndex - index in `tariff.payWith` array * @return tulpe with payment token an ticket price */ function getTicketPrice( address _service, uint256 _tariffIndex, uint256 _payWithIndex ) public view virtual returns (address, uint256) { if (availableTariffs[_service][_tariffIndex].subscription.timelockPeriod != 0) { return( availableTariffs[_service][_tariffIndex].payWith[_payWithIndex].paymentToken, availableTariffs[_service][_tariffIndex].payWith[_payWithIndex].paymentAmount ); } else { return( availableTariffs[_service][_tariffIndex].payWith[_payWithIndex].paymentToken, availableTariffs[_service][_tariffIndex].payWith[_payWithIndex].paymentAmount + availableTariffs[_service][_tariffIndex].payWith[_payWithIndex].paymentAmount *availableTariffs[_service][_tariffIndex].payWith[_payWithIndex].agentFeePercent /PERCENT_DENOMINATOR + availableTariffs[_service][_tariffIndex].payWith[_payWithIndex].paymentAmount *_platformFeePercent(_service, _tariffIndex, _payWithIndex) /PERCENT_DENOMINATOR ); } } /** * @notice Returns array of Tariff for `_service` assigned to `_agent` * @dev Call this method from any context * * @param _agent - address of Agent * @param _service - address of Service Provider * @return tuple with two arrays: indexes and Tariffs */ function getAvailableAgentsTariffForService( address _agent, address _service ) external view virtual returns(uint256[] memory, Tariff[] memory) { //First need get count of tarifs that still available uint256 availableCount; for (uint256 i; i < agentServiceRegistry[_service][_agent].length; ++i){ if (availableTariffs[_service][ agentServiceRegistry[_service][_agent][i] ].subscription.isAvailable ) {++availableCount;} } Tariff[] memory tariffs = new Tariff[](availableCount); uint256[] memory indexes = new uint256[](availableCount); for (uint256 i; i < agentServiceRegistry[_service][_agent].length; ++i){ if (availableTariffs[_service][ agentServiceRegistry[_service][_agent][i] ].subscription.isAvailable ) { tariffs[availableCount - 1] = availableTariffs[_service][ agentServiceRegistry[_service][_agent][i] ]; indexes[availableCount - 1] = agentServiceRegistry[_service][_agent][i]; --availableCount; } } return (indexes, tariffs); } //////////////////////////////////////////////////////////////// ////////// Admins ////// //////////////////////////////////////////////////////////////// function setAssetForPaymentState(address _asset, bool _isEnable) external onlyOwner { whiteListedForPayments[_asset] = _isEnable; emit WhitelistPaymentTokenChanged(_asset, _isEnable); } function setMainWrapper(address _wrapper) external onlyOwner { mainWrapper = _wrapper; } function setPlatformOwner(address _newOwner) external { require(msg.sender == platformOwner, 'Only platform owner'); require(_newOwner != address(0),'Zero platform fee receiver'); platformOwner = _newOwner; } function setPlatformFeePercent(uint16 _newPercent) external { require(msg.sender == platformOwner, 'Only platform owner'); platformFeePercent = _newPercent; emit PlatfromFeeChanged(platformFeePercent); } function setPreviousRegistry(address _registry) external onlyOwner { previousRegistry = _registry; } function setProxyRegistry(address _registry) external onlyOwner { proxyRegistry = _registry; } ///////////////////////////////////////////////////////////////////// function _processPayment( address _service, uint256 _tariffIndex, uint256 _payWithIndex, address _payer ) internal virtual returns(bool) { // there are two payment method for this implementation. // 1. with wrap and lock in asset (no fees) // 2. simple payment (agent & platform fee enabled) if (availableTariffs[_service][_tariffIndex].subscription.timelockPeriod != 0){ require(msg.value == 0, 'Ether Not accepted in this method'); // 1. with wrap and lock in asset IERC20( availableTariffs[_service][_tariffIndex].payWith[_payWithIndex].paymentToken ).safeTransferFrom( _payer, address(this), availableTariffs[_service][_tariffIndex].payWith[_payWithIndex].paymentAmount ); // Lets approve received for wrap IERC20( availableTariffs[_service][_tariffIndex].payWith[_payWithIndex].paymentToken ).safeApprove( mainWrapper, availableTariffs[_service][_tariffIndex].payWith[_payWithIndex].paymentAmount ); // Lets wrap with timelock and appropriate params ETypes.INData memory _inData; ETypes.AssetItem[] memory _collateralERC20 = new ETypes.AssetItem[](1); ETypes.Lock[] memory timeLock = new ETypes.Lock[](1); // Only need set timelock for this wNFT timeLock[0] = ETypes.Lock( 0x00, // timelock availableTariffs[_service][_tariffIndex].subscription.timelockPeriod + block.timestamp ); _inData = ETypes.INData( ETypes.AssetItem( ETypes.Asset(ETypes.AssetType.EMPTY, address(0)), 0,0 ), // INAsset address(0), // Unwrap destinition new ETypes.Fee[](0), // Fees //new ETypes.Lock[](0), // Locks timeLock, new ETypes.Royalty[](0), // Royalties ETypes.AssetType.ERC721, // Out type 0, // Out Balance 0x0000 // Rules ); _collateralERC20[0] = ETypes.AssetItem( ETypes.Asset( ETypes.AssetType.ERC20, availableTariffs[_service][_tariffIndex].payWith[_payWithIndex].paymentToken ), 0, availableTariffs[_service][_tariffIndex].payWith[_payWithIndex].paymentAmount ); ITrustedWrapper(mainWrapper).wrap( _inData, _collateralERC20, _payer ); } else { // 2. simple payment if (availableTariffs[_service][_tariffIndex] .payWith[_payWithIndex] .paymentToken != address(0) ) { // pay with erc20 require(msg.value == 0, 'Ether Not accepted in this method'); // 2.1. Body payment IERC20( availableTariffs[_service][_tariffIndex].payWith[_payWithIndex].paymentToken ).safeTransferFrom( _payer, availableTariffs[_service][_tariffIndex].subscription.beneficiary, availableTariffs[_service][_tariffIndex].payWith[_payWithIndex].paymentAmount ); // 2.2. Agent fee payment IERC20( availableTariffs[_service][_tariffIndex].payWith[_payWithIndex].paymentToken ).safeTransferFrom( _payer, msg.sender, availableTariffs[_service][_tariffIndex].payWith[_payWithIndex].paymentAmount *availableTariffs[_service][_tariffIndex].payWith[_payWithIndex].agentFeePercent /PERCENT_DENOMINATOR ); // 2.3. Platform fee uint256 _pFee = _platformFeePercent(_service, _tariffIndex, _payWithIndex); if (_pFee > 0) { IERC20( availableTariffs[_service][_tariffIndex].payWith[_payWithIndex].paymentToken ).safeTransferFrom( _payer, platformOwner, // availableTariffs[_service][_tariffIndex].payWith[_payWithIndex].paymentAmount *_pFee /PERCENT_DENOMINATOR ); } } else { // pay with native token(eth, bnb, etc) (, uint256 needPay) = getTicketPrice(_service, _tariffIndex,_payWithIndex); require(msg.value >= needPay, 'Not enough ether'); // 2.4. Body ether payment sendValue( payable(availableTariffs[_service][_tariffIndex].subscription.beneficiary), availableTariffs[_service][_tariffIndex].payWith[_payWithIndex].paymentAmount ); // 2.5. Agent fee payment sendValue( payable(msg.sender), availableTariffs[_service][_tariffIndex].payWith[_payWithIndex].paymentAmount *availableTariffs[_service][_tariffIndex].payWith[_payWithIndex].agentFeePercent /PERCENT_DENOMINATOR ); // 2.3. Platform fee uint256 _pFee = _platformFeePercent(_service, _tariffIndex, _payWithIndex); if (_pFee > 0) { sendValue( payable(platformOwner), availableTariffs[_service][_tariffIndex].payWith[_payWithIndex].paymentAmount *_pFee /PERCENT_DENOMINATOR ); } // return change if ((msg.value - needPay) > 0) { address payable s = payable(_payer); s.transfer(msg.value - needPay); } } } } // In this impementation params not used. // Can be ovveriden in other cases function _platformFeePercent( address _service, uint256 _tariffIndex, uint256 _payWithIndex ) internal view virtual returns(uint256) { return platformFeePercent; } function _addTariff(address _service, Tariff calldata _newTariff) internal returns(uint256) { require (_newTariff.payWith.length > 0, 'No payment method'); for (uint256 i; i < _newTariff.payWith.length; ++i){ require( whiteListedForPayments[_newTariff.payWith[i].paymentToken], 'Not whitelisted for payments' ); } require( _newTariff.subscription.ticketValidPeriod > 0 || _newTariff.subscription.counter > 0, 'Tariff has no valid ticket option' ); availableTariffs[_service].push(_newTariff); emit TariffChanged(_service, availableTariffs[_service].length - 1); return availableTariffs[_service].length - 1; } function _editTariff( address _service, uint256 _tariffIndex, uint256 _timelockPeriod, uint256 _ticketValidPeriod, uint256 _counter, bool _isAvailable, address _beneficiary ) internal { availableTariffs[_service][_tariffIndex].subscription.timelockPeriod = _timelockPeriod; availableTariffs[_service][_tariffIndex].subscription.ticketValidPeriod = _ticketValidPeriod; availableTariffs[_service][_tariffIndex].subscription.counter = _counter; availableTariffs[_service][_tariffIndex].subscription.isAvailable = _isAvailable; availableTariffs[_service][_tariffIndex].subscription.beneficiary = _beneficiary; emit TariffChanged(_service, _tariffIndex); } function _addTariffPayOption( address _service, uint256 _tariffIndex, address _paymentToken, uint256 _paymentAmount, uint16 _agentFeePercent ) internal returns(uint256) { require(whiteListedForPayments[_paymentToken], 'Not whitelisted for payments'); availableTariffs[_service][_tariffIndex].payWith.push( PayOption(_paymentToken, _paymentAmount, _agentFeePercent) ); emit TariffChanged(_service, _tariffIndex); return availableTariffs[_service][_tariffIndex].payWith.length - 1; } function _editTariffPayOption( address _service, uint256 _tariffIndex, uint256 _payWithIndex, address _paymentToken, uint256 _paymentAmount, uint16 _agentFeePercent ) internal { require(whiteListedForPayments[_paymentToken], 'Not whitelisted for payments'); availableTariffs[_service][_tariffIndex].payWith[_payWithIndex] = PayOption(_paymentToken, _paymentAmount, _agentFeePercent); emit TariffChanged(_service, _tariffIndex); } function _fixUserSubscription( address _user, address _service ) internal { // Fix action (for subscription with counter) if (userTickets[_user][_service].countsLeft > 0) { -- userTickets[_user][_service].countsLeft; } } function _isTicketValid(address _user, address _service) internal view returns (bool isValid, bool needFix ) { isValid = userTickets[_user][_service].validUntil > block.timestamp || userTickets[_user][_service].countsLeft > 0; needFix = userTickets[_user][_service].countsLeft > 0; } function _isAgentAuthorized( address _agent, address _service, uint256 _tariffIndex ) internal view returns(bool authorized) { for (uint256 i; i < agentServiceRegistry[_service][_agent].length; ++ i){ if (agentServiceRegistry[_service][_agent][i] == _tariffIndex){ authorized = true; return authorized; } } } 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"); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "IERC20.sol"; import "draft-IERC20Permit.sol"; import "Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @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 functionCallWithValue(target, data, 0, "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"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, 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) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @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, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or 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 { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // 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); } } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.19; import "IWrapper.sol"; interface ITrustedWrapper is IWrapper { function trustedOperator() external view returns(address); function wrapUnsafe( ETypes.INData calldata _inData, ETypes.AssetItem[] calldata _collateral, address _wrappFor ) external payable returns (ETypes.AssetItem memory); function transferIn( ETypes.AssetItem memory _assetItem, address _from ) external payable returns (uint256 _transferedValue); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.19; //import "IERC721Enumerable.sol"; import "LibEnvelopTypes.sol"; interface IWrapper { event WrappedV1( address indexed inAssetAddress, address indexed outAssetAddress, uint256 indexed inAssetTokenId, uint256 outTokenId, address wnftFirstOwner, uint256 nativeCollateralAmount, bytes2 rules ); event UnWrappedV1( address indexed wrappedAddress, address indexed originalAddress, uint256 indexed wrappedId, uint256 originalTokenId, address beneficiary, uint256 nativeCollateralAmount, bytes2 rules ); event CollateralAdded( address indexed wrappedAddress, uint256 indexed wrappedId, uint8 assetType, address collateralAddress, uint256 collateralTokenId, uint256 collateralBalance ); event PartialUnWrapp( address indexed wrappedAddress, uint256 indexed wrappedId, uint256 lastCollateralIndex ); event SuspiciousFail( address indexed wrappedAddress, uint256 indexed wrappedId, address indexed failedContractAddress ); event EnvelopFee( address indexed receiver, address indexed wNFTConatract, uint256 indexed wNFTTokenId, uint256 amount ); function wrap( ETypes.INData calldata _inData, ETypes.AssetItem[] calldata _collateral, address _wrappFor ) external payable returns (ETypes.AssetItem memory); // function wrapUnsafe( // ETypes.INData calldata _inData, // ETypes.AssetItem[] calldata _collateral, // address _wrappFor // ) // external // payable // returns (ETypes.AssetItem memory); function addCollateral( address _wNFTAddress, uint256 _wNFTTokenId, ETypes.AssetItem[] calldata _collateral ) external payable; // function addCollateralUnsafe( // address _wNFTAddress, // uint256 _wNFTTokenId, // ETypes.AssetItem[] calldata _collateral // ) // external // payable; function unWrap( address _wNFTAddress, uint256 _wNFTTokenId ) external; function unWrap( ETypes.AssetType _wNFTType, address _wNFTAddress, uint256 _wNFTTokenId ) external; function unWrap( ETypes.AssetType _wNFTType, address _wNFTAddress, uint256 _wNFTTokenId, bool _isEmergency ) external; function chargeFees( address _wNFTAddress, uint256 _wNFTTokenId, address _from, address _to, bytes1 _feeType ) external returns (bool); ////////////////////////////////////////////////////////////////////// function MAX_COLLATERAL_SLOTS() external view returns (uint256); function protocolTechToken() external view returns (address); function protocolWhiteList() external view returns (address); //function trustedOperators(address _operator) external view returns (bool); //function lastWNFTId(ETypes.AssetType _assetType) external view returns (ETypes.NFTItem); function getWrappedToken(address _wNFTAddress, uint256 _wNFTTokenId) external view returns (ETypes.WNFT memory); function getOriginalURI(address _wNFTAddress, uint256 _wNFTTokenId) external view returns(string memory); function getCollateralBalanceAndIndex( address _wNFTAddress, uint256 _wNFTTokenId, ETypes.AssetType _collateralType, address _erc, uint256 _tokenId ) external view returns (uint256, uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol) pragma solidity ^0.8.0; import "IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "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: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * 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); }
// 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); }
// SPDX-License-Identifier: MIT // ENVELOP(NIFTSY) protocol V1 for NFT. pragma solidity 0.8.19; /// @title Flibrary ETypes in Envelop PrtocolV1 /// @author Envelop Team /// @notice This contract implement main protocol's data types library ETypes { enum AssetType {EMPTY, NATIVE, ERC20, ERC721, ERC1155, FUTURE1, FUTURE2, FUTURE3} struct Asset { AssetType assetType; address contractAddress; } struct AssetItem { Asset asset; uint256 tokenId; uint256 amount; } struct NFTItem { address contractAddress; uint256 tokenId; } struct Fee { bytes1 feeType; uint256 param; address token; } struct Lock { bytes1 lockType; uint256 param; } struct Royalty { address beneficiary; uint16 percent; } struct WNFT { AssetItem inAsset; AssetItem[] collateral; address unWrapDestination; Fee[] fees; Lock[] locks; Royalty[] royalties; bytes2 rules; } struct INData { AssetItem inAsset; address unWrapDestination; Fee[] fees; Lock[] locks; Royalty[] royalties; AssetType outType; uint256 outBalance; //0- for 721 and any amount for 1155 bytes2 rules; } struct WhiteListItem { bool enabledForFee; bool enabledForCollateral; bool enabledRemoveFromCollateral; address transferFeeModel; } struct Rules { bytes2 onlythis; bytes2 disabled; } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.19; import {SubscriptionType, PayOption, Tariff, Ticket} from "SubscriptionRegistry.sol"; interface ISubscriptionRegistry { /** * @notice Add new tariff for caller * @dev Call this method from ServiceProvider * for setup new tariff * using `Tariff` data type(please see above) * * @param _newTariff full encded Tariff object * @return last added tariff index in Tariff[] array * for current Service Provider (msg.sender) */ function registerServiceTariff(Tariff calldata _newTariff) external returns(uint256); /** * @notice Authorize agent for caller service provider * @dev Call this method from ServiceProvider * * @param _agent - address of contract that implement Agent role * @param _serviceTariffIndexes - array of index in `availableTariffs` array * that available for given `_agent` * @return full array of actual tarifs for this agent */ function authorizeAgentForService( address _agent, uint256[] calldata _serviceTariffIndexes ) external returns (uint256[] memory); /** * @notice By Ticket for subscription * @dev Call this method from Agent * * @param _service - Service Provider address * @param _tariffIndex - index in `availableTariffs` array * @param _payWithIndex - index in `tariff.payWith` array * @param _buyFor - address for whome this ticket would be bought * @param _payer - address of payer for this ticket * @return ticket structure that would be use for validate service process */ function buySubscription( address _service, uint256 _tariffIndex, uint256 _payWithIndex, address _buyFor, address _payer ) external payable returns(Ticket memory ticket); /** * @notice Edit tariff for caller * @dev Call this method from ServiceProvider * for setup new tariff * using `Tariff` data type(please see above) * * @param _tariffIndex - index in `availableTariffs` array * @param _timelockPeriod - see SubscriptionType notice above * @param _ticketValidPeriod - see SubscriptionType notice above * @param _counter - see SubscriptionType notice above * @param _isAvailable - see SubscriptionType notice above * @param _beneficiary - see SubscriptionType notice above */ function editServiceTariff( uint256 _tariffIndex, uint256 _timelockPeriod, uint256 _ticketValidPeriod, uint256 _counter, bool _isAvailable, address _beneficiary ) external; /** * @notice Add tariff PayOption for exact service * @dev Call this method from ServiceProvider * for add tariff PayOption * * @param _tariffIndex - index in `availableTariffs` array * @param _paymentToken - see PayOption notice above * @param _paymentAmount - see PayOption notice above * @param _agentFeePercent - see PayOption notice above * @return last added PaymentOption index in array * for _tariffIndex Tariff of caller Service Provider (msg.sender) */ function addTariffPayOption( uint256 _tariffIndex, address _paymentToken, uint256 _paymentAmount, uint16 _agentFeePercent ) external returns(uint256); /** * @notice Edit tariff PayOption for exact service * @dev Call this method from ServiceProvider * for edit tariff PayOption * * @param _tariffIndex - index in `availableTariffs` array * @param _payWithIndex - index in `tariff.payWith` array * @param _paymentToken - see PayOption notice above * @param _paymentAmount - see PayOption notice above * @param _agentFeePercent - see PayOption notice above * for _tariffIndex Tariff of caller Service Provider (msg.sender) */ function editTariffPayOption( uint256 _tariffIndex, uint256 _payWithIndex, address _paymentToken, uint256 _paymentAmount, uint16 _agentFeePercent ) external; /** * @notice Check that `_user` have still valid ticket for this service. * @dev Call this method from any context * * @param _user - address of user who has an ticket and who trying get service * @param _service - address of Service Provider * @return ok True in case ticket is valid * @return needFix True in case ticket has counter > 0 */ function checkUserSubscription( address _user, address _service ) external view returns (bool ok, bool needFix); /** * @notice Check that `_user` have still valid ticket for this service. * Decrement ticket counter in case it > 0 * @dev Call this method from ServiceProvider * * @param _user - address of user who has an ticket and who trying get service * @return ok True in case ticket is valid */ function checkAndFixUserSubscription(address _user) external returns (bool ok); /** * @notice Decrement ticket counter in case it > 0 * @dev Call this method from new SubscriptionRegistry in case of upgrade * * @param _user - address of user who has an ticket and who trying get service * @param _serviceFromProxy - address of service from more new SubscriptionRegistry contract */ function fixUserSubscription(address _user, address _serviceFromProxy) external; /** * @notice Returns `_user` ticket for this service. * @dev Call this method from any context * * @param _user - address of user who has an ticket and who trying get service * @param _service - address of Service Provider * @return ticket */ function getUserTicketForService( address _service, address _user ) external view returns(Ticket memory); /** * @notice Returns array of Tariff for `_service` * @dev Call this method from any context * * @param _service - address of Service Provider * @return Tariff array */ function getTariffsForService(address _service) external view returns (Tariff[] memory); /** * @notice Returns ticket price include any fees * @dev Call this method from any context * * @param _service - address of Service Provider * @param _tariffIndex - index in `availableTariffs` array * @param _payWithIndex - index in `tariff.payWith` array * @return tulpe with payment token an ticket price */ function getTicketPrice( address _service, uint256 _tariffIndex, uint256 _payWithIndex ) external view returns (address, uint256); /** * @notice Returns array of Tariff for `_service` assigned to `_agent` * @dev Call this method from any context * * @param _agent - address of Agent * @param _service - address of Service Provider * @return Tariff array */ function getAvailableAgentsTariffForService( address _agent, address _service ) external view returns(Tariff[] memory); }
{ "evmVersion": "istanbul", "optimizer": { "enabled": true, "runs": 200 }, "libraries": { "SubscriptionRegistry.sol": {} }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
[{"inputs":[{"internalType":"address","name":"_platformOwner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint16","name":"newPercent","type":"uint16"}],"name":"PlatfromFeeChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"service","type":"address"},{"indexed":true,"internalType":"uint256","name":"tariffIndex","type":"uint256"}],"name":"TariffChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"service","type":"address"},{"indexed":true,"internalType":"address","name":"agent","type":"address"},{"indexed":true,"internalType":"address","name":"forUser","type":"address"},{"indexed":false,"internalType":"uint256","name":"tariffIndex","type":"uint256"}],"name":"TicketIssued","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"asset","type":"address"},{"indexed":true,"internalType":"bool","name":"state","type":"bool"}],"name":"WhitelistPaymentTokenChanged","type":"event"},{"inputs":[],"name":"PERCENT_DENOMINATOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tariffIndex","type":"uint256"},{"internalType":"address","name":"_paymentToken","type":"address"},{"internalType":"uint256","name":"_paymentAmount","type":"uint256"},{"internalType":"uint16","name":"_agentFeePercent","type":"uint16"}],"name":"addTariffPayOption","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"agentServiceRegistry","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_agent","type":"address"},{"internalType":"uint256[]","name":"_serviceTariffIndexes","type":"uint256[]"}],"name":"authorizeAgentForService","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"availableTariffs","outputs":[{"components":[{"internalType":"uint256","name":"timelockPeriod","type":"uint256"},{"internalType":"uint256","name":"ticketValidPeriod","type":"uint256"},{"internalType":"uint256","name":"counter","type":"uint256"},{"internalType":"bool","name":"isAvailable","type":"bool"},{"internalType":"address","name":"beneficiary","type":"address"}],"internalType":"struct SubscriptionType","name":"subscription","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_service","type":"address"},{"internalType":"uint256","name":"_tariffIndex","type":"uint256"},{"internalType":"uint256","name":"_payWithIndex","type":"uint256"},{"internalType":"address","name":"_buyFor","type":"address"},{"internalType":"address","name":"_payer","type":"address"}],"name":"buySubscription","outputs":[{"components":[{"internalType":"uint256","name":"validUntil","type":"uint256"},{"internalType":"uint256","name":"countsLeft","type":"uint256"}],"internalType":"struct Ticket","name":"ticket","type":"tuple"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"checkAndFixUserSubscription","outputs":[{"internalType":"bool","name":"ok","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"address","name":"_service","type":"address"}],"name":"checkUserSubscription","outputs":[{"internalType":"bool","name":"ok","type":"bool"},{"internalType":"bool","name":"needFix","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tariffIndex","type":"uint256"},{"internalType":"uint256","name":"_timelockPeriod","type":"uint256"},{"internalType":"uint256","name":"_ticketValidPeriod","type":"uint256"},{"internalType":"uint256","name":"_counter","type":"uint256"},{"internalType":"bool","name":"_isAvailable","type":"bool"},{"internalType":"address","name":"_beneficiary","type":"address"}],"name":"editServiceTariff","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tariffIndex","type":"uint256"},{"internalType":"uint256","name":"_payWithIndex","type":"uint256"},{"internalType":"address","name":"_paymentToken","type":"address"},{"internalType":"uint256","name":"_paymentAmount","type":"uint256"},{"internalType":"uint16","name":"_agentFeePercent","type":"uint16"}],"name":"editTariffPayOption","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"address","name":"_serviceFromProxy","type":"address"}],"name":"fixUserSubscription","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_agent","type":"address"},{"internalType":"address","name":"_service","type":"address"}],"name":"getAvailableAgentsTariffForService","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"},{"components":[{"components":[{"internalType":"uint256","name":"timelockPeriod","type":"uint256"},{"internalType":"uint256","name":"ticketValidPeriod","type":"uint256"},{"internalType":"uint256","name":"counter","type":"uint256"},{"internalType":"bool","name":"isAvailable","type":"bool"},{"internalType":"address","name":"beneficiary","type":"address"}],"internalType":"struct SubscriptionType","name":"subscription","type":"tuple"},{"components":[{"internalType":"address","name":"paymentToken","type":"address"},{"internalType":"uint256","name":"paymentAmount","type":"uint256"},{"internalType":"uint16","name":"agentFeePercent","type":"uint16"}],"internalType":"struct PayOption[]","name":"payWith","type":"tuple[]"}],"internalType":"struct Tariff[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_service","type":"address"}],"name":"getTariffsForService","outputs":[{"components":[{"components":[{"internalType":"uint256","name":"timelockPeriod","type":"uint256"},{"internalType":"uint256","name":"ticketValidPeriod","type":"uint256"},{"internalType":"uint256","name":"counter","type":"uint256"},{"internalType":"bool","name":"isAvailable","type":"bool"},{"internalType":"address","name":"beneficiary","type":"address"}],"internalType":"struct SubscriptionType","name":"subscription","type":"tuple"},{"components":[{"internalType":"address","name":"paymentToken","type":"address"},{"internalType":"uint256","name":"paymentAmount","type":"uint256"},{"internalType":"uint16","name":"agentFeePercent","type":"uint16"}],"internalType":"struct PayOption[]","name":"payWith","type":"tuple[]"}],"internalType":"struct Tariff[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_service","type":"address"},{"internalType":"uint256","name":"_tariffIndex","type":"uint256"},{"internalType":"uint256","name":"_payWithIndex","type":"uint256"}],"name":"getTicketPrice","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_service","type":"address"},{"internalType":"address","name":"_user","type":"address"}],"name":"getUserTicketForService","outputs":[{"components":[{"internalType":"uint256","name":"validUntil","type":"uint256"},{"internalType":"uint256","name":"countsLeft","type":"uint256"}],"internalType":"struct Ticket","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mainWrapper","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"platformFeePercent","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"platformOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"previousRegistry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxyRegistry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"uint256","name":"timelockPeriod","type":"uint256"},{"internalType":"uint256","name":"ticketValidPeriod","type":"uint256"},{"internalType":"uint256","name":"counter","type":"uint256"},{"internalType":"bool","name":"isAvailable","type":"bool"},{"internalType":"address","name":"beneficiary","type":"address"}],"internalType":"struct SubscriptionType","name":"subscription","type":"tuple"},{"components":[{"internalType":"address","name":"paymentToken","type":"address"},{"internalType":"uint256","name":"paymentAmount","type":"uint256"},{"internalType":"uint16","name":"agentFeePercent","type":"uint16"}],"internalType":"struct PayOption[]","name":"payWith","type":"tuple[]"}],"internalType":"struct Tariff","name":"_newTariff","type":"tuple"}],"name":"registerServiceTariff","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"},{"internalType":"bool","name":"_isEnable","type":"bool"}],"name":"setAssetForPaymentState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_wrapper","type":"address"}],"name":"setMainWrapper","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_newPercent","type":"uint16"}],"name":"setPlatformFeePercent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"setPlatformOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_registry","type":"address"}],"name":"setPreviousRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_registry","type":"address"}],"name":"setProxyRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"userTickets","outputs":[{"internalType":"uint256","name":"validUntil","type":"uint256"},{"internalType":"uint256","name":"countsLeft","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whiteListedForPayments","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60806040526001805461ffff60a01b1916601960a11b1790553480156200002557600080fd5b50604051620042f2380380620042f2833981016040819052620000489162000124565b6200005333620000d4565b6001600160a01b038116620000ae5760405162461bcd60e51b815260206004820152601a60248201527f5a65726f20706c6174666f726d20666565207265636569766572000000000000604482015260640160405180910390fd5b600180546001600160a01b0319166001600160a01b039290921691909117905562000156565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156200013757600080fd5b81516001600160a01b03811681146200014f57600080fd5b9392505050565b61418c80620001666000396000f3fe6080604052600436106101e35760003560e01c80638c639a8511610102578063adfdeef911610095578063c7ac5c1c11610064578063c7ac5c1c146106a3578063c889c5f4146106d0578063da6310ad146106f0578063f2fde38b1461071057600080fd5b8063adfdeef9146105b8578063afc9abd1146105d8578063b0a587fc14610617578063b50cbd9f1461068357600080fd5b806396c0c3d6116100d157806396c0c3d6146105355780639aab9481146105555780639e6c295914610575578063a3fafd051461058b57600080fd5b80638c639a851461048b5780638da5cb5b146104c05780639204ab26146104de57806392daa23a146104fe57600080fd5b806354daabc31161017a57806378451d001161014957806378451d00146103b95780637fc4e753146103e75780638a196c56146104175780638a56a0401461043757600080fd5b806354daabc314610344578063650aac6114610364578063685538df14610384578063715018a6146103a457600080fd5b80631f16aef3116101b65780631f16aef3146102b25780632c27b0fa146102d45780632e5f2cf1146102f45780634df8ccb11461032457600080fd5b80630e66e9da146101e8578063110223801461021e578063160dbe18146102565780631d70028b14610284575b600080fd5b3480156101f457600080fd5b506102086102033660046134cf565b610730565b6040516102159190613533565b60405180910390f35b34801561022a57600080fd5b5060035461023e906001600160a01b031681565b6040516001600160a01b039091168152602001610215565b34801561026257600080fd5b50610276610271366004613541565b6107ae565b604051610215929190613676565b6102976102923660046136a4565b610bea565b60408051825181526020928301519281019290925201610215565b3480156102be57600080fd5b506102d26102cd366004613711565b610f5f565b005b3480156102e057600080fd5b506102d26102ef366004613541565b610f76565b34801561030057600080fd5b5061031461030f36600461376f565b610ff4565b6040519015158152602001610215565b34801561033057600080fd5b5060015461023e906001600160a01b031681565b34801561035057600080fd5b506102d261035f36600461376f565b611173565b34801561037057600080fd5b506102d261037f36600461379c565b61123b565b34801561039057600080fd5b506102d261039f3660046137e4565b611250565b3480156103b057600080fd5b506102d26112f1565b3480156103c557600080fd5b506103d96103d4366004613801565b611305565b604051908152602001610215565b3480156103f357600080fd5b5061031461040236600461376f565b60056020526000908152604090205460ff1681565b34801561042357600080fd5b506103d961043236600461383c565b611317565b34801561044357600080fd5b50610476610452366004613541565b60086020908152600092835260408084209091529082529020805460019091015482565b60408051928352602083019190915201610215565b34801561049757600080fd5b506001546104ad90600160a01b900461ffff1681565b60405161ffff9091168152602001610215565b3480156104cc57600080fd5b506000546001600160a01b031661023e565b3480156104ea57600080fd5b506102d26104f936600461387d565b611355565b34801561050a57600080fd5b5061051e610519366004613541565b6113b1565b604080519215158352901515602083015201610215565b34801561054157600080fd5b506102d261055036600461376f565b611460565b34801561056157600080fd5b506103d96105703660046138ab565b61148a565b34801561058157600080fd5b506103d961271081565b34801561059757600080fd5b506105ab6105a63660046138f5565b6114a4565b604051610215919061397d565b3480156105c457600080fd5b506102d26105d336600461376f565b6115f3565b3480156105e457600080fd5b506105f86105f3366004613990565b61161d565b604080516001600160a01b039093168352602083019190915201610215565b34801561062357600080fd5b50610297610632366004613541565b604080518082018252600080825260209182018190526001600160a01b0393841681526008825282812094909316835292835290819020815180830190925280548252600101549181019190915290565b34801561068f57600080fd5b5060045461023e906001600160a01b031681565b3480156106af57600080fd5b506106c36106be36600461376f565b61197b565b60405161021591906139c5565b3480156106dc57600080fd5b5060025461023e906001600160a01b031681565b3480156106fc57600080fd5b506102d261070b36600461376f565b611ab5565b34801561071c57600080fd5b506102d261072b36600461376f565b611adf565b6006602052816000526040600020818154811061074c57600080fd5b60009182526020918290206040805160a08101825260059093029091018054835260018101549383019390935260028301549082015260039091015460ff8116151560608301526001600160a01b036101009091041660808201529150829050565b6060806000805b6001600160a01b038086166000908152600760209081526040808320938a1683529290522054811015610875576001600160a01b03808616600090815260066020908152604080832060078352818420948b168452939091529020805483908110610822576108226139d8565b90600052602060002001548154811061083d5761083d6139d8565b600091825260209091206003600590920201015460ff16156108655761086282613a04565b91505b61086e81613a04565b90506107b5565b5060008167ffffffffffffffff81111561089157610891613a1d565b6040519080825280602002602001820160405280156108fc57816020015b6040805160e081018252600091810182815260608083018490526080830184905260a0830184905260c0830193909352815260208101919091528152602001906001900390816108af5790505b50905060008267ffffffffffffffff81111561091a5761091a613a1d565b604051908082528060200260200182016040528015610943578160200160208202803683370190505b50905060005b6001600160a01b038088166000908152600760209081526040808320938c1683529290522054811015610bdc576001600160a01b03808816600090815260066020908152604080832060078352818420948d1684529390915290208054839081106109b6576109b66139d8565b9060005260206000200154815481106109d1576109d16139d8565b600091825260209091206003600590920201015460ff1615610bcc576001600160a01b03808816600090815260066020908152604080832060078352818420948d168452939091529020805483908110610a2d57610a2d6139d8565b906000526020600020015481548110610a4857610a486139d8565b600091825260208083206040805160e081018252600590940290910180548483019081526001820154606086015260028201546080860152600382015460ff8116151560a08701526001600160a01b036101009091041660c0860152845260048101805483518186028101860190945280845294959194868501949192909184015b82821015610b23576000848152602090819020604080516060810182526003860290920180546001600160a01b031683526001808201548486015260029091015461ffff16918301919091529083529092019101610aca565b505050915250849050610b37600187613a33565b81518110610b4757610b476139d8565b6020908102919091018101919091526001600160a01b038089166000908152600783526040808220928c168252919092529020805482908110610b8c57610b8c6139d8565b906000526020600020015482600186610ba59190613a33565b81518110610bb557610bb56139d8565b6020908102919091010152610bc984613a46565b93505b610bd581613a04565b9050610949565b5093509150505b9250929050565b60408051808201909152600080825260208201526001600160a01b038316610c595760405162461bcd60e51b815260206004820152601a60248201527f43616e7420627579207469636b657420666f72206e6f626f647900000000000060448201526064015b60405180910390fd5b6001600160a01b0386166000908152600660205260409020805486908110610c8357610c836139d8565b600091825260209091206003600590920201015460ff16610ce65760405162461bcd60e51b815260206004820152601f60248201527f5468697320737562736372697074696f6e206e6f7420617661696c61626c65006044820152606401610c50565b610cf1338787611b58565b610d525760405162461bcd60e51b815260206004820152602c60248201527f4167656e74206e6f7420617574686f72697a656420666f72207468697320736560448201526b393b34b1b2903a30b934b33360a11b6064820152608401610c50565b600080610d5f8589611bf5565b915091508115610db15760405162461bcd60e51b815260206004820152601d60248201527f4f6e6c79206f6e652076616c6964207469636b65742061742074696d650000006044820152606401610c50565b604051806040016040528042600660008c6001600160a01b03166001600160a01b031681526020019081526020016000208a81548110610df357610df36139d8565b906000526020600020906005020160000160010154610e129190613a5d565b8152602001600660008b6001600160a01b03166001600160a01b031681526020019081526020016000208981548110610e4d57610e4d6139d8565b60009182526020808320600260059093020191909101549092526001600160a01b038089168252600883526040808320918d168352908352808220845181558484015160019091015560069092529081208054929550909189908110610eb557610eb56139d8565b90600052602060002090600502016004018781548110610ed757610ed76139d8565b9060005260206000209060030201600101541115610efd57610efb88888887611c8c565b505b846001600160a01b0316336001600160a01b0316896001600160a01b03167f4c5b2aaff86d44d358f0d51033bdf284f61a2539aaef4c9f8e5926f87bfc72408a604051610f4c91815260200190565b60405180910390a4505095945050505050565b610f6e338787878787876128a1565b505050505050565b6004546001600160a01b031615801590610f9a57506004546001600160a01b031633145b610fe65760405162461bcd60e51b815260206004820152601860248201527f4f6e6c7920666f722066757475726520726567697374727900000000000000006044820152606401610c50565b610ff08282612a50565b5050565b60003381806110038584611bf5565b915091508115801561101f57506003546001600160a01b031615155b1561111d5760035460405163496d511d60e11b81526001600160a01b0387811660048301528581166024830152909116906392daa23a906044016040805180830381865afa158015611075573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110999190613a70565b9092509050811561111d57801561111257600354604051631613d87d60e11b81526001600160a01b038781166004830152858116602483015290911690632c27b0fa90604401600060405180830381600087803b1580156110f957600080fd5b505af115801561110d573d6000803e3d6000fd5b505050505b506001949350505050565b816111635760405162461bcd60e51b815260206004820152601660248201527515985b1a59081d1a58dad95d081b9bdd08199bdd5b9960521b6044820152606401610c50565b8015611112576111128533612a50565b6001546001600160a01b031633146111c35760405162461bcd60e51b815260206004820152601360248201527227b7363c90383630ba3337b9369037bbb732b960691b6044820152606401610c50565b6001600160a01b0381166112195760405162461bcd60e51b815260206004820152601a60248201527f5a65726f20706c6174666f726d206665652072656365697665720000000000006044820152606401610c50565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b611249338686868686612abe565b5050505050565b6001546001600160a01b031633146112a05760405162461bcd60e51b815260206004820152601360248201527227b7363c90383630ba3337b9369037bbb732b960691b6044820152606401610c50565b6001805461ffff60a01b1916600160a01b61ffff84811682029290921792839055604051920416907f33ccf3986ed7ae2645cf7cf9d7bce92c7486d08774460245047acf492042c70a90600090a250565b6112f9612bea565b6113036000612c44565b565b60006113113383612c94565b92915050565b6007602052826000526040600020602052816000526040600020818154811061133f57600080fd5b9060005260206000200160009250925050505481565b61135d612bea565b6001600160a01b038216600081815260056020526040808220805460ff191685151590811790915590519092917f7644f0910f082692ff3f55d179775d81aec2399b3a256c31f79ac5431f7d6e6991a35050565b6000806113be8484611bf5565b9092509050811580156113db57506003546001600160a01b031615155b15610be35760035460405163496d511d60e11b81526001600160a01b0386811660048301528581166024830152909116906392daa23a906044016040805180830381865afa158015611431573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114559190613a70565b909590945092505050565b611468612bea565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b60006114993386868686612e91565b90505b949350505050565b3360009081526007602090815260408083206001600160a01b038716845290915281206060916114d49190613488565b3360009081526007602090815260408083206001600160a01b03881684529091528120905b8381101561159b57336000908152600660205260409020858583818110611522576115226139d8565b9050602002013581548110611539576115396139d8565b600091825260209091206003600590920201015460ff161561158b5781858583818110611568576115686139d8565b835460018101855560009485526020948590209190940292909201359190920155505b61159481613a04565b90506114f9565b508054604080516020808402820181019092528281529183918301828280156115e357602002820191906000526020600020905b8154815260200190600101908083116115cf575b50505050509150505b9392505050565b6115fb612bea565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316600090815260066020526040812080548291908590811061164a5761164a6139d8565b60009182526020909120600590910201541561172b576001600160a01b038516600090815260066020526040902080548590811061168a5761168a6139d8565b906000526020600020906005020160040183815481106116ac576116ac6139d8565b600091825260208083206003909202909101546001600160a01b038881168452600690925260409092208054919092169190869081106116ee576116ee6139d8565b90600052602060002090600502016004018481548110611710576117106139d8565b90600052602060002090600302016001015491509150611973565b6001600160a01b0385166000908152600660205260409020805485908110611755576117556139d8565b90600052602060002090600502016004018381548110611777576117776139d8565b60009182526020909120600390910201546001600160a01b03166127106117ab87600154600160a01b900461ffff16919050565b6001600160a01b03881660009081526006602052604090208054889081106117d5576117d56139d8565b906000526020600020906005020160040186815481106117f7576117f76139d8565b9060005260206000209060030201600101546118139190613a9f565b61181d9190613ab6565b6001600160a01b0387166000908152600660205260409020805461271091908890811061184c5761184c6139d8565b9060005260206000209060050201600401868154811061186e5761186e6139d8565b60009182526020808320600260039093020191909101546001600160a01b038b16835260069091526040909120805461ffff90921691899081106118b4576118b46139d8565b906000526020600020906005020160040187815481106118d6576118d66139d8565b9060005260206000209060030201600101546118f29190613a9f565b6118fc9190613ab6565b6001600160a01b0388166000908152600660205260409020805488908110611926576119266139d8565b90600052602060002090600502016004018681548110611948576119486139d8565b9060005260206000209060030201600101546119649190613a5d565b61196e9190613a5d565b915091505b935093915050565b6001600160a01b0381166000908152600660209081526040808320805482518185028101850190935280835260609492939192909184015b82821015611aaa57600084815260208082206040805160e0810182526005870290920180548383019081526001820154606085015260028201546080850152600382015460ff8116151560a086015261010090046001600160a01b031660c08501528352600481018054835181870281018701909452808452939591948681019491929084015b82821015611a93576000848152602090819020604080516060810182526003860290920180546001600160a01b031683526001808201548486015260029091015461ffff16918301919091529083529092019101611a3a565b5050505081525050815260200190600101906119b3565b505050509050919050565b611abd612bea565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b611ae7612bea565b6001600160a01b038116611b4c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610c50565b611b5581612c44565b50565b6000805b6001600160a01b03808516600090815260076020908152604080832093891683529290522054811015611bed576001600160a01b038085166000908152600760209081526040808320938916835292905220805484919083908110611bc357611bc36139d8565b906000526020600020015403611bdd5760019150506115ec565b611be681613a04565b9050611b5c565b509392505050565b6001600160a01b0380831660009081526008602090815260408083209385168352929052908120548190421080611c5357506001600160a01b0380851660009081526008602090815260408083209387168352929052206001015415155b6001600160a01b039485166000908152600860209081526040808320969097168252949094529390922060010154929392151592915050565b6001600160a01b0384166000908152600660205260408120805485908110611cb657611cb66139d8565b6000918252602090912060059091020154156122aa573415611cea5760405162461bcd60e51b8152600401610c5090613ad8565b611dd3823060066000896001600160a01b03166001600160a01b031681526020019081526020016000208781548110611d2557611d256139d8565b90600052602060002090600502016004018681548110611d4757611d476139d8565b906000526020600020906003020160010154600660008a6001600160a01b03166001600160a01b031681526020019081526020016000208881548110611d8f57611d8f6139d8565b90600052602060002090600502016004018781548110611db157611db16139d8565b60009182526020909120600390910201546001600160a01b0316929190612fef565b6002546001600160a01b0386811660009081526006602052604090208054611eb793929092169187908110611e0a57611e0a6139d8565b90600052602060002090600502016004018581548110611e2c57611e2c6139d8565b90600052602060002090600302016001015460066000896001600160a01b03166001600160a01b031681526020019081526020016000208781548110611e7457611e746139d8565b90600052602060002090600502016004018681548110611e9657611e966139d8565b60009182526020909120600390910201546001600160a01b03169190613060565b604080516101a081018252600061016082018181526101808301829052610100830190815261012083018290526101408301829052825260208083018290526060838501819052808401819052608084015260a0830182905260c0830182905260e083018290528351600180825281860190955292939192919082015b6040805160a0810182526000606082018181526080830182905282526020808301829052928201528252600019909201910181611f3457505060408051600180825281830190925291925060009190602082015b6040805180820190915260008082526020820152815260200190600190039081611f8857505060408051808201825260008082526001600160a01b038c1681526006602090815292902080549394509092918301914291908b908110611ff057611ff06139d8565b600091825260209091206005909102015461200b9190613a5d565b81525081600081518110612021576120216139d8565b602090810291909101810191909152604080516101a081018252600061016082018181526101808301829052610100830190815261012083018290526101408301829052825281840181905282518181529384018352909291830191906120b0565b60408051606081018252600080825260208083018290529282015282526000199092019101816120835790505b50815260208082018490526040805160008082529281018252920191906120f9565b60408051808201909152600080825260208201528152602001906001900390816120d25790505b50815260200160038152600060208201819052604091820152805160a0810190915290935080606081018060028152602001600660008d6001600160a01b03166001600160a01b031681526020019081526020016000208b81548110612161576121616139d8565b90600052602060002090600502016004018a81548110612183576121836139d8565b600091825260208083206003909202909101546001600160a01b03908116909352928452838301819052908c168152600690915260409081902080549190920191908a9081106121d5576121d56139d8565b906000526020600020906005020160040188815481106121f7576121f76139d8565b9060005260206000209060030201600101548152508260008151811061221f5761221f6139d8565b6020908102919091010152600254604051634d36d08560e01b81526001600160a01b0390911690634d36d0859061225e90869086908a90600401613c91565b6080604051808303816000875af115801561227d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122a19190613da4565b5050505061149c565b6001600160a01b03851660009081526006602052604081208054869081106122d4576122d46139d8565b906000526020600020906005020160040184815481106122f6576122f66139d8565b60009182526020909120600390910201546001600160a01b0316146125c45734156123335760405162461bcd60e51b8152600401610c5090613ad8565b6001600160a01b038516600090815260066020526040902080546123c191849187908110612363576123636139d8565b906000526020600020906005020160000160030160019054906101000a90046001600160a01b031660066000896001600160a01b03166001600160a01b031681526020019081526020016000208781548110611d2557611d256139d8565b6124d98233612710600660008a6001600160a01b03166001600160a01b0316815260200190815260200160002088815481106123ff576123ff6139d8565b90600052602060002090600502016004018781548110612421576124216139d8565b60009182526020808320600260039093020191909101546001600160a01b038c16835260069091526040909120805461ffff909216918a908110612467576124676139d8565b90600052602060002090600502016004018881548110612489576124896139d8565b9060005260206000209060030201600101546124a59190613a9f565b6124af9190613ab6565b6001600160a01b0389166000908152600660205260409020805489908110611d8f57611d8f6139d8565b600154600160a01b900461ffff1680156125be576001546001600160a01b03878116600090815260066020526040902080546125be9387931691612710918691908b90811061252a5761252a6139d8565b9060005260206000209060050201600401898154811061254c5761254c6139d8565b9060005260206000209060030201600101546125689190613a9f565b6125729190613ab6565b6001600160a01b038a16600090815260066020526040902080548a90811061259c5761259c6139d8565b90600052602060002090600502016004018881548110611db157611db16139d8565b5061149c565b60006125d186868661161d565b915050803410156126175760405162461bcd60e51b815260206004820152601060248201526f2737ba1032b737bab3b41032ba3432b960811b6044820152606401610c50565b6001600160a01b038616600090815260066020526040902080546126dd919087908110612646576126466139d8565b906000526020600020906005020160000160030160019054906101000a90046001600160a01b031660066000896001600160a01b03166001600160a01b0316815260200190815260200160002087815481106126a4576126a46139d8565b906000526020600020906005020160040186815481106126c6576126c66139d8565b90600052602060002090600302016001015461317a565b6127cf33612710600660008a6001600160a01b03166001600160a01b03168152602001908152602001600020888154811061271a5761271a6139d8565b9060005260206000209060050201600401878154811061273c5761273c6139d8565b60009182526020808320600260039093020191909101546001600160a01b038c16835260069091526040909120805461ffff909216918a908110612782576127826139d8565b906000526020600020906005020160040188815481106127a4576127a46139d8565b9060005260206000209060030201600101546127c09190613a9f565b6127ca9190613ab6565b61317a565b600154600160a01b900461ffff168015612842576001546001600160a01b03888116600090815260066020526040902080546128429392909216916127109185918b908110612820576128206139d8565b906000526020600020906005020160040189815481106127a4576127a46139d8565b600061284e8334613a33565b111561289757836001600160a01b0381166108fc61286c8534613a33565b6040518115909202916000818181858888f19350505050158015612894573d6000803e3d6000fd5b50505b5050949350505050565b6001600160a01b03871660009081526006602052604090208054869190889081106128ce576128ce6139d8565b600091825260208083206005909202909101929092556001600160a01b038916815260069091526040902080548591908890811061290e5761290e6139d8565b9060005260206000209060050201600001600101819055508260066000896001600160a01b03166001600160a01b03168152602001908152602001600020878154811061295d5761295d6139d8565b9060005260206000209060050201600001600201819055508160066000896001600160a01b03166001600160a01b0316815260200190815260200160002087815481106129ac576129ac6139d8565b60009182526020808320600592909202909101600301805460ff1916931515939093179092556001600160a01b03891681526006909152604090208054829190889081106129fc576129fc6139d8565b600091825260208220600591909102016003018054610100600160a81b0319166101006001600160a01b039485160217905560405188928a169160008051602061413783398151915291a350505050505050565b6001600160a01b0380831660009081526008602090815260408083209385168352929052206001015415610ff0576001600160a01b03808316600090815260086020908152604080832093851683529290529081206001018054909190612ab690613a46565b909155505050565b6001600160a01b03831660009081526005602052604090205460ff16612af65760405162461bcd60e51b8152600401610c5090613e3d565b6040518060600160405280846001600160a01b031681526020018381526020018261ffff1681525060066000886001600160a01b03166001600160a01b031681526020019081526020016000208681548110612b5457612b546139d8565b90600052602060002090600502016004018581548110612b7657612b766139d8565b6000918252602080832084516003939093020180546001600160a01b0319166001600160a01b039384161781559084015160018201556040938401516002909101805461ffff191661ffff9092169190911790559151879289169160008051602061413783398151915291a3505050505050565b6000546001600160a01b031633146113035760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610c50565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080612ca460a0840184613e74565b905011612ce75760405162461bcd60e51b8152602060048201526011602482015270139bc81c185e5b595b9d081b595d1a1bd9607a1b6044820152606401610c50565b60005b612cf760a0840184613e74565b9050811015612d805760056000612d1160a0860186613e74565b84818110612d2157612d216139d8565b612d37926020606090920201908101915061376f565b6001600160a01b0316815260208101919091526040016000205460ff16612d705760405162461bcd60e51b8152600401610c5090613e3d565b612d7981613a04565b9050612cea565b506020820135151580612d965750604082013515155b612dec5760405162461bcd60e51b815260206004820152602160248201527f54617269666620686173206e6f2076616c6964207469636b6574206f7074696f6044820152603760f91b6064820152608401610c50565b6001600160a01b0383166000908152600660209081526040822080546001810182559083529120839160050201612e238282613fd2565b50506001600160a01b038316600090815260066020526040902054612e4a90600190613a33565b6040516001600160a01b0385169060008051602061413783398151915290600090a36001600160a01b0383166000908152600660205260409020546115ec90600190613a33565b6001600160a01b03831660009081526005602052604081205460ff16612ec95760405162461bcd60e51b8152600401610c5090613e3d565b6001600160a01b0386166000908152600660205260409020805486908110612ef357612ef36139d8565b60009182526020808320604080516060810182526001600160a01b038a811682528185018a815261ffff8a8116848601908152600598909802909501600401805460018082018355918a529689209351600390970290930180546001600160a01b031916968316969096178655519185019190915593516002909301805461ffff1916939092169290921790555187929189169160008051602061413783398151915291a36001600160a01b038616600090815260066020526040902080546001919087908110612fc657612fc66139d8565b906000526020600020906005020160040180549050612fe59190613a33565b9695505050505050565b6040516001600160a01b038085166024830152831660448201526064810182905261305a9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152613293565b50505050565b8015806130da5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa1580156130b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130d8919061408d565b155b6131455760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610c50565b6040516001600160a01b03831660248201526044810182905261317590849063095ea7b360e01b90606401613023565b505050565b804710156131ca5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610c50565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114613217576040519150601f19603f3d011682016040523d82523d6000602084013e61321c565b606091505b50509050806131755760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610c50565b60006132e8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166133659092919063ffffffff16565b805190915015613175578080602001905181019061330691906140a6565b6131755760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610c50565b606061149c848460008585600080866001600160a01b0316858760405161338c91906140e7565b60006040518083038185875af1925050503d80600081146133c9576040519150601f19603f3d011682016040523d82523d6000602084013e6133ce565b606091505b50915091506133df878383876133ea565b979650505050505050565b60608315613459578251600003613452576001600160a01b0385163b6134525760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610c50565b508161149c565b61149c838381511561346e5781518083602001fd5b8060405162461bcd60e51b8152600401610c509190614103565b5080546000825590600052602060002090810190611b5591905b808211156134b657600081556001016134a2565b5090565b6001600160a01b0381168114611b5557600080fd5b600080604083850312156134e257600080fd5b82356134ed816134ba565b946020939093013593505050565b8051825260208082015190830152604080820151908301526060808201511515908301526080908101516001600160a01b0316910152565b60a0810161131182846134fb565b6000806040838503121561355457600080fd5b823561355f816134ba565b9150602083013561356f816134ba565b809150509250929050565b600081518084526020808501945080840160005b838110156135aa5781518752958201959082019060010161358e565b509495945050505050565b600081518084526020808501808196508360051b810191508286016000805b86811015613668578385038a52825160c08087016135f38884516134fb565b9188015160a088019190915280519182905287019060e087019084905b8082101561365357835180516001600160a01b031684528a8101518b85015260409081015161ffff16908401529289019260609092019160019190910190613610565b50509a87019a955050918501916001016135d4565b509298975050505050505050565b604081526000613689604083018561357a565b828103602084015261369b81856135b5565b95945050505050565b600080600080600060a086880312156136bc57600080fd5b85356136c7816134ba565b9450602086013593506040860135925060608601356136e5816134ba565b915060808601356136f5816134ba565b809150509295509295909350565b8015158114611b5557600080fd5b60008060008060008060c0878903121561372a57600080fd5b86359550602087013594506040870135935060608701359250608087013561375181613703565b915060a0870135613761816134ba565b809150509295509295509295565b60006020828403121561378157600080fd5b81356115ec816134ba565b61ffff81168114611b5557600080fd5b600080600080600060a086880312156137b457600080fd5b853594506020860135935060408601356137cd816134ba565b92506060860135915060808601356136f58161378c565b6000602082840312156137f657600080fd5b81356115ec8161378c565b60006020828403121561381357600080fd5b813567ffffffffffffffff81111561382a57600080fd5b820160c081850312156115ec57600080fd5b60008060006060848603121561385157600080fd5b833561385c816134ba565b9250602084013561386c816134ba565b929592945050506040919091013590565b6000806040838503121561389057600080fd5b823561389b816134ba565b9150602083013561356f81613703565b600080600080608085870312156138c157600080fd5b8435935060208501356138d3816134ba565b92506040850135915060608501356138ea8161378c565b939692955090935050565b60008060006040848603121561390a57600080fd5b8335613915816134ba565b9250602084013567ffffffffffffffff8082111561393257600080fd5b818601915086601f83011261394657600080fd5b81358181111561395557600080fd5b8760208260051b850101111561396a57600080fd5b6020830194508093505050509250925092565b6020815260006115ec602083018461357a565b6000806000606084860312156139a557600080fd5b83356139b0816134ba565b95602085013595506040909401359392505050565b6020815260006115ec60208301846135b5565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201613a1657613a166139ee565b5060010190565b634e487b7160e01b600052604160045260246000fd5b81810381811115611311576113116139ee565b600081613a5557613a556139ee565b506000190190565b80820180821115611311576113116139ee565b60008060408385031215613a8357600080fd5b8251613a8e81613703565b602084015190925061356f81613703565b8082028115828204841417611311576113116139ee565b600082613ad357634e487b7160e01b600052601260045260246000fd5b500490565b60208082526021908201527f4574686572204e6f7420616363657074656420696e2074686973206d6574686f6040820152601960fa1b606082015260800190565b60088110613b3757634e487b7160e01b600052602160045260246000fd5b9052565b8051613b48838251613b19565b6020908101516001600160a01b0316838201528101516040808401919091520151606090910152565b600081518084526020808501945080840160005b838110156135aa57815180516001600160f81b031916885283810151848901526040908101516001600160a01b03169088015260609096019590820190600101613b85565b600081518084526020808501945080840160005b838110156135aa57815180516001600160f81b03191688528301518388015260409096019590820190600101613bde565b600081518084526020808501945080840160005b838110156135aa57815180516001600160a01b0316885283015161ffff168388015260409096019590820190600101613c23565b600081518084526020808501945080840160005b838110156135aa57613c7e878351613b3b565b6080969096019590820190600101613c6b565b60608152613ca3606082018551613b3b565b60006020850151613cbf60e08401826001600160a01b03169052565b50604085015161016080610100850152613cdd6101c0850183613b71565b91506060870151605f198086850301610120870152613cfc8483613bca565b935060808901519150808685030161014087015250613d1b8382613c0f565b92505060a0870151613d2f82860182613b19565b505060c086015161018084015260e08601516001600160f01b0319166101a08401528281036020840152613d638186613c57565b91505061149c60408301846001600160a01b03169052565b6040805190810167ffffffffffffffff81118282101715613d9e57613d9e613a1d565b60405290565b60008183036080811215613db757600080fd5b6040516060810181811067ffffffffffffffff82111715613dda57613dda613a1d565b6040908152821215613deb57600080fd5b613df3613d7b565b9150835160088110613e0457600080fd5b82526020840151613e14816134ba565b806020840152508181526040840151602082015260608401516040820152809250505092915050565b6020808252601c908201527f4e6f742077686974656c697374656420666f72207061796d656e747300000000604082015260600190565b6000808335601e19843603018112613e8b57600080fd5b83018035915067ffffffffffffffff821115613ea657600080fd5b6020019150606081023603821315610be357600080fd5b8135613ec8816134ba565b81546001600160a01b0319166001600160a01b039190911617815560208201356001820155600281016040830135613eff8161378c565b815461ffff191661ffff919091161790555050565b68010000000000000000831115613f2d57613f2d613a1d565b805483825580841015613f9d5760038181028181048314613f5057613f506139ee565b8582028281048714613f6457613f646139ee565b6000858152602081209283019291909101905b82821015613f98578082558060018301558060028301558382019150613f77565b505050505b5060008181526020812083915b85811015610f6e57613fbc8383613ebd565b6060929092019160039190910190600101613faa565b813581556020820135600182015560408201356002820155600381016060830135613ffc81613703565b8154608085013561400c816134ba565b6001600160a81b03199190911691151560ff169190911760089190911b610100600160a81b031617905560a082013536839003601e1901811261404e57600080fd5b8201803567ffffffffffffffff81111561406757600080fd5b60208201915060608102360382131561407f57600080fd5b61305a818360048601613f14565b60006020828403121561409f57600080fd5b5051919050565b6000602082840312156140b857600080fd5b81516115ec81613703565b60005b838110156140de5781810151838201526020016140c6565b50506000910152565b600082516140f98184602087016140c3565b9190910192915050565b60208152600082518060208401526141228160408501602087016140c3565b601f01601f1916919091016040019291505056fe51751d7a3fc2914a9b7dc668bb0fad6b90107c5b347172186c8040c4e4c9f99ba26469706673582212201488c591bd2bea50ccd829a45b28f1c9446f265ae1bdee7661d45e3885dfb3e064736f6c634300081300330000000000000000000000005992fe461f81c8e0affa95b831e50e9b3854ba0e
Deployed Bytecode
0x6080604052600436106101e35760003560e01c80638c639a8511610102578063adfdeef911610095578063c7ac5c1c11610064578063c7ac5c1c146106a3578063c889c5f4146106d0578063da6310ad146106f0578063f2fde38b1461071057600080fd5b8063adfdeef9146105b8578063afc9abd1146105d8578063b0a587fc14610617578063b50cbd9f1461068357600080fd5b806396c0c3d6116100d157806396c0c3d6146105355780639aab9481146105555780639e6c295914610575578063a3fafd051461058b57600080fd5b80638c639a851461048b5780638da5cb5b146104c05780639204ab26146104de57806392daa23a146104fe57600080fd5b806354daabc31161017a57806378451d001161014957806378451d00146103b95780637fc4e753146103e75780638a196c56146104175780638a56a0401461043757600080fd5b806354daabc314610344578063650aac6114610364578063685538df14610384578063715018a6146103a457600080fd5b80631f16aef3116101b65780631f16aef3146102b25780632c27b0fa146102d45780632e5f2cf1146102f45780634df8ccb11461032457600080fd5b80630e66e9da146101e8578063110223801461021e578063160dbe18146102565780631d70028b14610284575b600080fd5b3480156101f457600080fd5b506102086102033660046134cf565b610730565b6040516102159190613533565b60405180910390f35b34801561022a57600080fd5b5060035461023e906001600160a01b031681565b6040516001600160a01b039091168152602001610215565b34801561026257600080fd5b50610276610271366004613541565b6107ae565b604051610215929190613676565b6102976102923660046136a4565b610bea565b60408051825181526020928301519281019290925201610215565b3480156102be57600080fd5b506102d26102cd366004613711565b610f5f565b005b3480156102e057600080fd5b506102d26102ef366004613541565b610f76565b34801561030057600080fd5b5061031461030f36600461376f565b610ff4565b6040519015158152602001610215565b34801561033057600080fd5b5060015461023e906001600160a01b031681565b34801561035057600080fd5b506102d261035f36600461376f565b611173565b34801561037057600080fd5b506102d261037f36600461379c565b61123b565b34801561039057600080fd5b506102d261039f3660046137e4565b611250565b3480156103b057600080fd5b506102d26112f1565b3480156103c557600080fd5b506103d96103d4366004613801565b611305565b604051908152602001610215565b3480156103f357600080fd5b5061031461040236600461376f565b60056020526000908152604090205460ff1681565b34801561042357600080fd5b506103d961043236600461383c565b611317565b34801561044357600080fd5b50610476610452366004613541565b60086020908152600092835260408084209091529082529020805460019091015482565b60408051928352602083019190915201610215565b34801561049757600080fd5b506001546104ad90600160a01b900461ffff1681565b60405161ffff9091168152602001610215565b3480156104cc57600080fd5b506000546001600160a01b031661023e565b3480156104ea57600080fd5b506102d26104f936600461387d565b611355565b34801561050a57600080fd5b5061051e610519366004613541565b6113b1565b604080519215158352901515602083015201610215565b34801561054157600080fd5b506102d261055036600461376f565b611460565b34801561056157600080fd5b506103d96105703660046138ab565b61148a565b34801561058157600080fd5b506103d961271081565b34801561059757600080fd5b506105ab6105a63660046138f5565b6114a4565b604051610215919061397d565b3480156105c457600080fd5b506102d26105d336600461376f565b6115f3565b3480156105e457600080fd5b506105f86105f3366004613990565b61161d565b604080516001600160a01b039093168352602083019190915201610215565b34801561062357600080fd5b50610297610632366004613541565b604080518082018252600080825260209182018190526001600160a01b0393841681526008825282812094909316835292835290819020815180830190925280548252600101549181019190915290565b34801561068f57600080fd5b5060045461023e906001600160a01b031681565b3480156106af57600080fd5b506106c36106be36600461376f565b61197b565b60405161021591906139c5565b3480156106dc57600080fd5b5060025461023e906001600160a01b031681565b3480156106fc57600080fd5b506102d261070b36600461376f565b611ab5565b34801561071c57600080fd5b506102d261072b36600461376f565b611adf565b6006602052816000526040600020818154811061074c57600080fd5b60009182526020918290206040805160a08101825260059093029091018054835260018101549383019390935260028301549082015260039091015460ff8116151560608301526001600160a01b036101009091041660808201529150829050565b6060806000805b6001600160a01b038086166000908152600760209081526040808320938a1683529290522054811015610875576001600160a01b03808616600090815260066020908152604080832060078352818420948b168452939091529020805483908110610822576108226139d8565b90600052602060002001548154811061083d5761083d6139d8565b600091825260209091206003600590920201015460ff16156108655761086282613a04565b91505b61086e81613a04565b90506107b5565b5060008167ffffffffffffffff81111561089157610891613a1d565b6040519080825280602002602001820160405280156108fc57816020015b6040805160e081018252600091810182815260608083018490526080830184905260a0830184905260c0830193909352815260208101919091528152602001906001900390816108af5790505b50905060008267ffffffffffffffff81111561091a5761091a613a1d565b604051908082528060200260200182016040528015610943578160200160208202803683370190505b50905060005b6001600160a01b038088166000908152600760209081526040808320938c1683529290522054811015610bdc576001600160a01b03808816600090815260066020908152604080832060078352818420948d1684529390915290208054839081106109b6576109b66139d8565b9060005260206000200154815481106109d1576109d16139d8565b600091825260209091206003600590920201015460ff1615610bcc576001600160a01b03808816600090815260066020908152604080832060078352818420948d168452939091529020805483908110610a2d57610a2d6139d8565b906000526020600020015481548110610a4857610a486139d8565b600091825260208083206040805160e081018252600590940290910180548483019081526001820154606086015260028201546080860152600382015460ff8116151560a08701526001600160a01b036101009091041660c0860152845260048101805483518186028101860190945280845294959194868501949192909184015b82821015610b23576000848152602090819020604080516060810182526003860290920180546001600160a01b031683526001808201548486015260029091015461ffff16918301919091529083529092019101610aca565b505050915250849050610b37600187613a33565b81518110610b4757610b476139d8565b6020908102919091018101919091526001600160a01b038089166000908152600783526040808220928c168252919092529020805482908110610b8c57610b8c6139d8565b906000526020600020015482600186610ba59190613a33565b81518110610bb557610bb56139d8565b6020908102919091010152610bc984613a46565b93505b610bd581613a04565b9050610949565b5093509150505b9250929050565b60408051808201909152600080825260208201526001600160a01b038316610c595760405162461bcd60e51b815260206004820152601a60248201527f43616e7420627579207469636b657420666f72206e6f626f647900000000000060448201526064015b60405180910390fd5b6001600160a01b0386166000908152600660205260409020805486908110610c8357610c836139d8565b600091825260209091206003600590920201015460ff16610ce65760405162461bcd60e51b815260206004820152601f60248201527f5468697320737562736372697074696f6e206e6f7420617661696c61626c65006044820152606401610c50565b610cf1338787611b58565b610d525760405162461bcd60e51b815260206004820152602c60248201527f4167656e74206e6f7420617574686f72697a656420666f72207468697320736560448201526b393b34b1b2903a30b934b33360a11b6064820152608401610c50565b600080610d5f8589611bf5565b915091508115610db15760405162461bcd60e51b815260206004820152601d60248201527f4f6e6c79206f6e652076616c6964207469636b65742061742074696d650000006044820152606401610c50565b604051806040016040528042600660008c6001600160a01b03166001600160a01b031681526020019081526020016000208a81548110610df357610df36139d8565b906000526020600020906005020160000160010154610e129190613a5d565b8152602001600660008b6001600160a01b03166001600160a01b031681526020019081526020016000208981548110610e4d57610e4d6139d8565b60009182526020808320600260059093020191909101549092526001600160a01b038089168252600883526040808320918d168352908352808220845181558484015160019091015560069092529081208054929550909189908110610eb557610eb56139d8565b90600052602060002090600502016004018781548110610ed757610ed76139d8565b9060005260206000209060030201600101541115610efd57610efb88888887611c8c565b505b846001600160a01b0316336001600160a01b0316896001600160a01b03167f4c5b2aaff86d44d358f0d51033bdf284f61a2539aaef4c9f8e5926f87bfc72408a604051610f4c91815260200190565b60405180910390a4505095945050505050565b610f6e338787878787876128a1565b505050505050565b6004546001600160a01b031615801590610f9a57506004546001600160a01b031633145b610fe65760405162461bcd60e51b815260206004820152601860248201527f4f6e6c7920666f722066757475726520726567697374727900000000000000006044820152606401610c50565b610ff08282612a50565b5050565b60003381806110038584611bf5565b915091508115801561101f57506003546001600160a01b031615155b1561111d5760035460405163496d511d60e11b81526001600160a01b0387811660048301528581166024830152909116906392daa23a906044016040805180830381865afa158015611075573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110999190613a70565b9092509050811561111d57801561111257600354604051631613d87d60e11b81526001600160a01b038781166004830152858116602483015290911690632c27b0fa90604401600060405180830381600087803b1580156110f957600080fd5b505af115801561110d573d6000803e3d6000fd5b505050505b506001949350505050565b816111635760405162461bcd60e51b815260206004820152601660248201527515985b1a59081d1a58dad95d081b9bdd08199bdd5b9960521b6044820152606401610c50565b8015611112576111128533612a50565b6001546001600160a01b031633146111c35760405162461bcd60e51b815260206004820152601360248201527227b7363c90383630ba3337b9369037bbb732b960691b6044820152606401610c50565b6001600160a01b0381166112195760405162461bcd60e51b815260206004820152601a60248201527f5a65726f20706c6174666f726d206665652072656365697665720000000000006044820152606401610c50565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b611249338686868686612abe565b5050505050565b6001546001600160a01b031633146112a05760405162461bcd60e51b815260206004820152601360248201527227b7363c90383630ba3337b9369037bbb732b960691b6044820152606401610c50565b6001805461ffff60a01b1916600160a01b61ffff84811682029290921792839055604051920416907f33ccf3986ed7ae2645cf7cf9d7bce92c7486d08774460245047acf492042c70a90600090a250565b6112f9612bea565b6113036000612c44565b565b60006113113383612c94565b92915050565b6007602052826000526040600020602052816000526040600020818154811061133f57600080fd5b9060005260206000200160009250925050505481565b61135d612bea565b6001600160a01b038216600081815260056020526040808220805460ff191685151590811790915590519092917f7644f0910f082692ff3f55d179775d81aec2399b3a256c31f79ac5431f7d6e6991a35050565b6000806113be8484611bf5565b9092509050811580156113db57506003546001600160a01b031615155b15610be35760035460405163496d511d60e11b81526001600160a01b0386811660048301528581166024830152909116906392daa23a906044016040805180830381865afa158015611431573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114559190613a70565b909590945092505050565b611468612bea565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b60006114993386868686612e91565b90505b949350505050565b3360009081526007602090815260408083206001600160a01b038716845290915281206060916114d49190613488565b3360009081526007602090815260408083206001600160a01b03881684529091528120905b8381101561159b57336000908152600660205260409020858583818110611522576115226139d8565b9050602002013581548110611539576115396139d8565b600091825260209091206003600590920201015460ff161561158b5781858583818110611568576115686139d8565b835460018101855560009485526020948590209190940292909201359190920155505b61159481613a04565b90506114f9565b508054604080516020808402820181019092528281529183918301828280156115e357602002820191906000526020600020905b8154815260200190600101908083116115cf575b50505050509150505b9392505050565b6115fb612bea565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316600090815260066020526040812080548291908590811061164a5761164a6139d8565b60009182526020909120600590910201541561172b576001600160a01b038516600090815260066020526040902080548590811061168a5761168a6139d8565b906000526020600020906005020160040183815481106116ac576116ac6139d8565b600091825260208083206003909202909101546001600160a01b038881168452600690925260409092208054919092169190869081106116ee576116ee6139d8565b90600052602060002090600502016004018481548110611710576117106139d8565b90600052602060002090600302016001015491509150611973565b6001600160a01b0385166000908152600660205260409020805485908110611755576117556139d8565b90600052602060002090600502016004018381548110611777576117776139d8565b60009182526020909120600390910201546001600160a01b03166127106117ab87600154600160a01b900461ffff16919050565b6001600160a01b03881660009081526006602052604090208054889081106117d5576117d56139d8565b906000526020600020906005020160040186815481106117f7576117f76139d8565b9060005260206000209060030201600101546118139190613a9f565b61181d9190613ab6565b6001600160a01b0387166000908152600660205260409020805461271091908890811061184c5761184c6139d8565b9060005260206000209060050201600401868154811061186e5761186e6139d8565b60009182526020808320600260039093020191909101546001600160a01b038b16835260069091526040909120805461ffff90921691899081106118b4576118b46139d8565b906000526020600020906005020160040187815481106118d6576118d66139d8565b9060005260206000209060030201600101546118f29190613a9f565b6118fc9190613ab6565b6001600160a01b0388166000908152600660205260409020805488908110611926576119266139d8565b90600052602060002090600502016004018681548110611948576119486139d8565b9060005260206000209060030201600101546119649190613a5d565b61196e9190613a5d565b915091505b935093915050565b6001600160a01b0381166000908152600660209081526040808320805482518185028101850190935280835260609492939192909184015b82821015611aaa57600084815260208082206040805160e0810182526005870290920180548383019081526001820154606085015260028201546080850152600382015460ff8116151560a086015261010090046001600160a01b031660c08501528352600481018054835181870281018701909452808452939591948681019491929084015b82821015611a93576000848152602090819020604080516060810182526003860290920180546001600160a01b031683526001808201548486015260029091015461ffff16918301919091529083529092019101611a3a565b5050505081525050815260200190600101906119b3565b505050509050919050565b611abd612bea565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b611ae7612bea565b6001600160a01b038116611b4c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610c50565b611b5581612c44565b50565b6000805b6001600160a01b03808516600090815260076020908152604080832093891683529290522054811015611bed576001600160a01b038085166000908152600760209081526040808320938916835292905220805484919083908110611bc357611bc36139d8565b906000526020600020015403611bdd5760019150506115ec565b611be681613a04565b9050611b5c565b509392505050565b6001600160a01b0380831660009081526008602090815260408083209385168352929052908120548190421080611c5357506001600160a01b0380851660009081526008602090815260408083209387168352929052206001015415155b6001600160a01b039485166000908152600860209081526040808320969097168252949094529390922060010154929392151592915050565b6001600160a01b0384166000908152600660205260408120805485908110611cb657611cb66139d8565b6000918252602090912060059091020154156122aa573415611cea5760405162461bcd60e51b8152600401610c5090613ad8565b611dd3823060066000896001600160a01b03166001600160a01b031681526020019081526020016000208781548110611d2557611d256139d8565b90600052602060002090600502016004018681548110611d4757611d476139d8565b906000526020600020906003020160010154600660008a6001600160a01b03166001600160a01b031681526020019081526020016000208881548110611d8f57611d8f6139d8565b90600052602060002090600502016004018781548110611db157611db16139d8565b60009182526020909120600390910201546001600160a01b0316929190612fef565b6002546001600160a01b0386811660009081526006602052604090208054611eb793929092169187908110611e0a57611e0a6139d8565b90600052602060002090600502016004018581548110611e2c57611e2c6139d8565b90600052602060002090600302016001015460066000896001600160a01b03166001600160a01b031681526020019081526020016000208781548110611e7457611e746139d8565b90600052602060002090600502016004018681548110611e9657611e966139d8565b60009182526020909120600390910201546001600160a01b03169190613060565b604080516101a081018252600061016082018181526101808301829052610100830190815261012083018290526101408301829052825260208083018290526060838501819052808401819052608084015260a0830182905260c0830182905260e083018290528351600180825281860190955292939192919082015b6040805160a0810182526000606082018181526080830182905282526020808301829052928201528252600019909201910181611f3457505060408051600180825281830190925291925060009190602082015b6040805180820190915260008082526020820152815260200190600190039081611f8857505060408051808201825260008082526001600160a01b038c1681526006602090815292902080549394509092918301914291908b908110611ff057611ff06139d8565b600091825260209091206005909102015461200b9190613a5d565b81525081600081518110612021576120216139d8565b602090810291909101810191909152604080516101a081018252600061016082018181526101808301829052610100830190815261012083018290526101408301829052825281840181905282518181529384018352909291830191906120b0565b60408051606081018252600080825260208083018290529282015282526000199092019101816120835790505b50815260208082018490526040805160008082529281018252920191906120f9565b60408051808201909152600080825260208201528152602001906001900390816120d25790505b50815260200160038152600060208201819052604091820152805160a0810190915290935080606081018060028152602001600660008d6001600160a01b03166001600160a01b031681526020019081526020016000208b81548110612161576121616139d8565b90600052602060002090600502016004018a81548110612183576121836139d8565b600091825260208083206003909202909101546001600160a01b03908116909352928452838301819052908c168152600690915260409081902080549190920191908a9081106121d5576121d56139d8565b906000526020600020906005020160040188815481106121f7576121f76139d8565b9060005260206000209060030201600101548152508260008151811061221f5761221f6139d8565b6020908102919091010152600254604051634d36d08560e01b81526001600160a01b0390911690634d36d0859061225e90869086908a90600401613c91565b6080604051808303816000875af115801561227d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122a19190613da4565b5050505061149c565b6001600160a01b03851660009081526006602052604081208054869081106122d4576122d46139d8565b906000526020600020906005020160040184815481106122f6576122f66139d8565b60009182526020909120600390910201546001600160a01b0316146125c45734156123335760405162461bcd60e51b8152600401610c5090613ad8565b6001600160a01b038516600090815260066020526040902080546123c191849187908110612363576123636139d8565b906000526020600020906005020160000160030160019054906101000a90046001600160a01b031660066000896001600160a01b03166001600160a01b031681526020019081526020016000208781548110611d2557611d256139d8565b6124d98233612710600660008a6001600160a01b03166001600160a01b0316815260200190815260200160002088815481106123ff576123ff6139d8565b90600052602060002090600502016004018781548110612421576124216139d8565b60009182526020808320600260039093020191909101546001600160a01b038c16835260069091526040909120805461ffff909216918a908110612467576124676139d8565b90600052602060002090600502016004018881548110612489576124896139d8565b9060005260206000209060030201600101546124a59190613a9f565b6124af9190613ab6565b6001600160a01b0389166000908152600660205260409020805489908110611d8f57611d8f6139d8565b600154600160a01b900461ffff1680156125be576001546001600160a01b03878116600090815260066020526040902080546125be9387931691612710918691908b90811061252a5761252a6139d8565b9060005260206000209060050201600401898154811061254c5761254c6139d8565b9060005260206000209060030201600101546125689190613a9f565b6125729190613ab6565b6001600160a01b038a16600090815260066020526040902080548a90811061259c5761259c6139d8565b90600052602060002090600502016004018881548110611db157611db16139d8565b5061149c565b60006125d186868661161d565b915050803410156126175760405162461bcd60e51b815260206004820152601060248201526f2737ba1032b737bab3b41032ba3432b960811b6044820152606401610c50565b6001600160a01b038616600090815260066020526040902080546126dd919087908110612646576126466139d8565b906000526020600020906005020160000160030160019054906101000a90046001600160a01b031660066000896001600160a01b03166001600160a01b0316815260200190815260200160002087815481106126a4576126a46139d8565b906000526020600020906005020160040186815481106126c6576126c66139d8565b90600052602060002090600302016001015461317a565b6127cf33612710600660008a6001600160a01b03166001600160a01b03168152602001908152602001600020888154811061271a5761271a6139d8565b9060005260206000209060050201600401878154811061273c5761273c6139d8565b60009182526020808320600260039093020191909101546001600160a01b038c16835260069091526040909120805461ffff909216918a908110612782576127826139d8565b906000526020600020906005020160040188815481106127a4576127a46139d8565b9060005260206000209060030201600101546127c09190613a9f565b6127ca9190613ab6565b61317a565b600154600160a01b900461ffff168015612842576001546001600160a01b03888116600090815260066020526040902080546128429392909216916127109185918b908110612820576128206139d8565b906000526020600020906005020160040189815481106127a4576127a46139d8565b600061284e8334613a33565b111561289757836001600160a01b0381166108fc61286c8534613a33565b6040518115909202916000818181858888f19350505050158015612894573d6000803e3d6000fd5b50505b5050949350505050565b6001600160a01b03871660009081526006602052604090208054869190889081106128ce576128ce6139d8565b600091825260208083206005909202909101929092556001600160a01b038916815260069091526040902080548591908890811061290e5761290e6139d8565b9060005260206000209060050201600001600101819055508260066000896001600160a01b03166001600160a01b03168152602001908152602001600020878154811061295d5761295d6139d8565b9060005260206000209060050201600001600201819055508160066000896001600160a01b03166001600160a01b0316815260200190815260200160002087815481106129ac576129ac6139d8565b60009182526020808320600592909202909101600301805460ff1916931515939093179092556001600160a01b03891681526006909152604090208054829190889081106129fc576129fc6139d8565b600091825260208220600591909102016003018054610100600160a81b0319166101006001600160a01b039485160217905560405188928a169160008051602061413783398151915291a350505050505050565b6001600160a01b0380831660009081526008602090815260408083209385168352929052206001015415610ff0576001600160a01b03808316600090815260086020908152604080832093851683529290529081206001018054909190612ab690613a46565b909155505050565b6001600160a01b03831660009081526005602052604090205460ff16612af65760405162461bcd60e51b8152600401610c5090613e3d565b6040518060600160405280846001600160a01b031681526020018381526020018261ffff1681525060066000886001600160a01b03166001600160a01b031681526020019081526020016000208681548110612b5457612b546139d8565b90600052602060002090600502016004018581548110612b7657612b766139d8565b6000918252602080832084516003939093020180546001600160a01b0319166001600160a01b039384161781559084015160018201556040938401516002909101805461ffff191661ffff9092169190911790559151879289169160008051602061413783398151915291a3505050505050565b6000546001600160a01b031633146113035760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610c50565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080612ca460a0840184613e74565b905011612ce75760405162461bcd60e51b8152602060048201526011602482015270139bc81c185e5b595b9d081b595d1a1bd9607a1b6044820152606401610c50565b60005b612cf760a0840184613e74565b9050811015612d805760056000612d1160a0860186613e74565b84818110612d2157612d216139d8565b612d37926020606090920201908101915061376f565b6001600160a01b0316815260208101919091526040016000205460ff16612d705760405162461bcd60e51b8152600401610c5090613e3d565b612d7981613a04565b9050612cea565b506020820135151580612d965750604082013515155b612dec5760405162461bcd60e51b815260206004820152602160248201527f54617269666620686173206e6f2076616c6964207469636b6574206f7074696f6044820152603760f91b6064820152608401610c50565b6001600160a01b0383166000908152600660209081526040822080546001810182559083529120839160050201612e238282613fd2565b50506001600160a01b038316600090815260066020526040902054612e4a90600190613a33565b6040516001600160a01b0385169060008051602061413783398151915290600090a36001600160a01b0383166000908152600660205260409020546115ec90600190613a33565b6001600160a01b03831660009081526005602052604081205460ff16612ec95760405162461bcd60e51b8152600401610c5090613e3d565b6001600160a01b0386166000908152600660205260409020805486908110612ef357612ef36139d8565b60009182526020808320604080516060810182526001600160a01b038a811682528185018a815261ffff8a8116848601908152600598909802909501600401805460018082018355918a529689209351600390970290930180546001600160a01b031916968316969096178655519185019190915593516002909301805461ffff1916939092169290921790555187929189169160008051602061413783398151915291a36001600160a01b038616600090815260066020526040902080546001919087908110612fc657612fc66139d8565b906000526020600020906005020160040180549050612fe59190613a33565b9695505050505050565b6040516001600160a01b038085166024830152831660448201526064810182905261305a9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152613293565b50505050565b8015806130da5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa1580156130b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130d8919061408d565b155b6131455760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610c50565b6040516001600160a01b03831660248201526044810182905261317590849063095ea7b360e01b90606401613023565b505050565b804710156131ca5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610c50565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114613217576040519150601f19603f3d011682016040523d82523d6000602084013e61321c565b606091505b50509050806131755760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610c50565b60006132e8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166133659092919063ffffffff16565b805190915015613175578080602001905181019061330691906140a6565b6131755760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610c50565b606061149c848460008585600080866001600160a01b0316858760405161338c91906140e7565b60006040518083038185875af1925050503d80600081146133c9576040519150601f19603f3d011682016040523d82523d6000602084013e6133ce565b606091505b50915091506133df878383876133ea565b979650505050505050565b60608315613459578251600003613452576001600160a01b0385163b6134525760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610c50565b508161149c565b61149c838381511561346e5781518083602001fd5b8060405162461bcd60e51b8152600401610c509190614103565b5080546000825590600052602060002090810190611b5591905b808211156134b657600081556001016134a2565b5090565b6001600160a01b0381168114611b5557600080fd5b600080604083850312156134e257600080fd5b82356134ed816134ba565b946020939093013593505050565b8051825260208082015190830152604080820151908301526060808201511515908301526080908101516001600160a01b0316910152565b60a0810161131182846134fb565b6000806040838503121561355457600080fd5b823561355f816134ba565b9150602083013561356f816134ba565b809150509250929050565b600081518084526020808501945080840160005b838110156135aa5781518752958201959082019060010161358e565b509495945050505050565b600081518084526020808501808196508360051b810191508286016000805b86811015613668578385038a52825160c08087016135f38884516134fb565b9188015160a088019190915280519182905287019060e087019084905b8082101561365357835180516001600160a01b031684528a8101518b85015260409081015161ffff16908401529289019260609092019160019190910190613610565b50509a87019a955050918501916001016135d4565b509298975050505050505050565b604081526000613689604083018561357a565b828103602084015261369b81856135b5565b95945050505050565b600080600080600060a086880312156136bc57600080fd5b85356136c7816134ba565b9450602086013593506040860135925060608601356136e5816134ba565b915060808601356136f5816134ba565b809150509295509295909350565b8015158114611b5557600080fd5b60008060008060008060c0878903121561372a57600080fd5b86359550602087013594506040870135935060608701359250608087013561375181613703565b915060a0870135613761816134ba565b809150509295509295509295565b60006020828403121561378157600080fd5b81356115ec816134ba565b61ffff81168114611b5557600080fd5b600080600080600060a086880312156137b457600080fd5b853594506020860135935060408601356137cd816134ba565b92506060860135915060808601356136f58161378c565b6000602082840312156137f657600080fd5b81356115ec8161378c565b60006020828403121561381357600080fd5b813567ffffffffffffffff81111561382a57600080fd5b820160c081850312156115ec57600080fd5b60008060006060848603121561385157600080fd5b833561385c816134ba565b9250602084013561386c816134ba565b929592945050506040919091013590565b6000806040838503121561389057600080fd5b823561389b816134ba565b9150602083013561356f81613703565b600080600080608085870312156138c157600080fd5b8435935060208501356138d3816134ba565b92506040850135915060608501356138ea8161378c565b939692955090935050565b60008060006040848603121561390a57600080fd5b8335613915816134ba565b9250602084013567ffffffffffffffff8082111561393257600080fd5b818601915086601f83011261394657600080fd5b81358181111561395557600080fd5b8760208260051b850101111561396a57600080fd5b6020830194508093505050509250925092565b6020815260006115ec602083018461357a565b6000806000606084860312156139a557600080fd5b83356139b0816134ba565b95602085013595506040909401359392505050565b6020815260006115ec60208301846135b5565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201613a1657613a166139ee565b5060010190565b634e487b7160e01b600052604160045260246000fd5b81810381811115611311576113116139ee565b600081613a5557613a556139ee565b506000190190565b80820180821115611311576113116139ee565b60008060408385031215613a8357600080fd5b8251613a8e81613703565b602084015190925061356f81613703565b8082028115828204841417611311576113116139ee565b600082613ad357634e487b7160e01b600052601260045260246000fd5b500490565b60208082526021908201527f4574686572204e6f7420616363657074656420696e2074686973206d6574686f6040820152601960fa1b606082015260800190565b60088110613b3757634e487b7160e01b600052602160045260246000fd5b9052565b8051613b48838251613b19565b6020908101516001600160a01b0316838201528101516040808401919091520151606090910152565b600081518084526020808501945080840160005b838110156135aa57815180516001600160f81b031916885283810151848901526040908101516001600160a01b03169088015260609096019590820190600101613b85565b600081518084526020808501945080840160005b838110156135aa57815180516001600160f81b03191688528301518388015260409096019590820190600101613bde565b600081518084526020808501945080840160005b838110156135aa57815180516001600160a01b0316885283015161ffff168388015260409096019590820190600101613c23565b600081518084526020808501945080840160005b838110156135aa57613c7e878351613b3b565b6080969096019590820190600101613c6b565b60608152613ca3606082018551613b3b565b60006020850151613cbf60e08401826001600160a01b03169052565b50604085015161016080610100850152613cdd6101c0850183613b71565b91506060870151605f198086850301610120870152613cfc8483613bca565b935060808901519150808685030161014087015250613d1b8382613c0f565b92505060a0870151613d2f82860182613b19565b505060c086015161018084015260e08601516001600160f01b0319166101a08401528281036020840152613d638186613c57565b91505061149c60408301846001600160a01b03169052565b6040805190810167ffffffffffffffff81118282101715613d9e57613d9e613a1d565b60405290565b60008183036080811215613db757600080fd5b6040516060810181811067ffffffffffffffff82111715613dda57613dda613a1d565b6040908152821215613deb57600080fd5b613df3613d7b565b9150835160088110613e0457600080fd5b82526020840151613e14816134ba565b806020840152508181526040840151602082015260608401516040820152809250505092915050565b6020808252601c908201527f4e6f742077686974656c697374656420666f72207061796d656e747300000000604082015260600190565b6000808335601e19843603018112613e8b57600080fd5b83018035915067ffffffffffffffff821115613ea657600080fd5b6020019150606081023603821315610be357600080fd5b8135613ec8816134ba565b81546001600160a01b0319166001600160a01b039190911617815560208201356001820155600281016040830135613eff8161378c565b815461ffff191661ffff919091161790555050565b68010000000000000000831115613f2d57613f2d613a1d565b805483825580841015613f9d5760038181028181048314613f5057613f506139ee565b8582028281048714613f6457613f646139ee565b6000858152602081209283019291909101905b82821015613f98578082558060018301558060028301558382019150613f77565b505050505b5060008181526020812083915b85811015610f6e57613fbc8383613ebd565b6060929092019160039190910190600101613faa565b813581556020820135600182015560408201356002820155600381016060830135613ffc81613703565b8154608085013561400c816134ba565b6001600160a81b03199190911691151560ff169190911760089190911b610100600160a81b031617905560a082013536839003601e1901811261404e57600080fd5b8201803567ffffffffffffffff81111561406757600080fd5b60208201915060608102360382131561407f57600080fd5b61305a818360048601613f14565b60006020828403121561409f57600080fd5b5051919050565b6000602082840312156140b857600080fd5b81516115ec81613703565b60005b838110156140de5781810151838201526020016140c6565b50506000910152565b600082516140f98184602087016140c3565b9190910192915050565b60208152600082518060208401526141228160408501602087016140c3565b601f01601f1916919091016040019291505056fe51751d7a3fc2914a9b7dc668bb0fad6b90107c5b347172186c8040c4e4c9f99ba26469706673582212201488c591bd2bea50ccd829a45b28f1c9446f265ae1bdee7661d45e3885dfb3e064736f6c63430008130033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000005992fe461f81c8e0affa95b831e50e9b3854ba0e
-----Decoded View---------------
Arg [0] : _platformOwner (address): 0x5992Fe461F81C8E0aFFA95b831E50e9b3854BA0E
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000005992fe461f81c8e0affa95b831e50e9b3854ba0e
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.