forked from StellarSplit/StellarSplit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevents.rs
More file actions
42 lines (34 loc) · 1.2 KB
/
Copy pathevents.rs
File metadata and controls
42 lines (34 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
use soroban_sdk::{Address, Env, String, Symbol};
use crate::types::Split;
pub fn emit_initialized(env: &Env, admin: &Address) {
env.events().publish(("init", "admin"), admin.clone());
}
pub fn emit_split_created(env: &Env, split: &Split) {
env.events().publish(
("created", "split_id", "creator"),
(split.split_id, split.creator.clone()),
);
}
pub fn emit_deposit(env: &Env, split_id: u64, participant: &Address, amount: i128) {
env.events().publish(
("deposit", "split_id", "participant"),
(split_id, participant.clone(), amount),
);
}
pub fn emit_released(env: &Env, split_id: u64, released_amount: i128) {
env.events()
.publish(("released", "split_id"), (split_id, released_amount));
}
pub fn emit_cancelled(env: &Env, split_id: u64) {
env.events().publish(("cancelled", "split_id"), split_id);
}
pub fn emit_fees_collected(env: &Env, amount: i128, treasury: &Address) {
env.events().publish(
(Symbol::new(env, "FeesCollected"),),
(amount, treasury.clone()),
);
}
pub fn emit_note_updated(env: &Env, split_id: u64, note: &String) {
env.events()
.publish(("NoteUpdated", "split_id"), (split_id, note.clone()));
}