diff --git a/piper_standard.md b/piper_standard.md new file mode 100644 index 0000000..99e7771 --- /dev/null +++ b/piper_standard.md @@ -0,0 +1,37 @@ +From https://github.com/ethereum/EIPs/issues/948#issuecomment-376213214 + +
I think that price should be out-of-scope for this standard. This feels a lot like scope creep to me and doesn't need to be part of the core API. Ideally whatever protocol rules are decided allow for this type of behavior.
+From the subscriber's side:
+From the providers's side:
+And to think a bit about protocol:
+Building on the token ERCs seems valuable here since they already setup primatives for transferring and approving. What's missing is the concept of time based approvals. I think that we can get very close to hitting all of the use cases above with the following API
+I think we need the following minimal API
+triggerPayment() returns bool
: Triggers payment of the subscription. This spec does not specify the behavior of this function, leaving it up to the implementer.cancel() returns bool
: Immediately cancels the subscription. Implementations should ensure that any unpaid subscription payments are paid to the provider as part of cancellation to ensure providers are able to let subscriptions fees fill up for arbitrary lengths of time, allowing them to reduce overhead from transaction costs.These probably have Payment
and Cancelled
events that would get fired.
With the above, we can now think about what a subscription paid in ERC20 tokens might look like. A minimal implementation would require the following fields.
+address token
: defines the token contract which payments are paid from.address provider
: the address of the provideruint256 time_unit
: the number of seconds per time unit.uint256 tokens_per_time_unit
: the number of tokens
that can be paid towards the subscription per time_unit
.uint256 last_payment_at
: the timestamp when the last payment was made.The triggerPayment
method would call token.transfer(provider, (now - last_payment_at) * tokens_per_time_unit / time_unit
)`.
Given the wide set of use cases for subscriptions and the wide array of different business requirements, I think this specification will be most useful if it sticks to trying to define an interface, and leaves the exact implementation up to the provider. A provider would either provide their own implementation of a subscription contract, requiring the user to fund the contract once it was created for them, or they might delegate to a 3rd party service which offers pre-built subscription contracts that fit their business requirements.
\ No newline at end of file