Skip to content

Commit

Permalink
scarb fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
credence0x committed May 19, 2024
1 parent 300d4ca commit f3de614
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions contracts/src/components/strealm.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ trait IStRealm<TState> {

mod strealm_structs {
use starknet::storage_access::StorePacking;

#[derive(Copy, Drop, Serde, starknet::Store)]
struct Flow {
rate: u256, // flow rate per second
Expand All @@ -34,23 +34,19 @@ mod strealm_structs {

impl StreamStorePacking of StorePacking<Stream, u128> {
fn pack(value: Stream) -> u128 {
value.flow_id.into() + (value.start_at.into() * TWO_POW_64)
value.flow_id.into() + (value.start_at.into() * TWO_POW_64)
}

fn unpack(value: u128) -> Stream {
let flow_id = value & MASK_64;
let start_at = (value / TWO_POW_64);

Stream {
flow_id: flow_id.try_into().unwrap(),
start_at: start_at.try_into().unwrap(),
}
Stream { flow_id: flow_id.try_into().unwrap(), start_at: start_at.try_into().unwrap(), }
}
}
}



#[starknet::component]
mod StRealmComponent {
use core::integer::BoundedInt;
Expand Down

0 comments on commit f3de614

Please sign in to comment.