event.move 819 B

123456789101112131415161718192021222324252627282930313233
  1. module pyth::event {
  2. use sui::event::{Self};
  3. use pyth::price_feed::{PriceFeed};
  4. friend pyth::pyth;
  5. friend pyth::state;
  6. struct PythInitializationEvent has copy, drop {}
  7. /// Signifies that a price feed has been updated
  8. struct PriceFeedUpdateEvent has copy, store, drop {
  9. /// Value of the price feed
  10. price_feed: PriceFeed,
  11. /// Timestamp of the update
  12. timestamp: u64,
  13. }
  14. public(friend) fun emit_price_feed_update(price_feed: PriceFeed, timestamp: u64 /* in seconds */) {
  15. event::emit(
  16. PriceFeedUpdateEvent {
  17. price_feed,
  18. timestamp,
  19. }
  20. );
  21. }
  22. public(friend) fun emit_pyth_initialization_event() {
  23. event::emit(
  24. PythInitializationEvent {}
  25. );
  26. }
  27. }