price_identifier.move 562 B

12345678910111213141516171819202122
  1. module pyth::price_identifier {
  2. use std::vector;
  3. use pyth::error;
  4. const IDENTIFIER_BYTES_LENGTH: u64 = 32;
  5. struct PriceIdentifier has copy, drop, store {
  6. bytes: vector<u8>,
  7. }
  8. public fun from_byte_vec(bytes: vector<u8>): PriceIdentifier {
  9. assert!(vector::length(&bytes) == IDENTIFIER_BYTES_LENGTH, error::incorrect_identifier_length());
  10. PriceIdentifier {
  11. bytes: bytes
  12. }
  13. }
  14. public fun get_bytes(price_identifier: &PriceIdentifier): vector<u8> {
  15. price_identifier.bytes
  16. }
  17. }