Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into test/_get_available…
Browse files Browse the repository at this point in the history
…_liquidity
  • Loading branch information
leohscl committed Oct 7, 2024
2 parents dd7f93e + b3881b8 commit dcced60
Show file tree
Hide file tree
Showing 3 changed files with 467 additions and 49 deletions.
4 changes: 2 additions & 2 deletions contracts/src/contracts/ramps/revolut/interface.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ pub struct Proof {
pub foo: felt252
}

#[derive(Drop, Copy, Hash, Serde, starknet::Store)]
#[derive(Drop, Copy, Hash, Serde, starknet::Store, Debug, PartialEq)]
pub struct LiquidityKey {
pub owner: ContractAddress,
pub offchain_id: OffchainId,
}

#[derive(Drop, Copy, Serde, starknet::Store)]
#[derive(Drop, Copy, Serde, starknet::Store, Debug, PartialEq)]
pub struct LiquidityShareRequest {
pub requestor: ContractAddress,
pub liquidity_key: LiquidityKey,
Expand Down
10 changes: 8 additions & 2 deletions contracts/src/contracts/ramps/revolut/revolut.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,14 @@ pub mod RevolutRamp {
}

fn _get_next_timestamp_key(self: @ContractState, after: u64) -> u64 {
// minus 1 in order to return `after` if it's already a valid key timestamp.
after - 1 + LOCK_DURATION_STEP - ((after - 1) % LOCK_DURATION_STEP)
if after.is_zero() {
0
} else {
// minus 1 in order to return `after` if it's already a valid key timestamp.
let increment_step = (after - 1) / LOCK_DURATION_STEP + 1;
// returns a multiple of LOCK_DURATION_STEP
LOCK_DURATION_STEP * increment_step
}
}
}
}
Loading

0 comments on commit dcced60

Please sign in to comment.