update.move 692 B

123456789101112131415161718192021222324252627282930313233
  1. module pyth_lazer::update;
  2. use pyth_lazer::channel::Channel;
  3. use pyth_lazer::feed::Feed;
  4. public struct Update has copy, drop {
  5. timestamp: u64,
  6. channel: Channel,
  7. feeds: vector<Feed>,
  8. }
  9. public(package) fun new(
  10. timestamp: u64,
  11. channel: Channel,
  12. feeds: vector<Feed>
  13. ): Update {
  14. Update { timestamp, channel, feeds }
  15. }
  16. /// Get the timestamp of the update
  17. public fun timestamp(update: &Update): u64 {
  18. update.timestamp
  19. }
  20. /// Get a reference to the channel of the update
  21. public fun channel(update: &Update): Channel {
  22. update.channel
  23. }
  24. /// Get a reference to the feeds vector of the update
  25. public fun feeds(update: &Update): vector<Feed> {
  26. update.feeds
  27. }