Contract
0x3e321356724A88fA1737ef589f3e4c269963200b
8
Contract Overview
Balance:
0 CELO
CELO Value:
$0.00
My Name Tag:
Not Available, login to update
Txn Hash | Method |
Block
|
From
|
To
|
Value | [Txn Fee] | |||
---|---|---|---|---|---|---|---|---|---|
0x6fde91319d10abdfff035b563cbe91509b615c31d9671e38ab25cf2cec4575f0 | 0x60806040 | 16594051 | 299 days 59 mins ago | 0x54812dbab593674cd4f1216264895be48b55c5e3 | IN | Create: CaskSubscriptions | 0 CELO | 0.002529355 |
[ Download CSV Export ]
Contract Name:
CaskSubscriptions
Compiler Version
v0.8.9+commit.e5eed63a
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import "@opengsn/contracts/src/BaseRelayRecipient.sol"; import "../interfaces/ICaskSubscriptionManager.sol"; import "../interfaces/ICaskSubscriptions.sol"; import "../interfaces/ICaskSubscriptionPlans.sol"; contract CaskSubscriptions is ICaskSubscriptions, BaseRelayRecipient, ERC721Upgradeable, OwnableUpgradeable, PausableUpgradeable { /************************** PARAMETERS **************************/ /** @dev contract to manage subscription plan definitions. */ ICaskSubscriptionManager public subscriptionManager; /** @dev contract to manage subscription plan definitions. */ ICaskSubscriptionPlans public subscriptionPlans; /************************** STATE **************************/ /** @dev Maps for consumer to list of subscriptions. */ mapping(address => uint256[]) private consumerSubscriptions; // consumer => subscriptionId[] mapping(uint256 => Subscription) private subscriptions; // subscriptionId => Subscription mapping(uint256 => bytes32) private pendingPlanChanges; // subscriptionId => planData /** @dev Maps for provider to list of subscriptions and plans. */ mapping(address => uint256[]) private providerSubscriptions; // provider => subscriptionId[] mapping(address => uint256) private providerActiveSubscriptionCount; // provider => count mapping(address => mapping(uint32 => uint256)) private planActiveSubscriptionCount; // provider => planId => count mapping(address => mapping(address => mapping(uint32 => uint256))) private consumerProviderPlanActiveCount; modifier onlyManager() { require(_msgSender() == address(subscriptionManager), "!AUTH"); _; } modifier onlySubscriber(uint256 _subscriptionId) { require(_msgSender() == ownerOf(_subscriptionId), "!AUTH"); _; } modifier onlySubscriberOrProvider(uint256 _subscriptionId) { require( _msgSender() == ownerOf(_subscriptionId) || _msgSender() == subscriptions[_subscriptionId].provider, "!AUTH" ); _; } function initialize( address _subscriptionPlans ) public initializer { __Ownable_init(); __Pausable_init(); __ERC721_init("Cask Subscriptions","CASKSUBS"); subscriptionPlans = ICaskSubscriptionPlans(_subscriptionPlans); } /// @custom:oz-upgrades-unsafe-allow constructor constructor() initializer {} function versionRecipient() public pure override returns(string memory) { return "2.2.0"; } function _msgSender() internal view override(ContextUpgradeable, BaseRelayRecipient) returns (address sender) { sender = BaseRelayRecipient._msgSender(); } function _msgData() internal view override(ContextUpgradeable, BaseRelayRecipient) returns (bytes calldata) { return BaseRelayRecipient._msgData(); } function tokenURI(uint256 _subscriptionId) public view override returns (string memory) { require(_exists(_subscriptionId), "ERC721Metadata: URI query for nonexistent token"); Subscription memory subscription = subscriptions[_subscriptionId]; return string(abi.encodePacked("ipfs://", subscription.cid)); } function _beforeTokenTransfer( address _from, address _to, uint256 _subscriptionId ) internal override { if (_from != address(0) && _to != address(0)) { // only non-mint/burn transfers Subscription storage subscription = subscriptions[_subscriptionId]; PlanInfo memory planInfo = _parsePlanData(subscription.planData); require(planInfo.canTransfer, "!NOT_TRANSFERRABLE"); require(subscription.minTermAt == 0 || uint32(block.timestamp) >= subscription.minTermAt, "!MIN_TERM"); // on transfer, set subscription to cancel at next renewal until new owner accepts subscription subscription.cancelAt = subscription.renewAt; consumerSubscriptions[_to].push(_subscriptionId); } } /************************** SUBSCRIPTION METHODS **************************/ function createNetworkSubscription( uint256 _nonce, bytes32[] calldata _planProof, // [provider, ref, planData, merkleRoot, merkleProof...] bytes32[] calldata _discountProof, // [discountCodeProof, discountData, merkleRoot, merkleProof...] bytes32 _networkData, uint32 _cancelAt, bytes memory _providerSignature, bytes memory _networkSignature, string calldata _cid ) external override whenNotPaused { uint256 subscriptionId = _createSubscription(_nonce, _planProof, _discountProof, _cancelAt, _providerSignature, _cid); _verifyNetworkData(_networkData, _networkSignature); Subscription storage subscription = subscriptions[subscriptionId]; subscription.networkData = _networkData; } function createSubscription( uint256 _nonce, bytes32[] calldata _planProof, // [provider, ref, planData, merkleRoot, merkleProof...] bytes32[] calldata _discountProof, // [discountCodeProof, discountData, merkleRoot, merkleProof...] uint32 _cancelAt, bytes memory _providerSignature, string calldata _cid ) external override whenNotPaused { _createSubscription(_nonce, _planProof, _discountProof, _cancelAt, _providerSignature, _cid); } function attachData( uint256 _subscriptionId, string calldata _dataCid ) external override onlySubscriberOrProvider(_subscriptionId) whenNotPaused { Subscription storage subscription = subscriptions[_subscriptionId]; require(subscription.status != SubscriptionStatus.Canceled, "!CANCELED"); subscription.dataCid = _dataCid; } function changeSubscriptionPlan( uint256 _subscriptionId, uint256 _nonce, bytes32[] calldata _planProof, // [provider, ref, planData, merkleRoot, merkleProof...] bytes32[] calldata _discountProof, // [discountCodeProof, discountData, merkleRoot, merkleProof...] bytes memory _providerSignature, string calldata _cid ) external override onlySubscriber(_subscriptionId) whenNotPaused { _changeSubscriptionPlan(_subscriptionId, _nonce, _planProof, _discountProof, _providerSignature, _cid); } function pauseSubscription( uint256 _subscriptionId ) external override onlySubscriberOrProvider(_subscriptionId) whenNotPaused { Subscription storage subscription = subscriptions[_subscriptionId]; require(subscription.status != SubscriptionStatus.Paused && subscription.status != SubscriptionStatus.PastDue && subscription.status != SubscriptionStatus.Canceled && subscription.status != SubscriptionStatus.Trialing, "!INVALID(status)"); require(subscription.minTermAt == 0 || uint32(block.timestamp) >= subscription.minTermAt, "!MIN_TERM"); PlanInfo memory planInfo = _parsePlanData(subscription.planData); require(planInfo.canPause, "!NOT_PAUSABLE"); subscription.status = SubscriptionStatus.PendingPause; emit SubscriptionPendingPause(ownerOf(_subscriptionId), subscription.provider, _subscriptionId, subscription.ref, subscription.planId); } function resumeSubscription( uint256 _subscriptionId ) external override onlySubscriber(_subscriptionId) whenNotPaused { Subscription storage subscription = subscriptions[_subscriptionId]; require(subscription.status == SubscriptionStatus.Paused || subscription.status == SubscriptionStatus.PendingPause, "!NOT_PAUSED"); emit SubscriptionResumed(ownerOf(_subscriptionId), subscription.provider, _subscriptionId, subscription.ref, subscription.planId); if (subscription.status == SubscriptionStatus.PendingPause) { subscription.status = SubscriptionStatus.Active; return; } PlanInfo memory planInfo = _parsePlanData(subscription.planData); require(planInfo.maxActive == 0 || planActiveSubscriptionCount[subscription.provider][planInfo.planId] < planInfo.maxActive, "!MAX_ACTIVE"); subscription.status = SubscriptionStatus.Active; providerActiveSubscriptionCount[subscription.provider] += 1; planActiveSubscriptionCount[subscription.provider][subscription.planId] += 1; consumerProviderPlanActiveCount[ownerOf(_subscriptionId)][subscription.provider][subscription.planId] += 1; // if renewal date has already passed, set it to now so consumer is not charged for the time it was paused if (subscription.renewAt < uint32(block.timestamp)) { subscription.renewAt = uint32(block.timestamp); } // re-register subscription with manager subscriptionManager.renewSubscription(_subscriptionId); // make sure still active if payment was required to resume require(subscription.status == SubscriptionStatus.Active, "!INSUFFICIENT_FUNDS"); } function cancelSubscription( uint256 _subscriptionId, uint32 _cancelAt ) external override onlySubscriberOrProvider(_subscriptionId) whenNotPaused { Subscription storage subscription = subscriptions[_subscriptionId]; require(subscription.status != SubscriptionStatus.Canceled, "!INVALID(status)"); uint32 timestamp = uint32(block.timestamp); if(_cancelAt == 0) { require(_msgSender() == ownerOf(_subscriptionId), "!AUTH"); // clearing cancel only allowed by subscriber subscription.cancelAt = _cancelAt; emit SubscriptionPendingCancel(ownerOf(_subscriptionId), subscription.provider, _subscriptionId, subscription.ref, subscription.planId, _cancelAt); } else if(_cancelAt <= timestamp) { require(subscription.minTermAt == 0 || timestamp >= subscription.minTermAt, "!MIN_TERM"); subscription.renewAt = timestamp; subscription.cancelAt = timestamp; subscriptionManager.renewSubscription(_subscriptionId); // force manager to process cancel } else { require(subscription.minTermAt == 0 || _cancelAt >= subscription.minTermAt, "!MIN_TERM"); subscription.cancelAt = _cancelAt; emit SubscriptionPendingCancel(ownerOf(_subscriptionId), subscription.provider, _subscriptionId, subscription.ref, subscription.planId, _cancelAt); } } function managerCommand( uint256 _subscriptionId, ManagerCommand _command ) external override onlyManager whenNotPaused { Subscription storage subscription = subscriptions[_subscriptionId]; uint32 timestamp = uint32(block.timestamp); if (_command == ManagerCommand.PlanChange) { bytes32 pendingPlanData = pendingPlanChanges[_subscriptionId]; require(pendingPlanData > 0, "!INVALID(pendingPlanData)"); PlanInfo memory newPlanInfo = _parsePlanData(pendingPlanData); emit SubscriptionChangedPlan(ownerOf(_subscriptionId), subscription.provider, _subscriptionId, subscription.ref, subscription.planId, newPlanInfo.planId, subscription.discountId); subscription.planId = newPlanInfo.planId; subscription.planData = pendingPlanData; if (newPlanInfo.minPeriods > 0) { subscription.minTermAt = timestamp + (newPlanInfo.period * newPlanInfo.minPeriods); } delete pendingPlanChanges[_subscriptionId]; // free up memory } else if (_command == ManagerCommand.Cancel) { subscription.status = SubscriptionStatus.Canceled; providerActiveSubscriptionCount[subscription.provider] -= 1; planActiveSubscriptionCount[subscription.provider][subscription.planId] -= 1; if (consumerProviderPlanActiveCount[ownerOf(_subscriptionId)][subscription.provider][subscription.planId] > 0) { consumerProviderPlanActiveCount[ownerOf(_subscriptionId)][subscription.provider][subscription.planId] -= 1; } emit SubscriptionCanceled(ownerOf(_subscriptionId), subscription.provider, _subscriptionId, subscription.ref, subscription.planId); _burn(_subscriptionId); } else if (_command == ManagerCommand.Pause) { subscription.status = SubscriptionStatus.Paused; providerActiveSubscriptionCount[subscription.provider] -= 1; planActiveSubscriptionCount[subscription.provider][subscription.planId] -= 1; if (consumerProviderPlanActiveCount[ownerOf(_subscriptionId)][subscription.provider][subscription.planId] > 0) { consumerProviderPlanActiveCount[ownerOf(_subscriptionId)][subscription.provider][subscription.planId] -= 1; } emit SubscriptionPaused(ownerOf(_subscriptionId), subscription.provider, _subscriptionId, subscription.ref, subscription.planId); } else if (_command == ManagerCommand.PastDue) { subscription.status = SubscriptionStatus.PastDue; emit SubscriptionPastDue(ownerOf(_subscriptionId), subscription.provider, _subscriptionId, subscription.ref, subscription.planId); } else if (_command == ManagerCommand.Renew) { PlanInfo memory planInfo = _parsePlanData(subscription.planData); if (subscription.status == SubscriptionStatus.Trialing) { emit SubscriptionTrialEnded(ownerOf(_subscriptionId), subscription.provider, _subscriptionId, subscription.ref, subscription.planId); } subscription.renewAt = subscription.renewAt + planInfo.period; if (subscription.renewAt > timestamp) { // leave in current status unless subscription is current subscription.status = SubscriptionStatus.Active; } emit SubscriptionRenewed(ownerOf(_subscriptionId), subscription.provider, _subscriptionId, subscription.ref, subscription.planId); } else if (_command == ManagerCommand.ClearDiscount) { subscription.discountId = 0; subscription.discountData = 0; } } function getSubscription( uint256 _subscriptionId ) external override view returns (Subscription memory subscription, address currentOwner) { subscription = subscriptions[_subscriptionId]; if (_exists(_subscriptionId)) { currentOwner = ownerOf(_subscriptionId); } else { currentOwner = address(0); } } function getConsumerSubscription( address _consumer, uint256 _idx ) external override view returns(uint256) { return consumerSubscriptions[_consumer][_idx]; } function getActiveSubscriptionCount( address _consumer, address _provider, uint32 _planId ) external override view returns(uint256) { return consumerProviderPlanActiveCount[_consumer][_provider][_planId]; } function getConsumerSubscriptionCount( address _consumer ) external override view returns (uint256) { return consumerSubscriptions[_consumer].length; } function getProviderSubscription( address _provider, uint256 _idx ) external override view returns(uint256) { return providerSubscriptions[_provider][_idx]; } function getProviderSubscriptionCount( address _provider, bool _includeCanceled, uint32 _planId ) external override view returns (uint256) { if (_includeCanceled) { return providerSubscriptions[_provider].length; } else { if (_planId > 0) { return planActiveSubscriptionCount[_provider][_planId]; } else { return providerActiveSubscriptionCount[_provider]; } } } function getPendingPlanChange( uint256 _subscriptionId ) external override view returns (bytes32) { return pendingPlanChanges[_subscriptionId]; } function _createSubscription( uint256 _nonce, bytes32[] calldata _planProof, // [provider, ref, planData, merkleRoot, merkleProof...] bytes32[] calldata _discountProof, // [discountCodeProof, discountData, merkleRoot, merkleProof...] uint32 _cancelAt, bytes memory _providerSignature, string calldata _cid ) internal returns(uint256) { require(_planProof.length >= 4, "!INVALID(planProofLen)"); // confirms merkleroots are in fact the ones provider committed to address provider; if (_discountProof.length >= 3) { provider = _verifyMerkleRoots(_planProof[0], _nonce, _planProof[3], _discountProof[2], _providerSignature); } else { provider = _verifyMerkleRoots(_planProof[0], _nonce, _planProof[3], 0, _providerSignature); } // confirms plan data is included in merkle root require(_verifyPlanProof(_planProof), "!INVALID(planProof)"); // decode planData bytes32 into PlanInfo PlanInfo memory planInfo = _parsePlanData(_planProof[2]); // generate subscriptionId from plan info and ref uint256 subscriptionId = _generateSubscriptionId(_planProof[0], _planProof[1], _planProof[2]); require(planInfo.maxActive == 0 || planActiveSubscriptionCount[provider][planInfo.planId] < planInfo.maxActive, "!MAX_ACTIVE"); require(subscriptionPlans.getPlanStatus(provider, planInfo.planId) == ICaskSubscriptionPlans.PlanStatus.Enabled, "!NOT_ENABLED"); _safeMint(_msgSender(), subscriptionId); Subscription storage subscription = subscriptions[subscriptionId]; uint32 timestamp = uint32(block.timestamp); subscription.provider = provider; subscription.planId = planInfo.planId; subscription.ref = _planProof[1]; subscription.planData = _planProof[2]; subscription.cancelAt = _cancelAt; subscription.cid = _cid; subscription.createdAt = timestamp; if (planInfo.minPeriods > 0) { subscription.minTermAt = timestamp + (planInfo.period * planInfo.minPeriods); } if (planInfo.price == 0) { // free plan, never renew to save gas subscription.status = SubscriptionStatus.Active; subscription.renewAt = 0; } else if (planInfo.freeTrial > 0) { // if trial period, charge will happen after trial is over subscription.status = SubscriptionStatus.Trialing; subscription.renewAt = timestamp + planInfo.freeTrial; } else { // if no trial period, charge now subscription.status = SubscriptionStatus.Active; subscription.renewAt = timestamp; } consumerSubscriptions[_msgSender()].push(subscriptionId); providerSubscriptions[provider].push(subscriptionId); providerActiveSubscriptionCount[provider] += 1; planActiveSubscriptionCount[provider][planInfo.planId] += 1; consumerProviderPlanActiveCount[_msgSender()][provider][planInfo.planId] += 1; ( subscription.discountId, subscription.discountData ) = _verifyDiscountProof(ownerOf(subscriptionId), subscription.provider, planInfo.planId, _discountProof); subscriptionManager.renewSubscription(subscriptionId); // registers subscription with manager require(subscription.status == SubscriptionStatus.Active || subscription.status == SubscriptionStatus.Trialing, "!UNPROCESSABLE"); emit SubscriptionCreated(ownerOf(subscriptionId), subscription.provider, subscriptionId, subscription.ref, subscription.planId, subscription.discountId); return subscriptionId; } function _changeSubscriptionPlan( uint256 _subscriptionId, uint256 _nonce, bytes32[] calldata _planProof, // [provider, ref, planData, merkleRoot, merkleProof...] bytes32[] calldata _discountProof, // [discountCodeProof, discountData, merkleRoot, merkleProof...] bytes memory _providerSignature, string calldata _cid ) internal { require(_planProof.length >= 4, "!INVALID(planProof)"); Subscription storage subscription = subscriptions[_subscriptionId]; require(subscription.renewAt == 0 || subscription.renewAt > uint32(block.timestamp), "!NEED_RENEWAL"); require(subscription.status == SubscriptionStatus.Active || subscription.status == SubscriptionStatus.Trialing, "!INVALID(status)"); // confirms merkleroots are in fact the ones provider committed to address provider; if (_discountProof.length >= 3) { provider = _verifyMerkleRoots(_planProof[0], _nonce, _planProof[3], _discountProof[2], _providerSignature); } else { provider = _verifyMerkleRoots(_planProof[0], _nonce, _planProof[3], 0, _providerSignature); } // confirms plan data is included in merkle root require(_verifyPlanProof(_planProof), "!INVALID(planProof)"); // decode planData bytes32 into PlanInfo PlanInfo memory newPlanInfo = _parsePlanData(_planProof[2]); require(subscription.provider == provider, "!INVALID(provider)"); subscription.cid = _cid; if (subscription.discountId == 0 && _discountProof.length >= 3 && _discountProof[0] > 0) { ( subscription.discountId, subscription.discountData ) = _verifyDiscountProof(ownerOf(_subscriptionId), subscription.provider, newPlanInfo.planId, _discountProof); } if (subscription.planId != newPlanInfo.planId) { require(subscriptionPlans.getPlanStatus(provider, newPlanInfo.planId) == ICaskSubscriptionPlans.PlanStatus.Enabled, "!NOT_ENABLED"); _performPlanChange(_subscriptionId, newPlanInfo, _planProof[2]); } } function _performPlanChange( uint256 _subscriptionId, PlanInfo memory _newPlanInfo, bytes32 _planData ) internal { Subscription storage subscription = subscriptions[_subscriptionId]; PlanInfo memory currentPlanInfo = _parsePlanData(subscription.planData); if (subscription.status == SubscriptionStatus.Trialing) { // still in trial, just change now // adjust renewal based on new plan trial length subscription.renewAt = subscription.renewAt - currentPlanInfo.freeTrial + _newPlanInfo.freeTrial; // if new plan trial length would have caused trial to already be over, end trial as of now // subscription will be charged and converted to active during next keeper run if (subscription.renewAt <= uint32(block.timestamp)) { subscription.renewAt = uint32(block.timestamp); } _swapPlan(_subscriptionId, _newPlanInfo, _planData); } else if (_newPlanInfo.price / _newPlanInfo.period == currentPlanInfo.price / currentPlanInfo.period) { // straight swap _swapPlan(_subscriptionId, _newPlanInfo, _planData); } else if (_newPlanInfo.price / _newPlanInfo.period > currentPlanInfo.price / currentPlanInfo.period) { // upgrade _upgradePlan(_subscriptionId, currentPlanInfo, _newPlanInfo, _planData); } else { // downgrade - to take affect at next renewal _scheduleSwapPlan(_subscriptionId, _newPlanInfo.planId, _planData); } } function _verifyDiscountProof( address _consumer, address _provider, uint32 _planId, bytes32[] calldata _discountProof // [discountValidator, discountData, merkleRoot, merkleProof...] ) internal returns(bytes32, bytes32) { if (_discountProof[0] > 0) { bytes32 discountId = subscriptionPlans.verifyAndConsumeDiscount(_consumer, _provider, _planId, _discountProof); if (discountId > 0) { return (discountId, _discountProof[1]); } } return (0,0); } function _verifyPlanProof( bytes32[] calldata _planProof // [provider, ref, planData, merkleRoot, merkleProof...] ) internal view returns(bool) { return subscriptionPlans.verifyPlan(_planProof[2], _planProof[3], _planProof[4:]); } function _generateSubscriptionId( bytes32 _providerAddr, bytes32 _ref, bytes32 _planData ) internal view returns(uint256) { return uint256(keccak256(abi.encodePacked(_msgSender(), _providerAddr, _planData, _ref, block.number, block.timestamp))); } function _parsePlanData( bytes32 _planData ) internal pure returns(PlanInfo memory) { bytes1 options = bytes1(_planData << 248); return PlanInfo({ price: uint256(_planData >> 160), planId: uint32(bytes4(_planData << 96)), period: uint32(bytes4(_planData << 128)), freeTrial: uint32(bytes4(_planData << 160)), maxActive: uint32(bytes4(_planData << 192)), minPeriods: uint16(bytes2(_planData << 224)), gracePeriod: uint8(bytes1(_planData << 240)), canPause: options & 0x01 == 0x01, canTransfer: options & 0x02 == 0x02 }); } function _parseNetworkData( bytes32 _networkData ) internal pure returns(NetworkInfo memory) { return NetworkInfo({ network: address(bytes20(_networkData)), feeBps: uint16(bytes2(_networkData << 160)) }); } function _scheduleSwapPlan( uint256 _subscriptionId, uint32 newPlanId, bytes32 _newPlanData ) internal { Subscription storage subscription = subscriptions[_subscriptionId]; pendingPlanChanges[_subscriptionId] = _newPlanData; emit SubscriptionPendingChangePlan(ownerOf(_subscriptionId), subscription.provider, _subscriptionId, subscription.ref, subscription.planId, newPlanId); } function _swapPlan( uint256 _subscriptionId, PlanInfo memory _newPlanInfo, bytes32 _newPlanData ) internal { Subscription storage subscription = subscriptions[_subscriptionId]; emit SubscriptionChangedPlan(ownerOf(_subscriptionId), subscription.provider, _subscriptionId, subscription.ref, subscription.planId, _newPlanInfo.planId, subscription.discountId); if (_newPlanInfo.minPeriods > 0) { subscription.minTermAt = uint32(block.timestamp + (_newPlanInfo.period * _newPlanInfo.minPeriods)); } subscription.planId = _newPlanInfo.planId; subscription.planData = _newPlanData; } function _upgradePlan( uint256 _subscriptionId, PlanInfo memory _currentPlanInfo, PlanInfo memory _newPlanInfo, bytes32 _newPlanData ) internal { Subscription storage subscription = subscriptions[_subscriptionId]; _swapPlan(_subscriptionId, _newPlanInfo, _newPlanData); if (_currentPlanInfo.price == 0 && _newPlanInfo.price != 0) { // coming from free plan, no prorate subscription.renewAt = uint32(block.timestamp); subscriptionManager.renewSubscription(_subscriptionId); // register paid plan with manager require(subscription.status == SubscriptionStatus.Active, "!UNPROCESSABLE"); // make sure payment processed } else { // prorated payment now - next renewal will charge new price uint256 newAmount = ((_newPlanInfo.price / _newPlanInfo.period) - (_currentPlanInfo.price / _currentPlanInfo.period)) * (subscription.renewAt - uint32(block.timestamp)); require(subscriptionManager.processSinglePayment(ownerOf(_subscriptionId), subscription.provider, _subscriptionId, newAmount), "!UNPROCESSABLE"); } } /************************** ADMIN FUNCTIONS **************************/ function pause() external onlyOwner { _pause(); } function unpause() external onlyOwner { _unpause(); } function setManager( address _subscriptionManager ) external onlyOwner { subscriptionManager = ICaskSubscriptionManager(_subscriptionManager); } function setTrustedForwarder( address _forwarder ) external onlyOwner { _setTrustedForwarder(_forwarder); } function _verifyMerkleRoots( bytes32 providerAddr, uint256 _nonce, bytes32 _planMerkleRoot, bytes32 _discountMerkleRoot, bytes memory _providerSignature ) internal view returns (address) { address provider = address(bytes20(providerAddr << 96)); require(subscriptionPlans.verifyProviderSignature( provider, _nonce, _planMerkleRoot, _discountMerkleRoot, _providerSignature ), "!INVALID(signature)"); return provider; } function _verifyNetworkData( bytes32 _networkData, bytes memory _networkSignature ) internal view returns (address) { NetworkInfo memory networkInfo = _parseNetworkData(_networkData); require(subscriptionPlans.verifyNetworkData(networkInfo.network, _networkData, _networkSignature), "!INVALID(networkSignature)"); return networkInfo.network; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "./IERC721Upgradeable.sol"; import "./IERC721ReceiverUpgradeable.sol"; import "./extensions/IERC721MetadataUpgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "../../utils/ContextUpgradeable.sol"; import "../../utils/StringsUpgradeable.sol"; import "../../utils/introspection/ERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable { using AddressUpgradeable for address; using StringsUpgradeable for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing { __Context_init_unchained(); __ERC165_init_unchained(); __ERC721_init_unchained(name_, symbol_); } function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) { return interfaceId == type(IERC721Upgradeable).interfaceId || interfaceId == type(IERC721MetadataUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721Upgradeable.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @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. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721Upgradeable.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721Upgradeable.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721Upgradeable.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits a {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721ReceiverUpgradeable.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} uint256[44] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.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 OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal onlyInitializing { __Context_init_unchained(); __Ownable_init_unchained(); } function __Ownable_init_unchained() internal onlyInitializing { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { 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); } uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract PausableUpgradeable is Initializable, ContextUpgradeable { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ function __Pausable_init() internal onlyInitializing { __Context_init_unchained(); __Pausable_init_unchained(); } function __Pausable_init_unchained() internal onlyInitializing { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(paused(), "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // solhint-disable no-inline-assembly pragma solidity >=0.6.9; import "./interfaces/IRelayRecipient.sol"; /** * A base contract to be inherited by any contract that want to receive relayed transactions * A subclass must use "_msgSender()" instead of "msg.sender" */ abstract contract BaseRelayRecipient is IRelayRecipient { /* * Forwarder singleton we accept calls from */ address private _trustedForwarder; function trustedForwarder() public virtual view returns (address){ return _trustedForwarder; } function _setTrustedForwarder(address _forwarder) internal { _trustedForwarder = _forwarder; } function isTrustedForwarder(address forwarder) public virtual override view returns(bool) { return forwarder == _trustedForwarder; } /** * return the sender of this call. * if the call came through our trusted forwarder, return the original sender. * otherwise, return `msg.sender`. * should be used in the contract anywhere instead of msg.sender */ function _msgSender() internal override virtual view returns (address ret) { if (msg.data.length >= 20 && isTrustedForwarder(msg.sender)) { // At this point we know that the sender is a trusted forwarder, // so we trust that the last bytes of msg.data are the verified sender address. // extract sender address from the end of msg.data assembly { ret := shr(96,calldataload(sub(calldatasize(),20))) } } else { ret = msg.sender; } } /** * return the msg.data of this call. * if the call came through our trusted forwarder, then the real sender was appended as the last 20 bytes * of the msg.data - so this method will strip those 20 bytes off. * otherwise (if the call was made directly and not through the forwarder), return `msg.data` * should be used in the contract instead of msg.data, where this difference matters. */ function _msgData() internal override virtual view returns (bytes calldata ret) { if (msg.data.length >= 20 && isTrustedForwarder(msg.sender)) { return msg.data[0:msg.data.length-20]; } else { return msg.data; } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface ICaskSubscriptionManager { enum CheckType { None, Active, PastDue } function queueItem(CheckType _checkType, uint32 _bucket, uint256 _idx) external view returns(uint256); function queueSize(CheckType _checkType, uint32 _bucket) external view returns(uint256); function queuePosition(CheckType _checkType) external view returns(uint32); function processSinglePayment(address _consumer, address _provider, uint256 _subscriptionId, uint256 _value) external returns(bool); function renewSubscription(uint256 _subscriptionId) external; /** @dev Emitted when the keeper job performs renewals. */ event SubscriptionManagerReport(uint256 limit, uint256 renewals, uint256 depth, CheckType checkType, uint256 queueRemaining, uint32 currentBucket); /** @dev Emitted when manager parameters are changed. */ event SetParameters(); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; import "./ICaskSubscriptionManager.sol"; interface ICaskSubscriptions is IERC721Upgradeable { enum SubscriptionStatus { None, Trialing, Active, Paused, Canceled, PastDue, PendingPause } enum ManagerCommand { None, PlanChange, Cancel, PastDue, Renew, ClearDiscount, Pause } struct Subscription { bytes32 planData; bytes32 networkData; bytes32 discountId; bytes32 discountData; bytes32 ref; address provider; SubscriptionStatus status; uint32 planId; uint32 createdAt; uint32 renewAt; uint32 minTermAt; uint32 cancelAt; string cid; string dataCid; } struct PlanInfo { uint256 price; uint32 planId; uint32 period; uint32 freeTrial; uint32 maxActive; uint16 minPeriods; uint8 gracePeriod; bool canPause; bool canTransfer; } struct NetworkInfo { address network; uint16 feeBps; } /************************** SUBSCRIPTION INSTANCE METHODS **************************/ function createSubscription( uint256 _nonce, bytes32[] calldata _planProof, bytes32[] calldata _discountProof, uint32 _cancelAt, bytes memory _providerSignature, string calldata _cid ) external; function createNetworkSubscription( uint256 _nonce, bytes32[] calldata _planProof, bytes32[] calldata _discountProof, bytes32 _networkData, uint32 _cancelAt, bytes memory _providerSignature, bytes memory _networkSignature, string calldata _cid ) external; function changeSubscriptionPlan( uint256 _subscriptionId, uint256 _nonce, bytes32[] calldata _planProof, bytes32[] calldata _discountProof, bytes memory _providerSignature, string calldata _cid ) external; function attachData(uint256 _subscriptionId, string calldata _dataCid) external; function pauseSubscription(uint256 _subscriptionId) external; function resumeSubscription(uint256 _subscriptionId) external; function cancelSubscription(uint256 _subscriptionId, uint32 _cancelAt) external; function managerCommand(uint256 _subscriptionId, ManagerCommand _command) external; function getSubscription(uint256 _subscriptionId) external view returns (Subscription memory subscription, address currentOwner); function getConsumerSubscription(address _consumer, uint256 _idx) external view returns(uint256); function getConsumerSubscriptionCount(address _consumer) external view returns (uint256); function getProviderSubscription(address _provider, uint256 _idx) external view returns(uint256); function getProviderSubscriptionCount(address _provider, bool _includeCanceled, uint32 _planId) external view returns (uint256); function getActiveSubscriptionCount(address _consumer, address _provider, uint32 _planId) external view returns(uint256); function getPendingPlanChange(uint256 _subscriptionId) external view returns (bytes32); /************************** SUBSCRIPTION EVENTS **************************/ /** @dev Emitted when `consumer` subscribes to `provider` plan `planId` */ event SubscriptionCreated(address indexed consumer, address indexed provider, uint256 indexed subscriptionId, bytes32 ref, uint32 planId, bytes32 discountId); /** @dev Emitted when `consumer` changes the plan to `provider` on subscription `subscriptionId` */ event SubscriptionChangedPlan(address indexed consumer, address indexed provider, uint256 indexed subscriptionId, bytes32 ref, uint32 prevPlanId, uint32 planId, bytes32 discountId); /** @dev Emitted when `consumer` changes the plan to `provider` on subscription `subscriptionId` */ event SubscriptionPendingChangePlan(address indexed consumer, address indexed provider, uint256 indexed subscriptionId, bytes32 ref, uint32 prevPlanId, uint32 planId); /** @dev Emitted when `consumer` initiates a pause of the subscription to `provider` on subscription `subscriptionId` */ event SubscriptionPendingPause(address indexed consumer, address indexed provider, uint256 indexed subscriptionId, bytes32 ref, uint32 planId); /** @dev Emitted when a pending pause subscription attempts to renew but is paused */ event SubscriptionPaused(address indexed consumer, address indexed provider, uint256 indexed subscriptionId, bytes32 ref, uint32 planId); /** @dev Emitted when `consumer` resumes the subscription to `provider` on subscription `subscriptionId` */ event SubscriptionResumed(address indexed consumer, address indexed provider, uint256 indexed subscriptionId, bytes32 ref, uint32 planId); /** @dev Emitted when `consumer` unsubscribes to `provider` on subscription `subscriptionId` */ event SubscriptionPendingCancel(address indexed consumer, address indexed provider, uint256 indexed subscriptionId, bytes32 ref, uint32 planId, uint32 cancelAt); /** @dev Emitted when `consumer` has canceled and the current period is over on subscription `subscriptionId` */ event SubscriptionCanceled(address indexed consumer, address indexed provider, uint256 indexed subscriptionId, bytes32 ref, uint32 planId); /** @dev Emitted when `consumer` successfully renews to `provider` on subscription `subscriptionId` */ event SubscriptionRenewed(address indexed consumer, address indexed provider, uint256 indexed subscriptionId, bytes32 ref, uint32 planId); /** @dev Emitted when `consumer` subscription trial ends and goes active to `provider` * on subscription `subscriptionId` */ event SubscriptionTrialEnded(address indexed consumer, address indexed provider, uint256 indexed subscriptionId, bytes32 ref, uint32 planId); /** @dev Emitted when `consumer` renewal fails to `provider` on subscription `subscriptionId` */ event SubscriptionPastDue(address indexed consumer, address indexed provider, uint256 indexed subscriptionId, bytes32 ref, uint32 planId); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface ICaskSubscriptionPlans { enum PlanStatus { Enabled, Disabled, EndOfLife } enum DiscountType { None, Code, ERC20 } struct Discount { uint256 value; uint32 validAfter; uint32 expiresAt; uint32 maxRedemptions; uint32 planId; uint16 applyPeriods; DiscountType discountType; bool isFixed; } struct Provider { address paymentAddress; uint256 nonce; string cid; } function setProviderProfile(address _paymentAddress, string calldata _cid, uint256 _nonce) external; function getProviderProfile(address _provider) external view returns(Provider memory); function getPlanStatus(address _provider, uint32 _planId) external view returns (PlanStatus); function getPlanEOL(address _provider, uint32 _planId) external view returns (uint32); function disablePlan(uint32 _planId) external; function enablePlan(uint32 _planId) external; function retirePlan(uint32 _planId, uint32 _retireAt) external; function verifyPlan(bytes32 _planData, bytes32 _merkleRoot, bytes32[] calldata _merkleProof) external view returns(bool); function getDiscountRedemptions(address _provider, uint32 _planId, bytes32 _discountId) external view returns(uint256); function verifyAndConsumeDiscount(address _consumer, address _provider, uint32 _planId, bytes32[] calldata _discountProof) external returns(bytes32); function verifyDiscount(address _consumer, address _provider, uint32 _planId, bytes32[] calldata _discountProof) external returns(bytes32); function erc20DiscountCurrentlyApplies(address _consumer, bytes32 _discountValidator) external returns(bool); function verifyProviderSignature(address _provider, uint256 _nonce, bytes32 _planMerkleRoot, bytes32 _discountMerkleRoot, bytes memory _providerSignature) external view returns (bool); function verifyNetworkData(address _network, bytes32 _networkData, bytes memory _networkSignature) external view returns (bool); /** @dev Emitted when `provider` sets their profile info */ event ProviderSetProfile(address indexed provider, address indexed paymentAddress, uint256 nonce, string cid); /** @dev Emitted when `provider` disables a subscription plan */ event PlanDisabled(address indexed provider, uint32 indexed planId); /** @dev Emitted when `provider` enables a subscription plan */ event PlanEnabled(address indexed provider, uint32 indexed planId); /** @dev Emitted when `provider` end-of-lifes a subscription plan */ event PlanRetired(address indexed provider, uint32 indexed planId, uint32 retireAt); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165Upgradeable.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721Upgradeable is IERC165Upgradeable { /** * @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`, 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 be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @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 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); /** * @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; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721ReceiverUpgradeable { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721Upgradeable.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721MetadataUpgradeable is IERC721Upgradeable { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { __Context_init_unchained(); } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library StringsUpgradeable { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable { function __ERC165_init() internal onlyInitializing { __ERC165_init_unchained(); } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/utils/Initializable.sol) pragma solidity ^0.8.0; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() initializer {} * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { // If the contract is initializing we ignore whether _initialized is set in order to support multiple // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the // contract may have been reentered. require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} modifier, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } function _isConstructor() private view returns (bool) { return !AddressUpgradeable.isContract(address(this)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165Upgradeable { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; /** * a contract must implement this interface in order to support relayed transaction. * It is better to inherit the BaseRelayRecipient as its implementation. */ abstract contract IRelayRecipient { /** * return if the forwarder is trusted to forward relayed transactions to us. * the forwarder is required to verify the sender's signature, and verify * the call is not a replay. */ function isTrustedForwarder(address forwarder) public virtual view returns(bool); /** * return the sender of this call. * if the call came through our trusted forwarder, then the real sender is appended as the last 20 bytes * of the msg.data. * otherwise, return `msg.sender` * should be used in the contract anywhere instead of msg.sender */ function _msgSender() internal virtual view returns (address); /** * return the msg.data of this call. * if the call came through our trusted forwarder, then the real sender was appended as the last 20 bytes * of the msg.data - so this method will strip those 20 bytes off. * otherwise (if the call was made directly and not through the forwarder), return `msg.data` * should be used in the contract instead of msg.data, where this difference matters. */ function _msgData() internal virtual view returns (bytes calldata); function versionRecipient() external virtual view returns (string memory); }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"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":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"consumer","type":"address"},{"indexed":true,"internalType":"address","name":"provider","type":"address"},{"indexed":true,"internalType":"uint256","name":"subscriptionId","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"ref","type":"bytes32"},{"indexed":false,"internalType":"uint32","name":"planId","type":"uint32"}],"name":"SubscriptionCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"consumer","type":"address"},{"indexed":true,"internalType":"address","name":"provider","type":"address"},{"indexed":true,"internalType":"uint256","name":"subscriptionId","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"ref","type":"bytes32"},{"indexed":false,"internalType":"uint32","name":"prevPlanId","type":"uint32"},{"indexed":false,"internalType":"uint32","name":"planId","type":"uint32"},{"indexed":false,"internalType":"bytes32","name":"discountId","type":"bytes32"}],"name":"SubscriptionChangedPlan","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"consumer","type":"address"},{"indexed":true,"internalType":"address","name":"provider","type":"address"},{"indexed":true,"internalType":"uint256","name":"subscriptionId","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"ref","type":"bytes32"},{"indexed":false,"internalType":"uint32","name":"planId","type":"uint32"},{"indexed":false,"internalType":"bytes32","name":"discountId","type":"bytes32"}],"name":"SubscriptionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"consumer","type":"address"},{"indexed":true,"internalType":"address","name":"provider","type":"address"},{"indexed":true,"internalType":"uint256","name":"subscriptionId","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"ref","type":"bytes32"},{"indexed":false,"internalType":"uint32","name":"planId","type":"uint32"}],"name":"SubscriptionPastDue","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"consumer","type":"address"},{"indexed":true,"internalType":"address","name":"provider","type":"address"},{"indexed":true,"internalType":"uint256","name":"subscriptionId","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"ref","type":"bytes32"},{"indexed":false,"internalType":"uint32","name":"planId","type":"uint32"}],"name":"SubscriptionPaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"consumer","type":"address"},{"indexed":true,"internalType":"address","name":"provider","type":"address"},{"indexed":true,"internalType":"uint256","name":"subscriptionId","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"ref","type":"bytes32"},{"indexed":false,"internalType":"uint32","name":"planId","type":"uint32"},{"indexed":false,"internalType":"uint32","name":"cancelAt","type":"uint32"}],"name":"SubscriptionPendingCancel","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"consumer","type":"address"},{"indexed":true,"internalType":"address","name":"provider","type":"address"},{"indexed":true,"internalType":"uint256","name":"subscriptionId","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"ref","type":"bytes32"},{"indexed":false,"internalType":"uint32","name":"prevPlanId","type":"uint32"},{"indexed":false,"internalType":"uint32","name":"planId","type":"uint32"}],"name":"SubscriptionPendingChangePlan","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"consumer","type":"address"},{"indexed":true,"internalType":"address","name":"provider","type":"address"},{"indexed":true,"internalType":"uint256","name":"subscriptionId","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"ref","type":"bytes32"},{"indexed":false,"internalType":"uint32","name":"planId","type":"uint32"}],"name":"SubscriptionPendingPause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"consumer","type":"address"},{"indexed":true,"internalType":"address","name":"provider","type":"address"},{"indexed":true,"internalType":"uint256","name":"subscriptionId","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"ref","type":"bytes32"},{"indexed":false,"internalType":"uint32","name":"planId","type":"uint32"}],"name":"SubscriptionRenewed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"consumer","type":"address"},{"indexed":true,"internalType":"address","name":"provider","type":"address"},{"indexed":true,"internalType":"uint256","name":"subscriptionId","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"ref","type":"bytes32"},{"indexed":false,"internalType":"uint32","name":"planId","type":"uint32"}],"name":"SubscriptionResumed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"consumer","type":"address"},{"indexed":true,"internalType":"address","name":"provider","type":"address"},{"indexed":true,"internalType":"uint256","name":"subscriptionId","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"ref","type":"bytes32"},{"indexed":false,"internalType":"uint32","name":"planId","type":"uint32"}],"name":"SubscriptionTrialEnded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_subscriptionId","type":"uint256"},{"internalType":"string","name":"_dataCid","type":"string"}],"name":"attachData","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_subscriptionId","type":"uint256"},{"internalType":"uint32","name":"_cancelAt","type":"uint32"}],"name":"cancelSubscription","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_subscriptionId","type":"uint256"},{"internalType":"uint256","name":"_nonce","type":"uint256"},{"internalType":"bytes32[]","name":"_planProof","type":"bytes32[]"},{"internalType":"bytes32[]","name":"_discountProof","type":"bytes32[]"},{"internalType":"bytes","name":"_providerSignature","type":"bytes"},{"internalType":"string","name":"_cid","type":"string"}],"name":"changeSubscriptionPlan","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_nonce","type":"uint256"},{"internalType":"bytes32[]","name":"_planProof","type":"bytes32[]"},{"internalType":"bytes32[]","name":"_discountProof","type":"bytes32[]"},{"internalType":"bytes32","name":"_networkData","type":"bytes32"},{"internalType":"uint32","name":"_cancelAt","type":"uint32"},{"internalType":"bytes","name":"_providerSignature","type":"bytes"},{"internalType":"bytes","name":"_networkSignature","type":"bytes"},{"internalType":"string","name":"_cid","type":"string"}],"name":"createNetworkSubscription","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_nonce","type":"uint256"},{"internalType":"bytes32[]","name":"_planProof","type":"bytes32[]"},{"internalType":"bytes32[]","name":"_discountProof","type":"bytes32[]"},{"internalType":"uint32","name":"_cancelAt","type":"uint32"},{"internalType":"bytes","name":"_providerSignature","type":"bytes"},{"internalType":"string","name":"_cid","type":"string"}],"name":"createSubscription","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_consumer","type":"address"},{"internalType":"address","name":"_provider","type":"address"},{"internalType":"uint32","name":"_planId","type":"uint32"}],"name":"getActiveSubscriptionCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_consumer","type":"address"},{"internalType":"uint256","name":"_idx","type":"uint256"}],"name":"getConsumerSubscription","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_consumer","type":"address"}],"name":"getConsumerSubscriptionCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_subscriptionId","type":"uint256"}],"name":"getPendingPlanChange","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_provider","type":"address"},{"internalType":"uint256","name":"_idx","type":"uint256"}],"name":"getProviderSubscription","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_provider","type":"address"},{"internalType":"bool","name":"_includeCanceled","type":"bool"},{"internalType":"uint32","name":"_planId","type":"uint32"}],"name":"getProviderSubscriptionCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_subscriptionId","type":"uint256"}],"name":"getSubscription","outputs":[{"components":[{"internalType":"bytes32","name":"planData","type":"bytes32"},{"internalType":"bytes32","name":"networkData","type":"bytes32"},{"internalType":"bytes32","name":"discountId","type":"bytes32"},{"internalType":"bytes32","name":"discountData","type":"bytes32"},{"internalType":"bytes32","name":"ref","type":"bytes32"},{"internalType":"address","name":"provider","type":"address"},{"internalType":"enum ICaskSubscriptions.SubscriptionStatus","name":"status","type":"uint8"},{"internalType":"uint32","name":"planId","type":"uint32"},{"internalType":"uint32","name":"createdAt","type":"uint32"},{"internalType":"uint32","name":"renewAt","type":"uint32"},{"internalType":"uint32","name":"minTermAt","type":"uint32"},{"internalType":"uint32","name":"cancelAt","type":"uint32"},{"internalType":"string","name":"cid","type":"string"},{"internalType":"string","name":"dataCid","type":"string"}],"internalType":"struct ICaskSubscriptions.Subscription","name":"subscription","type":"tuple"},{"internalType":"address","name":"currentOwner","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_subscriptionPlans","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"forwarder","type":"address"}],"name":"isTrustedForwarder","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_subscriptionId","type":"uint256"},{"internalType":"enum ICaskSubscriptions.ManagerCommand","name":"_command","type":"uint8"}],"name":"managerCommand","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_subscriptionId","type":"uint256"}],"name":"pauseSubscription","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_subscriptionId","type":"uint256"}],"name":"resumeSubscription","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_subscriptionManager","type":"address"}],"name":"setManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_forwarder","type":"address"}],"name":"setTrustedForwarder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"subscriptionManager","outputs":[{"internalType":"contract ICaskSubscriptionManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"subscriptionPlans","outputs":[{"internalType":"contract ICaskSubscriptionPlans","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_subscriptionId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"trustedForwarder","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"versionRecipient","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b50600054610100900460ff166200002f5760005460ff161562000039565b62000039620000de565b620000a15760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840160405180910390fd5b600054610100900460ff16158015620000c4576000805461ffff19166101011790555b8015620000d7576000805461ff00191690555b5062000102565b6000620000f630620000fc60201b620029cc1760201c565b15905090565b3b151590565b615a0f80620001126000396000f3fe608060405234801561001057600080fd5b506004361061025e5760003560e01c80637df7b2aa11610146578063b88d4fde116100c3578063d0ebdbe711610087578063d0ebdbe714610557578063d67dc0de1461056a578063da742228146105b3578063dc311dd3146105c6578063e985e9c5146105e7578063f2fde38b1461062357600080fd5b8063b88d4fde146104ea578063bf158fd2146104fd578063c4d66de814610510578063c86e695414610523578063c87b56dd1461054457600080fd5b80638fe17b161161010a5780638fe17b1614610496578063925fa591146104a957806395d89b41146104bc578063a22cb465146104c4578063ac58e37b146104d757600080fd5b80637df7b2aa14610444578063825527ff146104575780638456cb591461046a578063876bebbb146104725780638da5cb5b1461048557600080fd5b806342842e0e116101df5780635c975abb116101a35780635c975abb146103e75780636352211e146103f257806370a0823114610405578063715018a61461041857806374c14439146104205780637da0a8771461043357600080fd5b806342842e0e1461036b57806345041a461461037e578063486ff0cd146103915780634d5106ae146103b2578063572b6c05146103c557600080fd5b806323b872dd1161022657806323b872dd146102f3578063291b9a3f1461030657806336fd3a8a1461033d5780633f4ba83a1461035057806341f23f0a1461035857600080fd5b806301ffc9a714610263578063023a584e1461028b57806306fdde03146102a0578063081812fc146102b5578063095ea7b3146102e0575b600080fd5b610276610271366004614c1c565b610636565b60405190151581526020015b60405180910390f35b61029e610299366004614c39565b610688565b005b6102a8610ad4565b6040516102829190614caa565b6102c86102c3366004614c39565b610b66565b6040516001600160a01b039091168152602001610282565b61029e6102ee366004614cd9565b610bfb565b61029e610301366004614d03565b610d23565b61032f610314366004614d3f565b6001600160a01b0316600090815260fe602052604090205490565b604051908152602001610282565b61032f61034b366004614cd9565b610d5b565b61029e610d98565b61029e610366366004614c39565b610deb565b61029e610379366004614d03565b611084565b61029e61038c366004614da3565b61109f565b6040805180820190915260058152640322e322e360dc1b60208201526102a8565b61029e6103c0366004614eeb565b6111b7565b6102766103d3366004614d3f565b6065546001600160a01b0391821691161490565b60ca5460ff16610276565b6102c8610400366004614c39565b6111f7565b61032f610413366004614d3f565b61126e565b61029e6112f5565b61032f61042e366004614fd7565b611348565b6065546001600160a01b03166102c8565b61029e61045236600461501c565b6113d0565b61029e610465366004615050565b611c29565b61029e611c8d565b61032f610480366004614cd9565b611cde565b6098546001600160a01b03166102c8565b60fd546102c8906001600160a01b031681565b61029e6104b7366004615160565b611d09565b6102a86120c0565b61029e6104d236600461518c565b6120cf565b61029e6104e53660046151b8565b6120e1565b61029e6104f8366004615246565b612156565b60fc546102c8906001600160a01b031681565b61029e61051e366004614d3f565b61218f565b61032f610531366004614c39565b6000908152610100602052604090205490565b6102a8610552366004614c39565b6122c7565b61029e610565366004614d3f565b612581565b61032f6105783660046152ae565b6001600160a01b0392831660009081526101046020908152604080832094909516825292835283812063ffffffff9290921681529152205490565b61029e6105c1366004614d3f565b6125ec565b6105d96105d4366004614c39565b612656565b604051610282929190615312565b6102766105f5366004615450565b6001600160a01b039182166000908152606b6020908152604080832093909416825291909152205460ff1690565b61029e610631366004614d3f565b612915565b60006001600160e01b031982166380ac58cd60e01b148061066757506001600160e01b03198216635b5e139f60e01b145b8061068257506301ffc9a760e01b6001600160e01b03198316145b92915050565b80610692816111f7565b6001600160a01b03166106a36129d2565b6001600160a01b0316146106d25760405162461bcd60e51b81526004016106c99061547a565b60405180910390fd5b60ca5460ff16156106f55760405162461bcd60e51b81526004016106c990615499565b600082815260ff6020526040902060036005820154600160a01b900460ff166006811115610725576107256152da565b1480610750575060066005820154600160a01b900460ff16600681111561074e5761074e6152da565b145b61078a5760405162461bcd60e51b815260206004820152600b60248201526a085393d517d4105554d15160aa1b60448201526064016106c9565b600581015483906001600160a01b03166107a3826111f7565b6004840154600585015460408051928352600160a81b90910463ffffffff1660208301526001600160a01b0392909216917f7ee0fc3eab7021686f891346ebbf5bab192d6f9995fcc66021f4551888dc1481910160405180910390a460066005820154600160a01b900460ff166006811115610821576108216152da565b141561083f57600501805460ff60a01b1916600160a11b1790555050565b600061084e82600001546129e1565b9050806080015163ffffffff16600014806108a15750608081015160058301546001600160a01b03166000908152610103602090815260408083208286015163ffffffff90811685529252909120549116115b6108db5760405162461bcd60e51b815260206004820152600b60248201526a214d41585f41435449564560a81b60448201526064016106c9565b600582018054600160a11b60ff60a01b198216179091556001600160a01b031660009081526101026020526040812080546001929061091b9084906154d9565b909155505060058201546001600160a01b038116600090815261010360209081526040808320600160a81b90940463ffffffff1683529290529081208054600192906109689084906154d9565b9091555060019050610104600061097e876111f7565b6001600160a01b03908116825260208083019390935260409182016000908120600588015492831682528452828120600160a81b90920463ffffffff1681529252812080549091906109d19084906154d9565b9091555050600682015463ffffffff42811691161015610a035760068201805463ffffffff19164263ffffffff161790555b60fc5460405163d71bb37b60e01b8152600481018690526001600160a01b039091169063d71bb37b90602401600060405180830381600087803b158015610a4957600080fd5b505af1158015610a5d573d6000803e3d6000fd5b5060029250610a6a915050565b6005830154600160a01b900460ff166006811115610a8a57610a8a6152da565b14610acd5760405162461bcd60e51b815260206004820152601360248201527221494e53554646494349454e545f46554e445360681b60448201526064016106c9565b50505b5050565b606060668054610ae3906154f1565b80601f0160208091040260200160405190810160405280929190818152602001828054610b0f906154f1565b8015610b5c5780601f10610b3157610100808354040283529160200191610b5c565b820191906000526020600020905b815481529060010190602001808311610b3f57829003601f168201915b5050505050905090565b6000818152606860205260408120546001600160a01b0316610bdf5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016106c9565b506000908152606a60205260409020546001600160a01b031690565b6000610c06826111f7565b9050806001600160a01b0316836001600160a01b03161415610c745760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084016106c9565b806001600160a01b0316610c866129d2565b6001600160a01b03161480610ca25750610ca2816105f56129d2565b610d145760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c000000000000000060648201526084016106c9565b610d1e8383612abc565b505050565b610d34610d2e6129d2565b82612b2a565b610d505760405162461bcd60e51b81526004016106c99061552c565b610d1e838383612c21565b6001600160a01b038216600090815260fe60205260408120805483908110610d8557610d8561557d565b9060005260206000200154905092915050565b610da06129d2565b6001600160a01b0316610dbb6098546001600160a01b031690565b6001600160a01b031614610de15760405162461bcd60e51b81526004016106c990615593565b610de9612dcc565b565b80610df5816111f7565b6001600160a01b0316610e066129d2565b6001600160a01b03161480610e445750600081815260ff60205260409020600501546001600160a01b0316610e396129d2565b6001600160a01b0316145b610e605760405162461bcd60e51b81526004016106c99061547a565b60ca5460ff1615610e835760405162461bcd60e51b81526004016106c990615499565b600082815260ff6020526040902060036005820154600160a01b900460ff166006811115610eb357610eb36152da565b14158015610ee05750600580820154600160a01b900460ff166006811115610edd57610edd6152da565b14155b8015610f0c575060046005820154600160a01b900460ff166006811115610f0957610f096152da565b14155b8015610f38575060016005820154600160a01b900460ff166006811115610f3557610f356152da565b14155b610f545760405162461bcd60e51b81526004016106c9906155c8565b6006810154600160201b900463ffffffff161580610f885750600681015463ffffffff600160201b90910481164290911610155b610fa45760405162461bcd60e51b81526004016106c9906155f2565b6000610fb382600001546129e1565b90508060e00151610ff65760405162461bcd60e51b815260206004820152600d60248201526c214e4f545f5041555341424c4560981b60448201526064016106c9565b600582018054600360a11b60ff60a01b1982161790915584906001600160a01b0316611021826111f7565b6004850154600586015460408051928352600160a81b90910463ffffffff1660208301526001600160a01b0392909216917f3b1ababbfb41865093a096e886e08d3058f1adbce6c29e7be7ed6fd16b70802891015b60405180910390a450505050565b610d1e83838360405180602001604052806000815250612156565b826110a9816111f7565b6001600160a01b03166110ba6129d2565b6001600160a01b031614806110f85750600081815260ff60205260409020600501546001600160a01b03166110ed6129d2565b6001600160a01b0316145b6111145760405162461bcd60e51b81526004016106c99061547a565b60ca5460ff16156111375760405162461bcd60e51b81526004016106c990615499565b600084815260ff6020526040902060046005820154600160a01b900460ff166006811115611167576111676152da565b14156111a15760405162461bcd60e51b81526020600482015260096024820152680850d05390d153115160ba1b60448201526064016106c9565b6111af600882018585614af9565b505050505050565b60ca5460ff16156111da5760405162461bcd60e51b81526004016106c990615499565b6111eb898989898989898989612e65565b50505050505050505050565b6000818152606860205260408120546001600160a01b0316806106825760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b60648201526084016106c9565b60006001600160a01b0382166112d95760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b60648201526084016106c9565b506001600160a01b031660009081526069602052604090205490565b6112fd6129d2565b6001600160a01b03166113186098546001600160a01b031690565b6001600160a01b03161461133e5760405162461bcd60e51b81526004016106c990615593565b610de9600061360e565b6000821561137057506001600160a01b038316600090815261010160205260409020546113c9565b63ffffffff8216156113ad57506001600160a01b03831660009081526101036020908152604080832063ffffffff851684529091529020546113c9565b506001600160a01b038316600090815261010260205260409020545b9392505050565b60fc546001600160a01b03166113e46129d2565b6001600160a01b03161461140a5760405162461bcd60e51b81526004016106c99061547a565b60ca5460ff161561142d5760405162461bcd60e51b81526004016106c990615499565b600082815260ff60205260409020426001836006811115611450576114506152da565b14156115e95760008481526101006020526040902054806114b35760405162461bcd60e51b815260206004820152601960248201527f21494e56414c49442870656e64696e67506c616e44617461290000000000000060448201526064016106c9565b60006114be826129e1565b600585015490915086906001600160a01b03166114da826111f7565b6004870154600588015460208087015160028b01546040805195865263ffffffff600160a81b90950485169386019390935292169083015260608201526001600160a01b0391909116907fe17e61be0a4aac2f0b6fece72cedc2ab9ca554634d5af864a9282095206a0c2b9060800160405180910390a4602081015160058501805463ffffffff909216600160a81b0263ffffffff60a81b1990921691909117905581845560a081015161ffff16156115d2578060a0015161ffff1681604001516115a59190615615565b6115af9084615641565b8460060160046101000a81548163ffffffff021916908363ffffffff1602179055505b505060008481526101006020526040812055610acd565b60028360068111156115fd576115fd6152da565b14156117db57600582018054600160a21b60ff60a01b198216179091556001600160a01b0316600090815261010260205260408120805460019290611643908490615669565b909155505060058201546001600160a01b038116600090815261010360209081526040808320600160a81b90940463ffffffff168352929052908120805460019290611690908490615669565b9091555060009050610104816116a5876111f7565b6001600160a01b03908116825260208083019390935260409182016000908120600588015492831682528452828120600160a81b90920463ffffffff1681529252902054111561175857600161010460006116ff876111f7565b6001600160a01b03908116825260208083019390935260409182016000908120600588015492831682528452828120600160a81b90920463ffffffff168152925281208054909190611752908490615669565b90915550505b600582015484906001600160a01b0316611771826111f7565b6004850154600586015460408051928352600160a81b90910463ffffffff1660208301526001600160a01b0392909216917f58e4414596fd750dbb9dabfe65b97bf5add2061f5902f34e2b82a9c25bd79f98910160405180910390a46117d684613660565b610acd565b60068360068111156117ef576117ef6152da565b14156119c557600582018054600360a01b60ff60a01b198216179091556001600160a01b0316600090815261010260205260408120805460019290611835908490615669565b909155505060058201546001600160a01b038116600090815261010360209081526040808320600160a81b90940463ffffffff168352929052908120805460019290611882908490615669565b909155506000905061010481611897876111f7565b6001600160a01b03908116825260208083019390935260409182016000908120600588015492831682528452828120600160a81b90920463ffffffff1681529252902054111561194a57600161010460006118f1876111f7565b6001600160a01b03908116825260208083019390935260409182016000908120600588015492831682528452828120600160a81b90920463ffffffff168152925281208054909190611944908490615669565b90915550505b600582015484906001600160a01b0316611963826111f7565b6004850154600586015460408051928352600160a81b90910463ffffffff1660208301526001600160a01b0392909216917f7afd3b59e582bb56b590409b808e910ae787056cb10b682b9bdefa44c8eb940d91015b60405180910390a4610acd565b60038360068111156119d9576119d96152da565b1415611a6357600582018054600560a01b60ff60a01b1982161790915584906001600160a01b0316611a0a826111f7565b6004850154600586015460408051928352600160a81b90910463ffffffff1660208301526001600160a01b0392909216917f44abb4f4529fdbcacc1ee98eef9318eaf9a12044d6925a2dc2c702959d9352f191016119b8565b6004836006811115611a7757611a776152da565b1415611bfb576000611a8c83600001546129e1565b905060016005840154600160a01b900460ff166006811115611ab057611ab06152da565b1415611b2c57600583015485906001600160a01b0316611acf826111f7565b6004860154600587015460408051928352600160a81b90910463ffffffff1660208301526001600160a01b0392909216917ff42e506093cb49dad3d3349cf7a2b390140be665daecb2c820e903afd12b1df7910160405180910390a45b60408101516006840154611b46919063ffffffff16615641565b60068401805463ffffffff191663ffffffff9283169081179091559083161015611b805760058301805460ff60a01b1916600160a11b1790555b600583015485906001600160a01b0316611b99826111f7565b6004860154600587015460408051928352600160a81b90910463ffffffff1660208301526001600160a01b0392909216917fcdd2eee203a384f2c6e81f39021f7e3ebef3a21ccd0d0f6dd117387ab61b6b54910160405180910390a450610acd565b6005836006811115611c0f57611c0f6152da565b1415610acd57600060028301819055600383015550505050565b60ca5460ff1615611c4c5760405162461bcd60e51b81526004016106c990615499565b6000611c5f8c8c8c8c8c8b8b8a8a612e65565b9050611c6b8785613707565b50600090815260ff602052604090206001019590955550505050505050505050565b611c956129d2565b6001600160a01b0316611cb06098546001600160a01b031690565b6001600160a01b031614611cd65760405162461bcd60e51b81526004016106c990615593565b610de9613821565b6001600160a01b038216600090815261010160205260408120805483908110610d8557610d8561557d565b81611d13816111f7565b6001600160a01b0316611d246129d2565b6001600160a01b03161480611d625750600081815260ff60205260409020600501546001600160a01b0316611d576129d2565b6001600160a01b0316145b611d7e5760405162461bcd60e51b81526004016106c99061547a565b60ca5460ff1615611da15760405162461bcd60e51b81526004016106c990615499565b600083815260ff6020526040902060046005820154600160a01b900460ff166006811115611dd157611dd16152da565b1415611def5760405162461bcd60e51b81526004016106c9906155c8565b4263ffffffff8416611edd57611e04856111f7565b6001600160a01b0316611e156129d2565b6001600160a01b031614611e3b5760405162461bcd60e51b81526004016106c99061547a565b60068201805463ffffffff60401b1916600160401b63ffffffff871602179055600582015485906001600160a01b0316611e74826111f7565b6004850154600586015460408051928352600160a81b90910463ffffffff9081166020840152891682820152516001600160a01b0392909216917fc54424be96a88104b924830a25713de0140a7b7048d7a26370e735b421b057869181900360600190a46120b9565b8063ffffffff168463ffffffff1611611fcc576006820154600160201b900463ffffffff161580611f235750600682015463ffffffff600160201b909104811690821610155b611f3f5760405162461bcd60e51b81526004016106c9906155f2565b600682018054600160401b63ffffffff84169081026bffffffff00000000ffffffff199092161717905560fc5460405163d71bb37b60e01b8152600481018790526001600160a01b039091169063d71bb37b90602401600060405180830381600087803b158015611faf57600080fd5b505af1158015611fc3573d6000803e3d6000fd5b505050506120b9565b6006820154600160201b900463ffffffff161580611fff5750600682015463ffffffff600160201b909104811690851610155b61201b5760405162461bcd60e51b81526004016106c9906155f2565b60068201805463ffffffff60401b1916600160401b63ffffffff871602179055600582015485906001600160a01b0316612054826111f7565b6004850154600586015460408051928352600160a81b90910463ffffffff9081166020840152891682820152516001600160a01b0392909216917fc54424be96a88104b924830a25713de0140a7b7048d7a26370e735b421b057869181900360600190a45b5050505050565b606060678054610ae3906154f1565b610ad06120da6129d2565b838361387a565b886120eb816111f7565b6001600160a01b03166120fc6129d2565b6001600160a01b0316146121225760405162461bcd60e51b81526004016106c99061547a565b60ca5460ff16156121455760405162461bcd60e51b81526004016106c990615499565b6111eb8a8a8a8a8a8a8a8a8a613949565b6121676121616129d2565b83612b2a565b6121835760405162461bcd60e51b81526004016106c99061552c565b610acd84848484613d11565b600054610100900460ff166121aa5760005460ff16156121ae565b303b155b6122115760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016106c9565b600054610100900460ff16158015612233576000805461ffff19166101011790555b61223b613d44565b612243613d7b565b612297604051806040016040528060128152602001714361736b20537562736372697074696f6e7360701b815250604051806040016040528060088152602001674341534b5355425360c01b815250613db2565b60fd80546001600160a01b0319166001600160a01b0384161790558015610ad0576000805461ff00191690555050565b6000818152606860205260409020546060906001600160a01b03166123465760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084016106c9565b600082815260ff6020818152604080842081516101c08101835281548152600182015493810193909352600281015491830191909152600381015460608301526004810154608083015260058101546001600160a01b03811660a08401529192909160c0840191600160a01b9091041660068111156123c7576123c76152da565b60068111156123d8576123d86152da565b8152600582015463ffffffff600160a81b820481166020840152600160c81b9091048116604083015260068301548082166060840152600160201b810482166080840152600160401b90041660a082015260078201805460c09092019161243e906154f1565b80601f016020809104026020016040519081016040528092919081815260200182805461246a906154f1565b80156124b75780601f1061248c576101008083540402835291602001916124b7565b820191906000526020600020905b81548152906001019060200180831161249a57829003601f168201915b505050505081526020016008820180546124d0906154f1565b80601f01602080910402602001604051908101604052809291908181526020018280546124fc906154f1565b80156125495780601f1061251e57610100808354040283529160200191612549565b820191906000526020600020905b81548152906001019060200180831161252c57829003601f168201915b505050505081525050905080610180015160405160200161256a9190615680565b604051602081830303815290604052915050919050565b6125896129d2565b6001600160a01b03166125a46098546001600160a01b031690565b6001600160a01b0316146125ca5760405162461bcd60e51b81526004016106c990615593565b60fc80546001600160a01b0319166001600160a01b0392909216919091179055565b6125f46129d2565b6001600160a01b031661260f6098546001600160a01b031690565b6001600160a01b0316146126355760405162461bcd60e51b81526004016106c990615593565b606580546001600160a01b0319166001600160a01b03831617905550565b50565b604080516101c08101825260008082526020820181905291810182905260608082018390526080820183905260a0820183905260c0820183905260e0820183905261010082018390526101208201839052610140820183905261016082019290925261018081018290526101a0810191909152600082815260ff6020818152604080842081516101c08101835281548152600182015493810193909352600281015491830191909152600381015460608301526004810154608083015260058101546001600160a01b03811660a08401529192909160c0840191600160a01b90910416600681111561274a5761274a6152da565b600681111561275b5761275b6152da565b8152600582015463ffffffff600160a81b820481166020840152600160c81b9091048116604083015260068301548082166060840152600160201b810482166080840152600160401b90041660a082015260078201805460c0909201916127c1906154f1565b80601f01602080910402602001604051908101604052809291908181526020018280546127ed906154f1565b801561283a5780601f1061280f5761010080835404028352916020019161283a565b820191906000526020600020905b81548152906001019060200180831161281d57829003601f168201915b50505050508152602001600882018054612853906154f1565b80601f016020809104026020016040519081016040528092919081815260200182805461287f906154f1565b80156128cc5780601f106128a1576101008083540402835291602001916128cc565b820191906000526020600020905b8154815290600101906020018083116128af57829003601f168201915b50505050508152505091506128f8836000908152606860205260409020546001600160a01b0316151590565b1561290d57612906836111f7565b9050915091565b506000915091565b61291d6129d2565b6001600160a01b03166129386098546001600160a01b031690565b6001600160a01b03161461295e5760405162461bcd60e51b81526004016106c990615593565b6001600160a01b0381166129c35760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016106c9565b6126538161360e565b3b151590565b60006129dc613df3565b905090565b6040805161012081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e0810182905261010081019190915250604080516101208101825260a083811c8252608084811c63ffffffff908116602080860191909152606087811c8316868801529587901c8216958501959095529385901c90931692820192909252601083901c61ffff1691810191909152600882901c60ff1660c082015260f89190911b600160f81b8181161460e0830152600160f91b9081161461010082015290565b6000818152606a6020526040902080546001600160a01b0319166001600160a01b0384169081179091558190612af1826111f7565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152606860205260408120546001600160a01b0316612ba35760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016106c9565b6000612bae836111f7565b9050806001600160a01b0316846001600160a01b03161480612be95750836001600160a01b0316612bde84610b66565b6001600160a01b0316145b80612c1957506001600160a01b038082166000908152606b602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b0316612c34826111f7565b6001600160a01b031614612c9c5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b60648201526084016106c9565b6001600160a01b038216612cfe5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016106c9565b612d09838383613e27565b612d14600082612abc565b6001600160a01b0383166000908152606960205260408120805460019290612d3d908490615669565b90915550506001600160a01b0382166000908152606960205260408120805460019290612d6b9084906154d9565b909155505060008181526068602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60ca5460ff16612e155760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016106c9565b60ca805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa612e486129d2565b6040516001600160a01b03909116815260200160405180910390a1565b60006004881015612eb15760405162461bcd60e51b815260206004820152601660248201527521494e56414c494428706c616e50726f6f664c656e2960501b60448201526064016106c9565b600060038710612f1a57612f138a8a6000818110612ed157612ed161557d565b905060200201358c8c8c6003818110612eec57612eec61557d565b905060200201358b8b6002818110612f0657612f0661557d565b9050602002013589613f51565b9050612f5f565b612f5c8a8a6000818110612f3057612f3061557d565b905060200201358c8c8c6003818110612f4b57612f4b61557d565b905060200201356000801b89613f51565b90505b612f698a8a61402b565b612f855760405162461bcd60e51b81526004016106c9906156af565b6000612fa98b8b6002818110612f9d57612f9d61557d565b905060200201356129e1565b905060006130038c8c6000818110612fc357612fc361557d565b905060200201358d8d6001818110612fdd57612fdd61557d565b905060200201358e8e6002818110612ff757612ff761557d565b905060200201356140f2565b9050816080015163ffffffff1660001480613052575060808201516001600160a01b0384166000908152610103602090815260408083208287015163ffffffff90811685529252909120549116115b61308c5760405162461bcd60e51b815260206004820152600b60248201526a214d41585f41435449564560a81b60448201526064016106c9565b600060fd54602084015160405163b6ab359f60e01b81526001600160a01b03878116600483015263ffffffff909216602482015291169063b6ab359f9060440160206040518083038186803b1580156130e457600080fd5b505afa1580156130f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061311c91906156dc565b600281111561312d5761312d6152da565b146131695760405162461bcd60e51b815260206004820152600c60248201526b085393d517d153905093115160a21b60448201526064016106c9565b61317a6131746129d2565b8261415d565b600081815260ff602090815260409091206005810180549285015163ffffffff16600160a81b02600164ffffffff0160a01b03199093166001600160a01b0387161792909217909155428d8d60018181106131d7576131d761557d565b60200291909101356004840155508d8d60028181106131f8576131f861557d565b602002919091013583555060068201805463ffffffff60401b1916600160401b63ffffffff8d1602179055613231600783018989614af9565b5060058201805463ffffffff60c81b1916600160c81b63ffffffff84160217905560a084015161ffff16156132a5578360a0015161ffff1684604001516132789190615615565b6132829082615641565b8260060160046101000a81548163ffffffff021916908363ffffffff1602179055505b83516132d45760058201805460ff60a01b1916600160a11b17905560068201805463ffffffff19169055613356565b606084015163ffffffff16156133295760058201805460ff60a01b1916600160a01b17905560608401516133089082615641565b60068301805463ffffffff191663ffffffff92909216919091179055613356565b60058201805460ff60a01b1916600160a11b17905560068201805463ffffffff191663ffffffff83161790555b60fe60006133626129d2565b6001600160a01b03908116825260208083019390935260409182016000908120805460018181018355918352858320018890559189168082526101018552838220805480850182559083528583200188905581526101029093529082208054919290916133d09084906154d9565b90915550506001600160a01b0385166000908152610103602090815260408083208783015163ffffffff16845290915281208054600192906134139084906154d9565b909155506001905061010460006134286129d2565b6001600160a01b03908116825260208083019390935260409182016000908120918a1681529083528181208884015163ffffffff168252909252812080549091906134749084906154d9565b909155506134a39050613486846111f7565b600584015460208701516001600160a01b03909116908f8f614177565b6003840155600283015560fc5460405163d71bb37b60e01b8152600481018590526001600160a01b039091169063d71bb37b90602401600060405180830381600087803b1580156134f357600080fd5b505af1158015613507573d6000803e3d6000fd5b5060029250613514915050565b6005830154600160a01b900460ff166006811115613534576135346152da565b148061355f575060016005830154600160a01b900460ff16600681111561355d5761355d6152da565b145b61357b5760405162461bcd60e51b81526004016106c9906156fd565b600582015483906001600160a01b0316613594826111f7565b60048501546005860154600287015460408051938452600160a81b90920463ffffffff166020840152908201526001600160a01b0391909116907f9fb45eab820cdd481e286e8c699e1c01031bb833c58f7cfba3ca8d1db6d98d819060600160405180910390a450909d9c50505050505050505050505050565b609880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600061366b826111f7565b905061367981600084613e27565b613684600083612abc565b6001600160a01b03811660009081526069602052604081208054600192906136ad908490615669565b909155505060008281526068602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6000806137468460408051808201909152600080825260208201525060408051808201909152606082901c815260509190911c61ffff16602082015290565b60fd548151604051635f45879f60e11b81529293506001600160a01b039091169163be8b0f3e9161377d9188908890600401615725565b60206040518083038186803b15801561379557600080fd5b505afa1580156137a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137cd9190615755565b6138195760405162461bcd60e51b815260206004820152601a60248201527f21494e56414c4944286e6574776f726b5369676e61747572652900000000000060448201526064016106c9565b519392505050565b60ca5460ff16156138445760405162461bcd60e51b81526004016106c990615499565b60ca805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258612e486129d2565b816001600160a01b0316836001600160a01b031614156138dc5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016106c9565b6001600160a01b038381166000818152606b6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b600486101561396a5760405162461bcd60e51b81526004016106c9906156af565b600089815260ff60205260409020600681015463ffffffff16158061399b5750600681015463ffffffff4281169116115b6139d75760405162461bcd60e51b815260206004820152600d60248201526c085391515117d491539155d053609a1b60448201526064016106c9565b60026005820154600160a01b900460ff1660068111156139f9576139f96152da565b1480613a24575060016005820154600160a01b900460ff166006811115613a2257613a226152da565b145b613a405760405162461bcd60e51b81526004016106c9906155c8565b600060038610613a9c57613a9589896000818110613a6057613a6061557d565b905060200201358b8b8b6003818110613a7b57613a7b61557d565b905060200201358a8a6002818110612f0657612f0661557d565b9050613ad0565b613acd89896000818110613ab257613ab261557d565b905060200201358b8b8b6003818110612f4b57612f4b61557d565b90505b613ada898961402b565b613af65760405162461bcd60e51b81526004016106c9906156af565b6000613b0e8a8a6002818110612f9d57612f9d61557d565b60058401549091506001600160a01b03838116911614613b655760405162461bcd60e51b815260206004820152601260248201527121494e56414c49442870726f76696465722960701b60448201526064016106c9565b613b73600784018686614af9565b506002830154158015613b87575060038710155b8015613ba95750600088888281613ba057613ba061557d565b90506020020135115b15613be257613bd7613bba8d6111f7565b600585015460208401516001600160a01b03909116908b8b614177565b600385015560028401555b60208101516005840154600160a81b900463ffffffff908116911614613d0357600060fd54602083015160405163b6ab359f60e01b81526001600160a01b03868116600483015263ffffffff909216602482015291169063b6ab359f9060440160206040518083038186803b158015613c5a57600080fd5b505afa158015613c6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613c9291906156dc565b6002811115613ca357613ca36152da565b14613cdf5760405162461bcd60e51b815260206004820152600c60248201526b085393d517d153905093115160a21b60448201526064016106c9565b613d038c828c8c6002818110613cf757613cf761557d565b90506020020135614263565b505050505050505050505050565b613d1c848484612c21565b613d28848484846143ac565b610acd5760405162461bcd60e51b81526004016106c990615772565b600054610100900460ff16613d6b5760405162461bcd60e51b81526004016106c9906157c4565b613d736144c0565b610de96144e7565b600054610100900460ff16613da25760405162461bcd60e51b81526004016106c9906157c4565b613daa6144c0565b610de961451e565b600054610100900460ff16613dd95760405162461bcd60e51b81526004016106c9906157c4565b613de16144c0565b613de96144c0565b610ad08282614551565b600060143610801590613e1057506065546001600160a01b031633145b15613e22575060131936013560601c90565b503390565b6001600160a01b03831615801590613e4757506001600160a01b03821615155b15610d1e57600081815260ff602052604081208054909190613e68906129e1565b9050806101000151613eb15760405162461bcd60e51b8152602060048201526012602482015271214e4f545f5452414e534645525241424c4560701b60448201526064016106c9565b6006820154600160201b900463ffffffff161580613ee55750600682015463ffffffff600160201b90910481164290911610155b613f015760405162461bcd60e51b81526004016106c9906155f2565b50600601805463ffffffff60401b19811663ffffffff909116600160401b021790556001600160a01b0391909116600090815260fe60209081526040822080546001810182559083529120015550565b60fd54604051630fe22db160e31b81526000916001600160a01b0380891692911690637f116d8890613f8f9084908a908a908a908a9060040161580f565b60206040518083038186803b158015613fa757600080fd5b505afa158015613fbb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613fdf9190615755565b6140215760405162461bcd60e51b815260206004820152601360248201527221494e56414c4944287369676e61747572652960681b60448201526064016106c9565b9695505050505050565b60fd546000906001600160a01b03166371ce3e66848460028181106140525761405261557d565b905060200201358585600381811061406c5761406c61557d565b60200291909101359050614083866004818a61584d565b6040518563ffffffff1660e01b81526004016140a294939291906158b1565b60206040518083038186803b1580156140ba57600080fd5b505afa1580156140ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c99190615755565b60006140fc6129d2565b60405160609190911b6bffffffffffffffffffffffff191660208201526034810185905260548101839052607481018490524360948201524260b482015260d40160408051601f198184030181529190528051602090910120949350505050565b610ad082826040518060200160405280600081525061459f565b600080808484828161418b5761418b61557d565b9050602002013511156142525760fd54604051632218d7d360e01b81526000916001600160a01b031690632218d7d3906141d1908b908b908b908b908b906004016158d1565b602060405180830381600087803b1580156141eb57600080fd5b505af11580156141ff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614223919061590a565b9050801561425057808585600181811061423f5761423f61557d565b905060200201359250925050614259565b505b5060009050805b9550959350505050565b600083815260ff60205260408120805490919061427f906129e1565b905060016005830154600160a01b900460ff1660068111156142a3576142a36152da565b141561431e576060808501519082015160068401546142c8919063ffffffff16615923565b6142d29190615641565b60068301805463ffffffff191663ffffffff928316908117909155429091161061430e5760068201805463ffffffff19164263ffffffff161790555b6143198585856145d2565b6120b9565b604081015181516143359163ffffffff1690615948565b6040850151855161434c9163ffffffff1690615948565b141561435d576143198585856145d2565b604081015181516143749163ffffffff1690615948565b6040850151855161438b9163ffffffff1690615948565b111561439d57614319858286866146fa565b6120b985856020015185614912565b60006001600160a01b0384163b156144b557836001600160a01b031663150b7a026143d56129d2565b8786866040518563ffffffff1660e01b81526004016143f7949392919061596a565b602060405180830381600087803b15801561441157600080fd5b505af1925050508015614441575060408051601f3d908101601f1916820190925261443e9181019061599d565b60015b61449b573d80801561446f576040519150601f19603f3d011682016040523d82523d6000602084013e614474565b606091505b5080516144935760405162461bcd60e51b81526004016106c990615772565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050612c19565b506001949350505050565b600054610100900460ff16610de95760405162461bcd60e51b81526004016106c9906157c4565b600054610100900460ff1661450e5760405162461bcd60e51b81526004016106c9906157c4565b610de96145196129d2565b61360e565b600054610100900460ff166145455760405162461bcd60e51b81526004016106c9906157c4565b60ca805460ff19169055565b600054610100900460ff166145785760405162461bcd60e51b81526004016106c9906157c4565b815161458b906066906020850190614b7d565b508051610d1e906067906020840190614b7d565b6145a983836149ab565b6145b660008484846143ac565b610d1e5760405162461bcd60e51b81526004016106c990615772565b600083815260ff60205260409020600581015484906001600160a01b03166145f9826111f7565b6004840154600585015460208089015160028801546040805195865263ffffffff600160a81b90950485169386019390935292169083015260608201526001600160a01b0391909116907fe17e61be0a4aac2f0b6fece72cedc2ab9ca554634d5af864a9282095206a0c2b9060800160405180910390a460a083015161ffff16156146c9578260a0015161ffff1683604001516146969190615615565b6146a69063ffffffff16426154d9565b8160060160046101000a81548163ffffffff021916908363ffffffff1602179055505b60209092015160058301805463ffffffff909216600160a81b0263ffffffff60a81b19909216919091179055905550565b600084815260ff602052604090206147138584846145d2565b83511580156147225750825115155b156147e25760068101805463ffffffff19164263ffffffff1617905560fc5460405163d71bb37b60e01b8152600481018790526001600160a01b039091169063d71bb37b90602401600060405180830381600087803b15801561478457600080fd5b505af1158015614798573d6000803e3d6000fd5b50600292506147a5915050565b6005820154600160a01b900460ff1660068111156147c5576147c56152da565b146143195760405162461bcd60e51b81526004016106c9906156fd565b60068101546000906147fb90429063ffffffff16615923565b63ffffffff16856040015163ffffffff16866000015161481b9190615948565b604086015186516148329163ffffffff1690615948565b61483c9190615669565b61484691906159ba565b60fc549091506001600160a01b031663c54c58c4614863886111f7565b600585015460405160e084901b6001600160e01b03191681526001600160a01b039283166004820152911660248201526044810189905260648101849052608401602060405180830381600087803b1580156148be57600080fd5b505af11580156148d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906148f69190615755565b6111af5760405162461bcd60e51b81526004016106c9906156fd565b600083815260ff60209081526040808320610100909252909120829055600581015484906001600160a01b0316614948826111f7565b600484015460058501546040805192835263ffffffff600160a81b90920482166020840152908816908201526001600160a01b0391909116907f3d051466fe86e1bd842d67e98121d69a930caccf48fc2ae2c83119b5a7b71af690606001611076565b6001600160a01b038216614a015760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016106c9565b6000818152606860205260409020546001600160a01b031615614a665760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016106c9565b614a7260008383613e27565b6001600160a01b0382166000908152606960205260408120805460019290614a9b9084906154d9565b909155505060008181526068602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b828054614b05906154f1565b90600052602060002090601f016020900481019282614b275760008555614b6d565b82601f10614b405782800160ff19823516178555614b6d565b82800160010185558215614b6d579182015b82811115614b6d578235825591602001919060010190614b52565b50614b79929150614bf1565b5090565b828054614b89906154f1565b90600052602060002090601f016020900481019282614bab5760008555614b6d565b82601f10614bc457805160ff1916838001178555614b6d565b82800160010185558215614b6d579182015b82811115614b6d578251825591602001919060010190614bd6565b5b80821115614b795760008155600101614bf2565b6001600160e01b03198116811461265357600080fd5b600060208284031215614c2e57600080fd5b81356113c981614c06565b600060208284031215614c4b57600080fd5b5035919050565b60005b83811015614c6d578181015183820152602001614c55565b83811115610acd5750506000910152565b60008151808452614c96816020860160208601614c52565b601f01601f19169290920160200192915050565b6020815260006113c96020830184614c7e565b80356001600160a01b0381168114614cd457600080fd5b919050565b60008060408385031215614cec57600080fd5b614cf583614cbd565b946020939093013593505050565b600080600060608486031215614d1857600080fd5b614d2184614cbd565b9250614d2f60208501614cbd565b9150604084013590509250925092565b600060208284031215614d5157600080fd5b6113c982614cbd565b60008083601f840112614d6c57600080fd5b50813567ffffffffffffffff811115614d8457600080fd5b602083019150836020828501011115614d9c57600080fd5b9250929050565b600080600060408486031215614db857600080fd5b83359250602084013567ffffffffffffffff811115614dd657600080fd5b614de286828701614d5a565b9497909650939450505050565b60008083601f840112614e0157600080fd5b50813567ffffffffffffffff811115614e1957600080fd5b6020830191508360208260051b8501011115614d9c57600080fd5b803563ffffffff81168114614cd457600080fd5b634e487b7160e01b600052604160045260246000fd5b600082601f830112614e6f57600080fd5b813567ffffffffffffffff80821115614e8a57614e8a614e48565b604051601f8301601f19908116603f01168101908282118183101715614eb257614eb2614e48565b81604052838152866020858801011115614ecb57600080fd5b836020870160208301376000602085830101528094505050505092915050565b600080600080600080600080600060c08a8c031215614f0957600080fd5b8935985060208a013567ffffffffffffffff80821115614f2857600080fd5b614f348d838e01614def565b909a50985060408c0135915080821115614f4d57600080fd5b614f598d838e01614def565b9098509650869150614f6d60608d01614e34565b955060808c0135915080821115614f8357600080fd5b614f8f8d838e01614e5e565b945060a08c0135915080821115614fa557600080fd5b50614fb28c828d01614d5a565b915080935050809150509295985092959850929598565b801515811461265357600080fd5b600080600060608486031215614fec57600080fd5b614ff584614cbd565b9250602084013561500581614fc9565b915061501360408501614e34565b90509250925092565b6000806040838503121561502f57600080fd5b8235915060208301356007811061504557600080fd5b809150509250929050565b60008060008060008060008060008060006101008c8e03121561507257600080fd5b8b359a5067ffffffffffffffff8060208e0135111561509057600080fd5b6150a08e60208f01358f01614def565b909b50995060408d01358110156150b657600080fd5b6150c68e60408f01358f01614def565b909950975060608d013596506150de60808e01614e34565b95508060a08e013511156150f157600080fd5b6151018e60a08f01358f01614e5e565b94508060c08e0135111561511457600080fd5b6151248e60c08f01358f01614e5e565b93508060e08e0135111561513757600080fd5b506151488d60e08e01358e01614d5a565b81935080925050509295989b509295989b9093969950565b6000806040838503121561517357600080fd5b8235915061518360208401614e34565b90509250929050565b6000806040838503121561519f57600080fd5b6151a883614cbd565b9150602083013561504581614fc9565b600080600080600080600080600060c08a8c0312156151d657600080fd5b8935985060208a0135975060408a013567ffffffffffffffff808211156151fc57600080fd5b6152088d838e01614def565b909950975060608c013591508082111561522157600080fd5b61522d8d838e01614def565b909750955060808c0135915080821115614f8357600080fd5b6000806000806080858703121561525c57600080fd5b61526585614cbd565b935061527360208601614cbd565b925060408501359150606085013567ffffffffffffffff81111561529657600080fd5b6152a287828801614e5e565b91505092959194509250565b6000806000606084860312156152c357600080fd5b6152cc84614cbd565b925061500560208501614cbd565b634e487b7160e01b600052602160045260246000fd5b6007811061530e57634e487b7160e01b600052602160045260246000fd5b9052565b60408152825160408201526020830151606082015260408301516080820152606083015160a0820152608083015160c0820152600060a084015161536160e08401826001600160a01b03169052565b5060c0840151610100615376818501836152f0565b60e086015191506101206153918186018463ffffffff169052565b908601519150610140906153ac8583018463ffffffff169052565b86015191506101606153c58582018463ffffffff169052565b908601519150610180906153e08583018463ffffffff169052565b86015191506101a06153f98582018463ffffffff169052565b8187015192506101c091508182860152615417610200860184614c7e565b90870151858203603f19016101e087015290925090506154378282614c7e565b925050506113c960208301846001600160a01b03169052565b6000806040838503121561546357600080fd5b61546c83614cbd565b915061518360208401614cbd565b60208082526005908201526404282aaa8960db1b604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082198211156154ec576154ec6154c3565b500190565b600181811c9082168061550557607f821691505b6020821081141561552657634e487b7160e01b600052602260045260246000fd5b50919050565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526010908201526f21494e56414c4944287374617475732960801b604082015260600190565b602080825260099082015268214d494e5f5445524d60b81b604082015260600190565b600063ffffffff80831681851681830481118215151615615638576156386154c3565b02949350505050565b600063ffffffff808316818516808303821115615660576156606154c3565b01949350505050565b60008282101561567b5761567b6154c3565b500390565b66697066733a2f2f60c81b8152600082516156a2816007850160208701614c52565b9190910160070192915050565b60208082526013908201527221494e56414c494428706c616e50726f6f662960681b604082015260600190565b6000602082840312156156ee57600080fd5b8151600381106113c957600080fd5b6020808252600e908201526d21554e50524f4345535341424c4560901b604082015260600190565b60018060a01b038416815282602082015260606040820152600061574c6060830184614c7e565b95945050505050565b60006020828403121561576757600080fd5b81516113c981614fc9565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60018060a01b038616815284602082015283604082015282606082015260a06080820152600061584260a0830184614c7e565b979650505050505050565b6000808585111561585d57600080fd5b8386111561586a57600080fd5b5050600583901b0193919092039150565b81835260006001600160fb1b0383111561589457600080fd5b8260051b8083602087013760009401602001938452509192915050565b84815283602082015260606040820152600061402160608301848661587b565b6001600160a01b0386811682528516602082015263ffffffff84166040820152608060608201819052600090615842908301848661587b565b60006020828403121561591c57600080fd5b5051919050565b600063ffffffff83811690831681811015615940576159406154c3565b039392505050565b60008261596557634e487b7160e01b600052601260045260246000fd5b500490565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061402190830184614c7e565b6000602082840312156159af57600080fd5b81516113c981614c06565b60008160001904831182151516156159d4576159d46154c3565b50029056fea264697066735822122049a14ac05fe869675dd3762a867edfc99ef40f0d45fc0567a24b111a0981a8a664736f6c63430008090033
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.