You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+34-20Lines changed: 34 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -98,7 +98,7 @@ New assets are appended to the `assets` array of the corresponding registry in `
98
98
99
99
### Subscribe
100
100
101
-
Subscribe to an asset using ERC-2612 permit (gasless approval). The payer signs the permit and pays with tokens; the subscription is associated with a **subscriber** identity (a `bytes32` hash). For cancellation, the subscriber identity should be derived as `keccak256(abi.encode(subscriberId, subscriberAddress))`, so only that `subscriberAddress` can cancel using a signed cancellation flow. The payer and the subscriber can be the same or different (e.g. "pay for someone else"). The **payer** is the address entitled to refunds if the subscription is later cancelled or revoked (unearned time is refunded to the payer).
101
+
Subscribe to an asset using ERC-2612 permit (gasless approval). The payer signs the permit and pays with tokens; the subscription is associated with a **subscriber** identity (a `bytes32` hash). For cancellation, the subscriber identity should be derived as `keccak256(abi.encode(subscriberId, subscriberAddress))`, so only that `subscriberAddress` can cancel by signing an off-chain message and calling `cancelSubscription` in one step (no on-chain commit or timestamp binding). The payer and the subscriber can be the same or different (e.g. "pay for someone else"). The **payer** is the address entitled to refunds if the subscription is later cancelled or revoked (unearned time is refunded to the payer).
@@ -269,7 +269,7 @@ All external functions for the registry and asset contracts, for use with JSON-R
269
269
270
270
---
271
271
272
-
**subscribe**: Subscribes a subscriber to the asset using ERC-2612 permit; forwards to the asset contract. The permit is signed by the payer; the subscription is attributed to `_subscriber` (payer and subscriber can differ). The payer is the refund beneficiary on cancel/revoke. For cancellation-compatible identity, `_subscriber` should be `keccak256(abi.encode(subscriberId, subscriberAddress))`, where `subscriberAddress` is the address that will commit/sign cancellation.
272
+
**subscribe**: Subscribes a subscriber to the asset using ERC-2612 permit; forwards to the asset contract. The permit is signed by the payer; the subscription is attributed to `_subscriber` (payer and subscriber can differ). The payer is the refund beneficiary on cancel/revoke. For cancellation-compatible identity, `_subscriber` should be `keccak256(abi.encode(subscriberId, subscriberAddress))`, where `subscriberAddress` is the address that will call `cancelSubscription` and sign the cancellation payload.
273
273
- Type: write
274
274
- Permission: none
275
275
- Parameters:
@@ -474,7 +474,7 @@ All external functions for the registry and asset contracts, for use with JSON-R
474
474
475
475
---
476
476
477
-
**subscribe** : Subscribes a subscriber using ERC-2612 permit: payer signs permit, then payment is pulled and subscription is attributed to the given subscriber. Payer and subscriber can differ (e.g. pay for someone else). The payer is the refund beneficiary on cancel/revoke. For cancellation-compatible identity, `subscriber` should be `keccak256(abi.encode(subscriberId, subscriberAddress))`, where `subscriberAddress` is the address that will commit/sign cancellation.
477
+
**subscribe** : Subscribes a subscriber using ERC-2612 permit: payer signs permit, then payment is pulled and subscription is attributed to the given subscriber. Payer and subscriber can differ (e.g. pay for someone else). The payer is the refund beneficiary on cancel/revoke. For cancellation-compatible identity, `subscriber` should be `keccak256(abi.encode(subscriberId, subscriberAddress))`, where `subscriberAddress` is the address that will call `cancelSubscription` and sign the cancellation payload.
478
478
- Type: write
479
479
- Permission: none
480
480
- Parameters:
@@ -546,23 +546,12 @@ All external functions for the registry and asset contracts, for use with JSON-R
546
546
547
547
---
548
548
549
-
**commitCancellation**:Commits a cancellation intent forthe caller's `(subscriberId, msg.sender)` pair.
549
+
**cancelSubscription**:Cancels the caller's subscription after validating an EIP-191 signature from `msg.sender`. Unearned subscription value is refunded to each original payer. There is no separate on-chain commit step: the subscriber signs an off-chain message, then submits one transaction with that signature.
550
550
- Type: write
551
-
- Permission: caller is the subscriber address committing cancellation
551
+
- Permission: `msg.sender` must be the subscriber address represented in `keccak256(abi.encode(subscriberId, msg.sender))` (the recovered signer must equal `msg.sender`).
552
552
- Parameters:
553
553
- `string subscriberId` : Human-readable subscriber id used in the subscriber hash.
554
-
- Returns:
555
-
- `uint256` : Commitment timestamp used in the subsequent cancellation signature.
556
-
557
-
---
558
-
559
-
**cancelSubscription** : Cancels the caller's subscription after validating a prior commitment and signature. Unearned subscription value is refunded to each original payer.
560
-
- Type: write
561
-
- Permission: caller must be the subscriber address represented in`keccak256(abi.encode(subscriberId, msg.sender))`
562
-
- Parameters:
563
-
- `string subscriberId`: Human-readable subscriber id used in the subscriber hash.
564
-
- `uint256 timestamp`: Commitment timestamp returned by `commitCancellation`.
565
-
- `bytes signature`: ECDSA signature by `msg.sender` over `keccak256(abi.encodePacked(chainid, assetAddress, timestamp, subscriberHash))`.
554
+
- `bytes signature` : ECDSA signature by `msg.sender` over the Ethereum signed message hash of `keccak256(abi.encodePacked(chainid, assetAddress, subscriber))`, where `subscriber` is `keccak256(abi.encode(subscriberId, msg.sender))` and `assetAddress` is this asset contract.
566
555
- Returns: void
567
556
568
557
---
@@ -618,13 +607,26 @@ All events emitted by the registry and asset contracts. Use for indexing, loggin
618
607
619
608
---
620
609
621
-
**SubscriptionAdded**: Emitted when a new subscription record is created for a subscriber (new nonce). This happens on the first subscription and whenever the payer, subscription price, or registry fee share differs from the active subscription. For renewals that extend an existing active subscription under the same terms, see `SubscriptionExtended`.
610
+
**SubscriptionAdded** : Emitted when the first subscription record is created for a subscriber.
- `uint256 indexed startTime` : Subscription start time (Unix timestamp).
626
615
- `uint256 indexed endTime` : Subscription expiry time (Unix timestamp).
627
-
- `uint256 nonce`: Subscription nonce (increments each time a new record is created for the subscriber).
616
+
- `address payer` : Payer for this subscription (refund beneficiary on cancel/revoke).
617
+
- `uint256 subscriptionPrice` : Per-second subscription price snapshot used for this subscription record.
618
+
- `uint256 registryFeeShare` : Registry fee share snapshot (0-100) used for this subscription record.
619
+
620
+
621
+
---
622
+
623
+
**SubscriptionRenewed** : Emitted when a subscriber already has prior subscription history and a new subscription record is created (new nonce). This occurs when in-place extension is not possible (e.g. prior subscription expired, or payer/price/registry fee share differs from the current active record).
- `uint256 indexed nonce`: Active nonce after cancellation/removal processing.
687
+
- `uint256 indexed endTime`: Effective end time after cancellation. Will be `0` when the subscriber is fully removed.
688
+
689
+
690
+
---
691
+
692
+
**SubscriptionRemoved**: Emitted when all remaining subscription records for a subscriber are deleted and the subscriber is removed from tracking state.
693
+
- Contract: `Asset`
694
+
- Parameters:
695
+
- `bytes32 indexed subscriber`: Subscriber identity (hash) that was fully removed.
0 commit comments