-
Notifications
You must be signed in to change notification settings - Fork 15
Standard proposal draft (2nd iteration, Stef & Luka) #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Standard proposal draft (2nd iteration, Stef & Luka) #18
Conversation
* @param _user User's address. | ||
* @return Array of provider addresses. | ||
**/ | ||
function getUserSubscriptionProviders(address _user) external view |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's actually the definition for the provider? Is that the destination address for the payment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I agree. A broader term like "destination address" would be better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we identify providers by their destination address.
* @param _provider Provider's address. | ||
* @return Number of subscriptions. | ||
**/ | ||
function getNumberOfProviderSubscriptions(address _provider) external view |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the purpose of having this function? Can be easily done using getUserSubscriptionProviders
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This interface takes into account not only a "contract-per-subscription" model but also a model where one smart contract serves all subscriptions. Additional functions are necessary for such model to be scalable enough to handle millions of subscribers/providers/subscriptions...
Subscription query would then look something like this:
- Get number of all subscriptions (needed for pagination)
- Get subscription IDs using pagination
- Get subscription info
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As @StefanSimec said - we need to enable arbitrary number of subscriptions per provider. Thus e.g. getProviderSubscriptionIds
which returns an array of subscription ids is not scalable. Yes, it can handle tens of thousand of elements, maybe even hundred thousand. But at some point the response becomes too large. So the idea here is:
- Get the number of provider subscriptions.
- Get a subset of provider subscriptions by passing index and number to the get function. Index is index in the subscription array and number is number of elements starting from the index.
This allows SDKs to easily implement pagination and it solves the scalability problem. And again, we're just building on the shoulders of 721, which has similar requirement.
## Interface | ||
```solidity | ||
|
||
interface ERC948Processor /* is ERC948 */ { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think from the user perspective does not really matter who is executing the payment hence this part doesn't seem to be necessary. The only reason (maybe) to have it is to solve the coordination problem by assigning the processor for the payment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not part of the main standard but an extension aimed towards subscription providers who might want to delegate some of the responsibility.
This is a second iteration of the proposal. Interface has been divided into:
Changelog: