Skip to content

Commit

Permalink
improve exit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Ninjatosba committed Dec 4, 2024
1 parent 5a88088 commit 2c0c3d2
Show file tree
Hide file tree
Showing 4 changed files with 469 additions and 89 deletions.
10 changes: 9 additions & 1 deletion contracts/stream/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ pub fn execute_finalize_stream(
let mut messages = vec![];
let mut attributes = vec![];

// last creator revenue = spent_in - swap_fee - in_clp;
// creator revenue = spent_in - swap_fee - in_clp;
let mut creator_revenue = stream_state.spent_in;

// Stream's swap fee collected at fixed rate from accumulated spent_in of positions(ie stream.spent_in)
Expand Down Expand Up @@ -656,6 +656,14 @@ pub fn execute_exit_stream(
sync_stream_status(&mut stream_state, env.block.time);
sync_stream(&mut stream_state, env.block.time);

// Exit is handled differently based on the stream status
// If stream is ended and threshold is reached, we need to calculate the final position and send the funds
// This is the normal exit scenario
// If stream is ended and threshold is not reached, we need to refund the in tokens to the subscriber
// This is a full refund exit scenario
// If stream is cancelled, we need to refund the in tokens to the subscriber
// This is also a full refund exit scenario

match (
stream_state.status_info.clone().status,
stream_state.check_threshold(),
Expand Down
4 changes: 0 additions & 4 deletions packages/types/src/stream/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ mod error;
mod msg;
mod position;
mod stream;
mod threshold;

pub use error::*;
pub use msg::*;
pub use position::*;
pub use stream::*;
pub use threshold::*;
81 changes: 0 additions & 81 deletions packages/types/src/stream/threshold.rs

This file was deleted.

Loading

0 comments on commit 2c0c3d2

Please sign in to comment.