Skip to content

Commit

Permalink
update streaming events (#1740)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xrjman authored May 11, 2022
1 parent 473e9e7 commit fa6d590
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions pallets/streaming/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ benchmarks! {
let end_time: u64 = 18;
}: _(SystemOrigin::Signed(caller.clone()), recipient.clone(), deposit_amount, KSM, start_time, end_time, true)
verify {
assert_last_event::<T>(Event::StreamCreated(0, caller, recipient, deposit_amount, KSM, start_time, end_time).into())
assert_last_event::<T>(Event::StreamCreated(0, caller, recipient, deposit_amount, KSM, start_time, end_time, true).into())
}

cancel {
Expand All @@ -72,7 +72,7 @@ benchmarks! {
let stream_id: u128 = 0;
}: _(SystemOrigin::Signed(caller.clone()), stream_id)
verify {
assert_last_event::<T>(Event::StreamCanceled(stream_id, caller, recipient, KSM, deposit_amount, 0).into())
assert_last_event::<T>(Event::StreamCancelled(stream_id, caller, recipient, KSM, deposit_amount, 0).into())
}

withdraw {
Expand Down
9 changes: 5 additions & 4 deletions pallets/streaming/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ pub mod pallet {
#[pallet::generate_deposit(pub(crate) fn deposit_event)]
pub enum Event<T: Config> {
/// Creates a payment stream.
/// \[stream_id, sender, recipient, deposit, asset_id, start_time, end_time\]
/// \[stream_id, sender, recipient, deposit, asset_id, start_time, end_time, cancellable\]
StreamCreated(
StreamId,
AccountOf<T>,
Expand All @@ -136,13 +136,14 @@ pub mod pallet {
AssetIdOf<T>,
Timestamp,
Timestamp,
bool,
),
/// Withdraw payment from stream.
/// \[stream_id, recipient, asset_id, amount\]
StreamWithdrawn(StreamId, AccountOf<T>, AssetIdOf<T>, BalanceOf<T>),
/// Cancel an existing stream.
/// \[stream_id, sender, recipient, sender_balance, recipient_balance]
StreamCanceled(
StreamCancelled(
StreamId,
AccountOf<T>,
AccountOf<T>,
Expand Down Expand Up @@ -260,7 +261,7 @@ pub mod pallet {
Self::try_push_stream_library(&recipient, StreamKind::Receive, stream_id)?;

Self::deposit_event(Event::<T>::StreamCreated(
stream_id, sender, recipient, deposit, asset_id, start_time, end_time,
stream_id, sender, recipient, deposit, asset_id, start_time, end_time, true,
));
Ok(().into())
}
Expand Down Expand Up @@ -305,7 +306,7 @@ pub mod pallet {
Self::try_push_stream_library(&stream.sender, StreamKind::Finish, stream_id)?;
Self::try_push_stream_library(&stream.recipient, StreamKind::Finish, stream_id)?;

Self::deposit_event(Event::<T>::StreamCanceled(
Self::deposit_event(Event::<T>::StreamCancelled(
stream_id,
sender,
stream.recipient,
Expand Down
2 changes: 1 addition & 1 deletion pallets/streaming/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ pub(crate) fn new_test_ext() -> sp_io::TestExternalities {

let mut ext = sp_io::TestExternalities::new(t);
ext.execute_with(|| {
// Init network tokens to execute extrinsics
// Init network tokens to execute extrinsic
Balances::set_balance(Origin::root(), BOB, dollar(1000), dollar(0)).unwrap();
Balances::set_balance(Origin::root(), ALICE, dollar(1000), dollar(0)).unwrap();
Balances::set_balance(Origin::root(), DAVE, dollar(1000), dollar(0)).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion pallets/streaming/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ fn withdraw_works() {
}

#[test]
fn withdraw_fwith_slower_rate_works() {
fn withdraw_with_slower_rate_works() {
new_test_ext().execute_with(|| {
let before_bob = <Test as Config>::Assets::balance(DOT, &BOB);
// Alice creates stream 100 DOT to Bob
Expand Down

0 comments on commit fa6d590

Please sign in to comment.