-
Notifications
You must be signed in to change notification settings - Fork 52
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
Stream Payment pallet #391
Conversation
Coverage Report@@ Coverage Diff @@
## master jeremy-stream-payment-pallet +/- ##
================================================================
- Coverage 76.66% 76.30% -0.36%
+ Files 107 109 +2
+ Lines 26803 27541 +738
================================================================
+ Hits 20547 21014 +467
+ Misses 6256 6527 +271
|
/// this AccountId is a target in StreamId. One can iterate over all storage | ||
/// keys starting with the AccountId to find all StreamIds. | ||
#[pallet::storage] | ||
pub type LookupStreamsWithTarget<T: Config> = StorageDoubleMap< |
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.
These double maps are not used by the pallet, it would probably be better to remove them and calculate them offchain. Unless they should be used somewhere?
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.
They are here for the UI to find the list of streams one is the source/target.
I think it looks good overall, just noted down a couple of observations. Also let's try to configure this in Dancebox and Flashbox, and add some integration tests to it |
fn source_can_immediately_decrease_deposit() { | ||
source_can_immediately_change_deposit(DepositChange::Decrease(100)) |
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.
Doesn't this defeat the purpose of a deposit? I get that the source can already close the stream at any time and stop the payment, but this feels strange to me.
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 it's ok, sometimes source might have put too much in the deposit. The target as well can close the stream if the amount is not being paid, so I think it's ok
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.
That's indeed the idea. Since the source can close the stream at any time and recover unspent deposit, I think we can allow to decrease the deposit without closing the stream. One could first deposit a big amount because they want a long-term service, but at some point temporarily need some funds for something else. What matters for the target is that past time is guaranteed to be paid, and by looking at the events they can compute up to which time the stream is funded.
Rendered pallet README