Skip to content

Commit a74a512

Browse files
committed
fix: address comments
1 parent a34e8ab commit a74a512

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lazer/sui/sources/lazer_example.move

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@ use lazer_example::i16::{Self, I16};
55
use sui::bcs;
66
use sui::ecdsa_k1::secp256k1_ecrecover;
77

8+
const UPDATE_MESSAGE_MAGIC: u32 = 1296547300;
9+
const PAYLOAD_MAGIC: u32 = 2479346549;
10+
811
public enum Channel has copy, drop {
912
Invalid,
1013
RealTime,
1114
FixedRate50ms,
1215
FixedRate200ms,
1316
}
1417

15-
16-
1718
public struct Update has drop {
1819
timestamp: u64,
1920
channel: Channel,
@@ -34,7 +35,7 @@ public struct Feed has drop {
3435
price: Option<Option<I64>>,
3536
/// Best bid price available across all publishers
3637
best_bid_price: Option<Option<I64>>,
37-
/// Best ask price available across all publishers
38+
/// Best ask price available across all publishers
3839
best_ask_price: Option<Option<I64>>,
3940
/// Number of publishers contributing to this price feed
4041
publisher_count: Option<u16>,
@@ -56,7 +57,7 @@ public fun parse_and_validate_update(update: vector<u8>): Update {
5657
let mut cursor = bcs::new(update);
5758

5859
let magic = cursor.peel_u32();
59-
assert!(magic == 1296547300, 0);
60+
assert!(magic == UPDATE_MESSAGE_MAGIC, 0);
6061

6162
let mut signature = vector::empty<u8>();
6263

@@ -80,7 +81,7 @@ public fun parse_and_validate_update(update: vector<u8>): Update {
8081

8182
let mut cursor = bcs::new(payload);
8283
let payload_magic = cursor.peel_u32();
83-
assert!(payload_magic == 2479346549, 0);
84+
assert!(payload_magic == PAYLOAD_MAGIC, 0);
8485

8586
let timestamp = cursor.peel_u64();
8687
let channel_value = cursor.peel_u8();

0 commit comments

Comments
 (0)