Skip to content

Commit 7d111e0

Browse files
authored
feat: remove DepositUpdated and YangTotalUpdated events (#585)
1 parent 04bd835 commit 7d111e0

File tree

2 files changed

+0
-69
lines changed

2 files changed

+0
-69
lines changed

src/core/shrine.cairo

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ pub mod shrine {
246246
pub enum Event {
247247
AccessControlEvent: access_control_component::Event,
248248
YangAdded: YangAdded,
249-
YangTotalUpdated: YangTotalUpdated,
250249
TotalTrovesDebtUpdated: TotalTrovesDebtUpdated,
251250
ProtocolOwnedTrovesDebtUpdated: ProtocolOwnedTrovesDebtUpdated,
252251
BudgetAdjusted: BudgetAdjusted,
@@ -260,7 +259,6 @@ pub mod shrine {
260259
Melt: Melt,
261260
Charge: Charge,
262261
TroveRedistributed: TroveRedistributed,
263-
DepositUpdated: DepositUpdated,
264262
YangPriceUpdated: YangPriceUpdated,
265263
YinPriceUpdated: YinPriceUpdated,
266264
MinimumTroveValueUpdated: MinimumTroveValueUpdated,
@@ -281,13 +279,6 @@ pub mod shrine {
281279
pub initial_rate: Ray
282280
}
283281

284-
#[derive(Copy, Drop, starknet::Event, PartialEq)]
285-
pub struct YangTotalUpdated {
286-
#[key]
287-
pub yang: ContractAddress,
288-
pub total: Wad
289-
}
290-
291282
#[derive(Copy, Drop, starknet::Event, PartialEq)]
292283
pub struct TotalTrovesDebtUpdated {
293284
pub total: Wad
@@ -375,15 +366,6 @@ pub mod shrine {
375366
pub debt: Wad
376367
}
377368

378-
#[derive(Copy, Drop, starknet::Event, PartialEq)]
379-
pub struct DepositUpdated {
380-
#[key]
381-
pub yang: ContractAddress,
382-
#[key]
383-
pub trove_id: u64,
384-
pub amount: Wad
385-
}
386-
387369
#[derive(Copy, Drop, starknet::Event, PartialEq)]
388370
pub struct YangPriceUpdated {
389371
#[key]
@@ -724,7 +706,6 @@ pub mod shrine {
724706

725707
// Event emissions
726708
self.emit(YangAdded { yang, yang_id, start_price, initial_rate });
727-
self.emit(YangTotalUpdated { yang, total: initial_yang_amt });
728709
}
729710

730711
fn set_threshold(ref self: ContractState, yang: ContractAddress, new_threshold: Ray) {
@@ -974,10 +955,6 @@ pub mod shrine {
974955
// Update trove balance
975956
let new_trove_balance: Wad = self.deposits.read((yang_id, trove_id)) + amount;
976957
self.deposits.write((yang_id, trove_id), new_trove_balance);
977-
978-
// Events
979-
self.emit(YangTotalUpdated { yang, total: new_total });
980-
self.emit(DepositUpdated { yang, trove_id, amount: new_trove_balance });
981958
}
982959

983960
// Withdraw a specified amount of a Yang from a Trove with trove safety check
@@ -1567,10 +1544,6 @@ pub mod shrine {
15671544

15681545
self.yang_total.write(yang_id, new_total);
15691546
self.deposits.write((yang_id, trove_id), new_trove_balance);
1570-
1571-
// Emit events
1572-
self.emit(YangTotalUpdated { yang, total: new_total });
1573-
self.emit(DepositUpdated { yang, trove_id, amount: new_trove_balance });
15741547
}
15751548

15761549
// Adds the accumulated interest as debt to the trove

src/tests/shrine/test_shrine.cairo

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -399,12 +399,6 @@ mod test_shrine {
399399
}
400400
)
401401
),
402-
(
403-
shrine.contract_address,
404-
shrine_contract::Event::YangTotalUpdated(
405-
shrine_contract::YangTotalUpdated { yang: new_yang_address, total: Zero::zero() }
406-
)
407-
),
408402
];
409403

410404
spy.assert_emitted(@expected_events);
@@ -865,7 +859,6 @@ mod test_shrine {
865859
#[test]
866860
fn test_shrine_deposit_pass() {
867861
let shrine: IShrineDispatcher = shrine_utils::shrine_setup_with_feed(Option::None);
868-
let mut spy = spy_events(SpyOn::One(shrine.contract_address));
869862

870863
let deposit_amt: Wad = shrine_utils::TROVE1_YANG1_DEPOSIT.into();
871864
shrine_utils::trove1_deposit(shrine, deposit_amt);
@@ -892,23 +885,6 @@ mod test_shrine {
892885
assert(max_forge_amt == expected_max_forge, 'incorrect max forge amt');
893886

894887
shrine_utils::assert_total_yang_invariant(shrine, yangs, 1);
895-
896-
let expected_events = array![
897-
(
898-
shrine.contract_address,
899-
shrine_contract::Event::YangTotalUpdated(
900-
shrine_contract::YangTotalUpdated { yang, total: deposit_amt, }
901-
)
902-
),
903-
(
904-
shrine.contract_address,
905-
shrine_contract::Event::DepositUpdated(
906-
shrine_contract::DepositUpdated { yang, trove_id, amount: deposit_amt, }
907-
)
908-
),
909-
];
910-
911-
spy.assert_emitted(@expected_events);
912888
}
913889

914890
#[test]
@@ -936,7 +912,6 @@ mod test_shrine {
936912
#[test]
937913
fn test_shrine_withdraw_pass() {
938914
let shrine: IShrineDispatcher = shrine_utils::shrine_setup_with_feed(Option::None);
939-
let mut spy = spy_events(SpyOn::One(shrine.contract_address));
940915

941916
start_prank(CheatTarget::All, shrine_utils::admin());
942917

@@ -968,23 +943,6 @@ mod test_shrine {
968943
assert(max_forge_amt == expected_max_forge, 'incorrect max forge amt');
969944

970945
shrine_utils::assert_total_yang_invariant(shrine, yangs, 1);
971-
972-
let expected_events = array![
973-
(
974-
shrine.contract_address,
975-
shrine_contract::Event::YangTotalUpdated(
976-
shrine_contract::YangTotalUpdated { yang: yang1_addr, total: remaining_amt }
977-
)
978-
),
979-
(
980-
shrine.contract_address,
981-
shrine_contract::Event::DepositUpdated(
982-
shrine_contract::DepositUpdated { yang: yang1_addr, trove_id, amount: remaining_amt }
983-
)
984-
),
985-
];
986-
987-
spy.assert_emitted(@expected_events);
988946
}
989947

990948
#[test]

0 commit comments

Comments
 (0)