Skip to content

Commit

Permalink
chore: format code
Browse files Browse the repository at this point in the history
  • Loading branch information
0xted97 committed Sep 4, 2024
1 parent 84d7a13 commit 04fc7d5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/data/data_store.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ trait IDataStore<TContractState> {


/// Returns the number of withdrawals
fn get_withdrawal_count(self: @TContractState) ->u32;
fn get_withdrawal_count(self: @TContractState) -> u32;

/// Returns the number of withdrawals made by a specific account.
///
Expand Down
14 changes: 6 additions & 8 deletions src/market/market_utils.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -1492,10 +1492,9 @@ fn validate_reserve(
let max_reserved_usd = apply_factor_u256(pool_usd, reserve_factor);

let reserved_usd = get_reserved_usd(data_store, market, prices, is_long);

// if (reserved_usd > max_reserved_usd) {
// MarketError::INSUFFICIENT_RESERVE(reserved_usd, max_reserved_usd);
// }
// if (reserved_usd > max_reserved_usd) {
// MarketError::INSUFFICIENT_RESERVE(reserved_usd, max_reserved_usd);
// }
}


Expand Down Expand Up @@ -1657,10 +1656,9 @@ fn validate_open_interest_reserve(
let max_reserved_usd: u256 = apply_factor_u256(pool_usd, reserve_factor);

let reserved_usd: u256 = get_reserved_usd(data_store, market, prices, is_long);

// if (reserved_usd > max_reserved_usd) {
// MarketError::INSUFFICIENT_RESERVE(reserved_usd, max_reserved_usd);
// }
// if (reserved_usd > max_reserved_usd) {
// MarketError::INSUFFICIENT_RESERVE(reserved_usd, max_reserved_usd);
// }
}

// @notice Get the next borrowing fees for a position.
Expand Down
25 changes: 9 additions & 16 deletions src/router/exchange_router.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,7 @@ mod ExchangeRouter {
}

self.deposit_handler.read().cancel_deposit(key);

// global_reentrancy_guard::non_reentrant_after(data_store);
// global_reentrancy_guard::non_reentrant_after(data_store);
}

fn create_withdrawal(ref self: ContractState, params: CreateWithdrawalParams) -> felt252 {
Expand All @@ -339,8 +338,7 @@ mod ExchangeRouter {
}

self.withdrawal_handler.read().cancel_withdrawal(key);

// global_reentrancy_guard::non_reentrant_after(data_store);
// global_reentrancy_guard::non_reentrant_after(data_store);
}

fn create_order(ref self: ContractState, params: CreateOrderParams) -> felt252 {
Expand All @@ -365,8 +363,7 @@ mod ExchangeRouter {
callback_utils::set_saved_callback_contract(
data_store, get_caller_address(), market, callback_contract
);

// global_reentrancy_guard::non_reentrant_after(data_store);
// global_reentrancy_guard::non_reentrant_after(data_store);
}

fn simulate_execute_deposit(
Expand All @@ -376,8 +373,7 @@ mod ExchangeRouter {
// global_reentrancy_guard::non_reentrant_before(data_store);

self.deposit_handler.read().simulate_execute_deposit(key, simulated_oracle_params);

// global_reentrancy_guard::non_reentrant_after(data_store);
// global_reentrancy_guard::non_reentrant_after(data_store);
}

fn simulate_execute_withdrawal(
Expand All @@ -390,8 +386,7 @@ mod ExchangeRouter {
.withdrawal_handler
.read()
.simulate_execute_withdrawal(key, simulated_oracle_params);

// global_reentrancy_guard::non_reentrant_after(data_store);
// global_reentrancy_guard::non_reentrant_after(data_store);
}

fn simulate_execute_order(
Expand All @@ -401,8 +396,7 @@ mod ExchangeRouter {
// global_reentrancy_guard::non_reentrant_before(data_store);

self.order_handler.read().simulate_execute_order(key, simulated_oracle_params);

// global_reentrancy_guard::non_reentrant_after(data_store);
// global_reentrancy_guard::non_reentrant_after(data_store);
}

// fn update_order(
Expand All @@ -414,7 +408,7 @@ mod ExchangeRouter {
// min_output_amout: u256
// ) {
// let data_store = self.data_store.read();
// global_reentrancy_guard::non_reentrant_before(data_store);
// global_reentrancy_guard::non_reentrant_before(data_store);

// let order = data_store.get_order(key);

Expand All @@ -433,7 +427,7 @@ mod ExchangeRouter {

// fn cancel_order(ref self: ContractState, key: felt252) {
// let data_store = self.data_store.read();
// global_reentrancy_guard::non_reentrant_before(data_store);
// global_reentrancy_guard::non_reentrant_before(data_store);

// let order = data_store.get_order(key);

Expand Down Expand Up @@ -597,8 +591,7 @@ mod ExchangeRouter {
market_utils::set_ui_fee_factor(
data_store, self.event_emitter.read(), account, ui_fee_factor
);

// global_reentrancy_guard::non_reentrant_after(data_store);
// global_reentrancy_guard::non_reentrant_after(data_store);
}

fn claim_ui_fees(
Expand Down

0 comments on commit 04fc7d5

Please sign in to comment.