Skip to content

Commit 96bafcf

Browse files
committed
primitives - move supermarket Campaign & Status
1 parent bc3434c commit 96bafcf

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

primitives/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ pub mod merkle_tree;
1717
pub mod sentry;
1818
pub mod targeting;
1919
pub mod targeting_tag;
20+
pub mod supermarket;
21+
2022
pub mod util {
2123
pub mod tests {
2224
pub mod prep_db;

primitives/src/supermarket.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
use crate::{BalancesMap, Channel};
2+
3+
#[derive(Debug, Clone)]
4+
pub struct Campaign {
5+
channel: Channel,
6+
status: Status,
7+
balances: BalancesMap,
8+
}
9+
10+
impl Campaign {
11+
pub fn new(channel: Channel, status: Status, balances: BalancesMap) -> Self {
12+
Self {
13+
channel,
14+
status,
15+
balances,
16+
}
17+
}
18+
}
19+
20+
#[derive(Debug, Eq, PartialEq, Clone)]
21+
pub enum Status {
22+
// Active and Ready
23+
Active,
24+
Pending,
25+
Initializing,
26+
Waiting,
27+
Finalized(Finalized),
28+
Unsound {
29+
disconnected: bool,
30+
offline: bool,
31+
rejected_state: bool,
32+
unhealthy: bool,
33+
},
34+
}
35+
36+
#[derive(Debug, PartialEq, Eq, Clone)]
37+
pub enum Finalized {
38+
Expired,
39+
Exhausted,
40+
Withdraw,
41+
}

0 commit comments

Comments
 (0)