Skip to content

Commit

Permalink
fix: fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
JordyRo1 committed Oct 23, 2023
1 parent 3a62a7e commit 8d4e361
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/oracle/oracle.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ mod Oracle {
const MAX_FELT: u256 =
3618502788666131213697322783095070105623107215331596699973092056135872020480; //max felt value
const TIMESTAMP_SHIFT_U32: felt252 = 0x100000000;
const TIMESTAMP_SHIFT_MASK_U32 : u128 = 0xffffffff;
const TIMESTAMP_SHIFT_MASK_U32: u128 = 0xffffffff;
const VOLUME_SHIFT_U132: felt252 = 0x1000000000000000000000000000000000;
const VOLUME_SHIFT_MASK_U100: u128 = 0xfffffffffffffffffffffffff;

Expand Down Expand Up @@ -373,8 +373,14 @@ mod Oracle {
impl EntryStorePacking of StorePacking<EntryStorage, felt252> {
fn pack(value: EntryStorage) -> felt252 {
// entries verifications (no overflow)
assert(value.timestamp.into() == value.timestamp.into() & TIMESTAMP_SHIFT_MASK_U32, 'EntryStorePack:tmp too big');
assert(value.volume.into() == value.volume.into() & VOLUME_SHIFT_MASK_U100, 'EntryStorePack:volume too big');
assert(
value.timestamp.into() == value.timestamp.into() & TIMESTAMP_SHIFT_MASK_U32,
'EntryStorePack:tmp too big'
);
assert(
value.volume.into() == value.volume.into() & VOLUME_SHIFT_MASK_U100,
'EntryStorePack:volume too big'
);
let pack_value: felt252 = value.timestamp.into()
+ value.volume.into() * TIMESTAMP_SHIFT_U32
+ value.price.into() * VOLUME_SHIFT_U132;
Expand Down

0 comments on commit 8d4e361

Please sign in to comment.