diff --git a/src/deposit/execute_deposit_utils.cairo b/src/deposit/execute_deposit_utils.cairo index 4d426ad5..e88b3395 100644 --- a/src/deposit/execute_deposit_utils.cairo +++ b/src/deposit/execute_deposit_utils.cairo @@ -259,7 +259,6 @@ fn execute_deposit(params: ExecuteDepositParams) { /// # Arguments /// * `params` - @ExecuteDepositParams. /// * `_params` - @_ExecuteDepositParams. -#[inline(always)] fn execute_deposit_helper( params: @ExecuteDepositParams, ref _params: _ExecuteDepositParams ) -> u128 { @@ -460,7 +459,6 @@ fn execute_deposit_helper( mint_amount } -#[inline(always)] fn swap( params: @ExecuteDepositParams, swap_path: Span32, diff --git a/src/event/event_emitter.cairo b/src/event/event_emitter.cairo index c45fb292..648b48fb 100755 --- a/src/event/event_emitter.cairo +++ b/src/event/event_emitter.cairo @@ -122,7 +122,6 @@ trait IEventEmitter { ); /// Emits the `DepositCreated` event. - #[inline(always)] fn emit_deposit_created(ref self: TContractState, key: felt252, deposit: Deposit); /// Emits the `DepositExecuted` event. @@ -140,7 +139,6 @@ trait IEventEmitter { ); /// Emits the `WithdrawalCreated` event. - #[inline(always)] fn emit_withdrawal_created(ref self: TContractState, key: felt252, withdrawal: Withdrawal); /// Emits the `WithdrawalExecuted` event. @@ -152,11 +150,9 @@ trait IEventEmitter { ); /// Emits the `PositionIncrease` event. - #[inline(always)] fn emit_position_increase(ref self: TContractState, params: PositionIncreaseParams); /// Emits the `PositionDecrease` event. - #[inline(always)] fn emit_position_decrease( ref self: TContractState, order_key: felt252, @@ -190,7 +186,6 @@ trait IEventEmitter { ); /// Emits the `PositionFeesCollected` event. - #[inline(always)] fn emit_position_fees_collected( ref self: TContractState, order_key: felt252, @@ -203,7 +198,6 @@ trait IEventEmitter { ); /// Emits the `PositionFeesInfo` event. - #[inline(always)] fn emit_position_fees_info( ref self: TContractState, order_key: felt252, @@ -216,7 +210,6 @@ trait IEventEmitter { ); /// Emits the `OrderCreated` event. - #[inline(always)] fn emit_order_created(ref self: TContractState, key: felt252, order: Order); /// Emits the `OrderExecuted` event. @@ -434,7 +427,6 @@ trait IEventEmitter { ); /// Emits the `MarketPoolValueInfo` event. - #[inline(always)] fn emit_market_pool_value_info( ref self: TContractState, market: ContractAddress, @@ -592,7 +584,6 @@ trait IEventEmitter { ); /// Emits the `SwapFeesCollected` event. - #[inline(always)] fn emit_swap_fees_collected( ref self: TContractState, market: ContractAddress, @@ -1700,7 +1691,6 @@ mod EventEmitter { } /// Emits the `DepositCreated` event. - #[inline(always)] fn emit_deposit_created(ref self: ContractState, key: felt252, deposit: Deposit) { self .emit( @@ -1782,7 +1772,6 @@ mod EventEmitter { /// Emits the `PositionIncrease` event. /// # Arguments /// * `params` - The position increase parameters. - #[inline(always)] fn emit_position_increase(ref self: ContractState, params: PositionIncreaseParams) { self .emit( @@ -1830,7 +1819,6 @@ mod EventEmitter { /// * `values` - The parameters linked to the decrease of collateral. /// * `index_token_price` - The price of the index token. /// * `collateral_token_price` - The price of the collateral token. - #[inline(always)] fn emit_position_decrease( ref self: ContractState, order_key: felt252, @@ -2427,7 +2415,6 @@ mod EventEmitter { } /// Emits the `MarketPoolValueInfo` event. - #[inline(always)] fn emit_market_pool_value_info( ref self: ContractState, market: ContractAddress, @@ -2680,7 +2667,6 @@ mod EventEmitter { } /// Emits the `SwapFeesCollected` event. - #[inline(always)] fn emit_swap_fees_collected( ref self: ContractState, market: ContractAddress, diff --git a/src/event/event_utils.cairo b/src/event/event_utils.cairo index f2df87d3..5aca65c0 100644 --- a/src/event/event_utils.cairo +++ b/src/event/event_utils.cairo @@ -17,7 +17,6 @@ use alexandria_data_structures::array_ext::SpanTraitExt; // impl Felt252IntoBool of Into { - #[inline(always)] fn into(self: felt252) -> bool { let as_u128: u128 = self.try_into().expect('u128 Overflow'); as_u128 > 0 @@ -25,35 +24,30 @@ impl Felt252IntoBool of Into { } impl Felt252IntoU128 of Into { - #[inline(always)] fn into(self: felt252) -> u128 { self.try_into().expect('u128 Overflow') } } impl Felt252IntoI128 of Into { - #[inline(always)] fn into(self: felt252) -> i128 { self.try_into().expect('i128 Overflow') } } impl Felt252IntoContractAddress of Into { - #[inline(always)] fn into(self: felt252) -> ContractAddress { Felt252TryIntoContractAddress::try_into(self).expect('contractaddress overflow') } } impl I128252DictValue of Felt252DictValue { - #[inline(always)] fn zero_default() -> i128 nopanic { i128 { mag: 0, sign: false } } } impl ContractAddressDictValue of Felt252DictValue { - #[inline(always)] fn zero_default() -> ContractAddress nopanic { contract_address_const::<0>() } diff --git a/src/oracle/oracle_modules.cairo b/src/oracle/oracle_modules.cairo index a79bea33..fbf971b1 100644 --- a/src/oracle/oracle_modules.cairo +++ b/src/oracle/oracle_modules.cairo @@ -29,7 +29,6 @@ use satoru::oracle::error::OracleError; /// * `dataStore` - `DataStore` contract dispatcher /// * `eventEmitter` - `EventEmitter` contract dispatcher /// * `params` - parameters used to set oracle price -#[inline(always)] fn with_oracle_prices_before( oracle: IOracleDispatcher, data_store: IDataStoreDispatcher, @@ -39,7 +38,6 @@ fn with_oracle_prices_before( oracle.set_prices(data_store, event_emitter, params.clone()); } -#[inline(always)] fn with_oracle_prices_after(oracle: IOracleDispatcher) { oracle.clear_all_prices(); } @@ -73,7 +71,6 @@ fn with_simulated_oracle_prices_before(oracle: IOracleDispatcher, params: Simula }; } -#[inline(always)] fn with_simulated_oracle_prices_after() { OracleError::END_OF_ORACLE_SIMULATION(); } diff --git a/src/order/base_order_utils.cairo b/src/order/base_order_utils.cairo index f222495e..d19cb216 100644 --- a/src/order/base_order_utils.cairo +++ b/src/order/base_order_utils.cairo @@ -144,7 +144,6 @@ struct GetExecutionPriceCache { /// * `order_type` - The order type. /// # Return /// Return whether an order_type is a market order -#[inline(always)] fn is_market_order(order_type: OrderType) -> bool { // a liquidation order is not considered as a market order order_type == OrderType::MarketSwap @@ -157,7 +156,6 @@ fn is_market_order(order_type: OrderType) -> bool { /// * `order_type` - The order type. /// # Return /// Return whether an order_type is a limit order -#[inline(always)] fn is_limit_order(order_type: OrderType) -> bool { order_type == OrderType::LimitSwap || order_type == OrderType::LimitIncrease @@ -169,7 +167,6 @@ fn is_limit_order(order_type: OrderType) -> bool { /// * `order_type` - The order type. /// # Return /// Return whether an order_type is a swap order -#[inline(always)] fn is_swap_order(order_type: OrderType) -> bool { order_type == OrderType::MarketSwap || order_type == OrderType::LimitSwap } @@ -179,7 +176,6 @@ fn is_swap_order(order_type: OrderType) -> bool { /// * `order_type` - The order type. /// # Return /// Return whether an order_type is a position order -#[inline(always)] fn is_position_order(order_type: OrderType) -> bool { is_increase_order(order_type) || is_decrease_order(order_type) } @@ -189,7 +185,6 @@ fn is_position_order(order_type: OrderType) -> bool { /// * `order_type` - The order type. /// # Return /// Return whether an order_type is an increase order -#[inline(always)] fn is_increase_order(order_type: OrderType) -> bool { order_type == OrderType::MarketIncrease || order_type == OrderType::LimitIncrease } @@ -199,7 +194,6 @@ fn is_increase_order(order_type: OrderType) -> bool { /// * `order_type` - The order type. /// # Return /// Return whether an order_type is a decrease order -#[inline(always)] fn is_decrease_order(order_type: OrderType) -> bool { order_type == OrderType::MarketDecrease || order_type == OrderType::LimitDecrease @@ -212,7 +206,6 @@ fn is_decrease_order(order_type: OrderType) -> bool { /// * `order_type` - The order type. /// # Return /// Return whether an order_type is a liquidation order -#[inline(always)] fn is_liquidation_order(order_type: OrderType) -> bool { order_type == OrderType::Liquidation } @@ -227,7 +220,6 @@ fn is_liquidation_order(order_type: OrderType) -> bool { /// * `order_type` - The order type. /// * `trigger_price` - the order's trigger_price. /// * `is_long` - Whether the order is for a long or short. -#[inline(always)] fn validate_order_trigger_price( oracle: IOracleDispatcher, index_token: ContractAddress, @@ -345,7 +337,6 @@ fn get_execution_price_for_increase( 0 // doesn't compile otherwise } -#[inline(always)] fn get_execution_price_for_decrease( index_token_price: Price, position_size_in_usd: u128, @@ -480,7 +471,6 @@ fn get_execution_price_for_decrease( /// Validates that an order exists. /// # Arguments /// * `order` - The order to check. -#[inline(always)] fn validate_non_empty_order(order: @Order) { assert((*order.account).is_non_zero(), OrderError::EMPTY_ORDER); assert( diff --git a/src/order/decrease_order_utils.cairo b/src/order/decrease_order_utils.cairo index ec734611..99c1e901 100644 --- a/src/order/decrease_order_utils.cairo +++ b/src/order/decrease_order_utils.cairo @@ -31,7 +31,6 @@ use satoru::swap::swap_handler::{ISwapHandlerDispatcher, ISwapHandlerDispatcherT // This function should return an EventLogData cause the callback_utils // needs it. We need to find a solution for that case. -#[inline(always)] fn process_order( params: ExecuteOrderParams ) -> LogData { //TODO check with refactor with callback_utils @@ -136,7 +135,6 @@ fn process_order( /// * `order_updated_at_block` - The block at which the order was last updated. /// * `position_increased_at_block` - The block at which the position was last increased. /// * `position_decrease_at_block` - The block at which the position was last decreased. -#[inline(always)] fn validate_oracle_block_numbers( min_oracle_block_numbers: Span, max_oracle_block_numbers: Span, @@ -216,7 +214,6 @@ fn validate_output_amount_secondary( } } -#[inline(always)] fn handle_swap_error( oracle: IOracleDispatcher, order: Order, diff --git a/src/order/increase_order_utils.cairo b/src/order/increase_order_utils.cairo index 9203000e..ccdd5463 100644 --- a/src/order/increase_order_utils.cairo +++ b/src/order/increase_order_utils.cairo @@ -23,7 +23,6 @@ use alexandria_data_structures::array_ext::SpanTraitExt; /// * `EventLogData` - The event log data. /// This function should return an EventLogData cause the callback_utils /// needs it. We need to find a solution for that case. -#[inline(always)] fn process_order(params: ExecuteOrderParams) -> event_utils::LogData { market_utils::validate_position_market(params.contracts.data_store, params.market.market_token); diff --git a/src/order/order_utils.cairo b/src/order/order_utils.cairo index e2668772..b7cf4b3c 100644 --- a/src/order/order_utils.cairo +++ b/src/order/order_utils.cairo @@ -146,7 +146,6 @@ fn create_order( //TODO and fix when fee_token is implememted /// Executes an order. /// # Arguments /// * `params` - The parameters used to execute the order. -#[inline(always)] fn execute_order(params: ExecuteOrderParams) { // 63/64 gas is forwarded to external calls, reduce the startingGas to account for this // TODO GAS NOT AVAILABLE params.startingGas -= gasleft() / 63; diff --git a/src/order/swap_order_utils.cairo b/src/order/swap_order_utils.cairo index b79e146c..8166e46c 100644 --- a/src/order/swap_order_utils.cairo +++ b/src/order/swap_order_utils.cairo @@ -17,7 +17,6 @@ use satoru::bank::bank::{IBankDispatcher, IBankDispatcherTrait}; use satoru::utils::span32::{Span32, DefaultSpan32}; use satoru::oracle::error::OracleError; -#[inline(always)] fn process_order(params: ExecuteOrderParams) -> LogData { if (params.order.market.is_non_zero()) { panic(array![OrderError::UNEXPECTED_MARKET]); @@ -63,7 +62,6 @@ fn process_order(params: ExecuteOrderParams) -> LogData { /// * `max_oracle_block_numbers` - The max oracle block numbers. /// * `order_type` - The order type. /// * `order_updated_at_block` - the block at which the order was last updated. -#[inline(always)] fn validate_oracle_block_numbers( min_oracle_block_numbers: Span, max_oracle_block_numbers: Span, diff --git a/src/position/decrease_position_collateral_utils.cairo b/src/position/decrease_position_collateral_utils.cairo index f5613794..70551c9f 100644 --- a/src/position/decrease_position_collateral_utils.cairo +++ b/src/position/decrease_position_collateral_utils.cairo @@ -55,7 +55,6 @@ struct GetExecutionPriceCache { /// Handle the collateral changes of the position. /// # Returns /// The values linked to the process of a decrease of collateral and position fees. -#[inline(always)] fn process_collateral( mut params: position_utils::UpdatePositionParams, cache: position_utils::DecreasePositionCache ) -> (position_utils::DecreasePositionCollateralValues, position_pricing_utils::PositionFees) { diff --git a/src/position/decrease_position_swap_utils.cairo b/src/position/decrease_position_swap_utils.cairo index e4e0349e..6d774e27 100644 --- a/src/position/decrease_position_swap_utils.cairo +++ b/src/position/decrease_position_swap_utils.cairo @@ -65,7 +65,6 @@ fn swap_withdrawn_collateral_to_pnl_token( /// * `pnl_amount` - The amount of profit in usd. /// # Returns /// DecreasePositionCollateralValues -#[inline(always)] fn swap_profit_to_collateral_token( params: UpdatePositionParams, pnl_token: ContractAddress, profit_amount: u128 ) -> (bool, u128) { diff --git a/src/price/price.cairo b/src/price/price.cairo index a8b38eea..20533d07 100644 --- a/src/price/price.cairo +++ b/src/price/price.cairo @@ -64,11 +64,9 @@ impl PriceZeroable of Zeroable { fn zero() -> Price { Price { min: 0, max: 0 } } - #[inline(always)] fn is_zero(self: Price) -> bool { self.min == 0 && self.max == 0 } - #[inline(always)] fn is_non_zero(self: Price) -> bool { !self.is_zero() } diff --git a/src/referral/referral_utils.cairo b/src/referral/referral_utils.cairo index 35b686a0..d3aedc1a 100644 --- a/src/referral/referral_utils.cairo +++ b/src/referral/referral_utils.cairo @@ -24,7 +24,6 @@ use satoru::referral::referral_tier::ReferralTier; /// * `referral_storage` - The referral storage instance to use. /// * `account` - The account of the trader. /// * `referral_code` - The referral code. -#[inline(always)] fn set_trader_referral_code( referral_storage: IReferralStorageDispatcher, account: ContractAddress, referral_code: felt252 ) { diff --git a/src/role/role_store.cairo b/src/role/role_store.cairo index 4e00399f..3d5a341b 100644 --- a/src/role/role_store.cairo +++ b/src/role/role_store.cairo @@ -257,12 +257,10 @@ mod RoleStore { // ************************************************************************* #[generate_trait] impl InternalFunctions of InternalFunctionsTrait { - #[inline(always)] fn _has_role(self: @ContractState, account: ContractAddress, role_key: felt252) -> bool { self.has_role.read((role_key, account)) } - #[inline(always)] fn _assert_only_role(self: @ContractState, account: ContractAddress, role_key: felt252) { assert(self._has_role(account, role_key), RoleError::UNAUTHORIZED_ACCESS); } diff --git a/src/utils/i128.cairo b/src/utils/i128.cairo index 5e63680e..0ac5f04a 100644 --- a/src/utils/i128.cairo +++ b/src/utils/i128.cairo @@ -265,7 +265,6 @@ impl Felt252TryIntoI128 of TryInto { impl I128Default of Default { - #[inline(always)] fn default() -> i128 { Zeroable::zero() } @@ -281,7 +280,6 @@ impl i128Add of Add { // Implements the AddEq trait for i128. impl i128AddEq of AddEq { - #[inline(always)] fn add_eq(ref self: i128, other: i128) { self = Add::add(self, other); } @@ -296,7 +294,6 @@ impl i128Sub of Sub { // Implements the SubEq trait for i128. impl i128SubEq of SubEq { - #[inline(always)] fn sub_eq(ref self: i128, other: i128) { self = Sub::sub(self, other); } @@ -311,7 +308,6 @@ impl i128Mul of Mul { // Implements the MulEq trait for i128. impl i128MulEq of MulEq { - #[inline(always)] fn mul_eq(ref self: i128, other: i128) { self = Mul::mul(self, other); } @@ -326,7 +322,6 @@ impl i128Div of Div { // Implements the DivEq trait for i128. impl i128DivEq of DivEq { - #[inline(always)] fn div_eq(ref self: i128, other: i128) { self = Div::div(self, other); } @@ -341,7 +336,6 @@ impl i128Rem of Rem { // Implements the RemEq trait for i128. impl i128RemEq of RemEq { - #[inline(always)] fn rem_eq(ref self: i128, other: i128) { self = Rem::rem(self, other); } @@ -386,11 +380,9 @@ impl i128Zeroable of Zeroable { fn zero() -> i128 { IntegerTrait::::new(0, false) } - #[inline(always)] fn is_zero(self: i128) -> bool { self == Zeroable::zero() } - #[inline(always)] fn is_non_zero(self: i128) -> bool { self != Zeroable::zero() } @@ -702,12 +694,10 @@ fn ensure_non_negative_zero(mag: u128, sign: bool) -> i128 { // Store::::read(address_domain, base)?.try_into().expect('I128Store - non i128') // ) // } -// #[inline(always)] -// fn write(address_domain: u32, base: StorageBaseAddress, value: i128) -> SyscallResult<()> { +// // fn write(address_domain: u32, base: StorageBaseAddress, value: i128) -> SyscallResult<()> { // Store::::write(address_domain, base, value.into()) // } -// #[inline(always)] -// fn read_at_offset( +// // fn read_at_offset( // address_domain: u32, base: StorageBaseAddress, offset: u8 // ) -> SyscallResult { // Result::Ok( @@ -716,14 +706,12 @@ fn ensure_non_negative_zero(mag: u128, sign: bool) -> i128 { // .expect('I128Store - non i128') // ) // } -// #[inline(always)] -// fn write_at_offset( +// // fn write_at_offset( // address_domain: u32, base: StorageBaseAddress, offset: u8, value: i128 // ) -> SyscallResult<()> { // Store::::write_at_offset(address_domain, base, offset, value.into()) // } -// #[inline(always)] -// fn size() -> u8 { +// // fn size() -> u8 { // 1_u8 // } // } diff --git a/src/utils/span32.cairo b/src/utils/span32.cairo index 328a49ba..11060dc9 100644 --- a/src/utils/span32.cairo +++ b/src/utils/span32.cairo @@ -54,31 +54,24 @@ impl Span32Serde< #[generate_trait] impl Span32Impl> of Span32Trait { - #[inline(always)] fn pop_front(ref self: Span32) -> Option<@T> { self.snapshot.pop_front() } - #[inline(always)] fn pop_back(ref self: Span32) -> Option<@T> { self.snapshot.pop_back() } - #[inline(always)] fn get(self: Span32, index: usize) -> Option> { self.snapshot.get(index) } - #[inline(always)] fn at(self: Span32, index: usize) -> @T { self.snapshot.at(index) } - #[inline(always)] fn slice(self: Span32, start: usize, length: usize) -> Span32 { Span32 { snapshot: self.snapshot.slice(start, length) } } - #[inline(always)] fn len(self: Span32) -> usize { self.snapshot.len() } - #[inline(always)] fn is_empty(self: Span32) -> bool { self.snapshot.is_empty() } @@ -91,7 +84,6 @@ impl DefaultSpan32> of Default> { } impl Span32Index of IndexView, usize, @T> { - #[inline(always)] fn index(self: @Span32, index: usize) -> @T { self.snapshot.index(index) } @@ -102,7 +94,6 @@ trait Array32Trait { } impl Array32 of Array32Trait { - #[inline(always)] fn span32(self: @Array) -> Span32 { assert(self.len() <= 32, 'array too big'); Span32 { snapshot: Span { snapshot: self } } diff --git a/src/utils/starknet_utils.cairo b/src/utils/starknet_utils.cairo index f7e0f235..958719f5 100644 --- a/src/utils/starknet_utils.cairo +++ b/src/utils/starknet_utils.cairo @@ -9,7 +9,6 @@ use array::ArrayTrait; /// gasleft() mock implementation. /// Accepts Array because we don't know how many parameters we need in future. /// In mock way, the first element of array returned as result of gasleft. -#[inline(always)] fn sn_gasleft(params: Array) -> u128 { if (params.len() == 0) { return 0_u128; @@ -24,7 +23,6 @@ fn sn_gasleft(params: Array) -> u128 { /// tx.gasprice mock implementation. /// If its mock implementation, returns first element of parameter as result. -#[inline(always)] fn sn_gasprice(params: Array) -> u128 { if (params.len() == 0) { return 0_u128; diff --git a/src/utils/traits.cairo b/src/utils/traits.cairo index b61244d7..5ca1de8f 100644 --- a/src/utils/traits.cairo +++ b/src/utils/traits.cairo @@ -1,7 +1,6 @@ use starknet::{ContractAddress, contract_address_const}; impl ContractAddressDefault of Default { - #[inline(always)] fn default() -> ContractAddress { contract_address_const::<0>() } diff --git a/src/withdrawal/withdrawal_utils.cairo b/src/withdrawal/withdrawal_utils.cairo index ac3c4c4e..44e6d8fa 100644 --- a/src/withdrawal/withdrawal_utils.cairo +++ b/src/withdrawal/withdrawal_utils.cairo @@ -113,7 +113,6 @@ struct SwapCache { /// * `params` - The parameters for creating the withdrawal. /// # Returns /// The unique identifier of the created withdrawal. -#[inline(always)] fn create_withdrawal( data_store: IDataStoreDispatcher, event_emitter: IEventEmitterDispatcher, @@ -197,7 +196,6 @@ fn create_withdrawal( /// Executes a withdrawal on the market. /// # Arguments /// * `params` - The parameters for executing the withdrawal. -#[inline(always)] fn execute_withdrawal( mut params: ExecuteWithdrawalParams ) { // 63/64 gas is forwarded to external calls, reduce the startingGas to account for this @@ -250,7 +248,6 @@ fn execute_withdrawal( /// * `keeper` - The keeper sending the transaction. /// * `starting_gas` - The starting gas for the transaction. /// * `reason` - The reason for cancelling. -#[inline(always)] fn cancel_withdrawal( data_store: IDataStoreDispatcher, event_emitter: IEventEmitterDispatcher, @@ -294,7 +291,6 @@ fn cancel_withdrawal( /// * `withdrawal` - The withdrawal to execute. /// # Returns /// The unique identifier of the created withdrawal. -#[inline(always)] fn execute_withdrawal_( params: @ExecuteWithdrawalParams, withdrawal: Withdrawal ) -> ExecuteWithdrawalResult { @@ -482,7 +478,6 @@ fn execute_withdrawal_( /// * `ui_fee_receiver` - The ui fee receiver. /// # Returns /// Output token and its amount. -#[inline(always)] fn swap( params: @ExecuteWithdrawalParams, market: Market, @@ -535,7 +530,6 @@ fn swap( (cache.output_token, cache.output_amount) } -#[inline(always)] fn get_output_amounts( params: @ExecuteWithdrawalParams, market: Market,