Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 1526301

Browse files
committed
ran cargo fmt
1 parent 3045d7b commit 1526301

File tree

4 files changed

+27
-9
lines changed

4 files changed

+27
-9
lines changed

token-lending/program/src/instruction.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ pub enum LendingInstruction {
283283
/// 2. `[writable]` Reserve account.
284284
/// 3. `[]` Lending market account.
285285
/// 4. `[]` Derived lending market authority.
286-
/// 5. `[]` Flash loan receiver program account.
286+
/// 5. `[]` Flash loan receiver program account.
287287
/// Must implement an instruction that has tag of 0 and a signature of `(repay_amount: u64)`
288288
/// This instruction must return the amount to the source liquidity account.
289289
/// 6. `[]` Token program id.

token-lending/program/src/processor.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1656,7 +1656,9 @@ fn process_flash_loan(program_id: &Pubkey, amount: u64, accounts: &[AccountInfo]
16561656
msg!("Insufficient reserve liquidity after flash loan");
16571657
return Err(LendingError::NotEnoughLiquidityAfterFlashLoan.into());
16581658
}
1659-
reserve.liquidity.repay(flash_loan_amount, flash_loan_amount_decimal)?;
1659+
reserve
1660+
.liquidity
1661+
.repay(flash_loan_amount, flash_loan_amount_decimal)?;
16601662

16611663
let mut owner_fee = origination_fee;
16621664
if host_fee > 0 {

token-lending/program/src/state/reserve.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,11 @@ impl ReserveFees {
644644
&self,
645645
flash_loan_amount: Decimal,
646646
) -> Result<(u64, u64), ProgramError> {
647-
self.calculate_fees(flash_loan_amount, self.flash_loan_fee_wad, FeeCalculation::Exclusive)
647+
self.calculate_fees(
648+
flash_loan_amount,
649+
self.flash_loan_fee_wad,
650+
FeeCalculation::Exclusive,
651+
)
648652
}
649653

650654
fn calculate_fees(

token-lending/program/tests/flash_loan.rs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,16 @@ async fn test_success() {
7373

7474
let before_flash_loan_reserve_liquidity_token_balance =
7575
get_token_balance(&mut banks_client, usdc_reserve.liquidity_supply_pubkey).await;
76-
assert_eq!(before_flash_loan_reserve_liquidity_token_balance, INITIAL_RESERVE_LIQUIDITY);
76+
assert_eq!(
77+
before_flash_loan_reserve_liquidity_token_balance,
78+
INITIAL_RESERVE_LIQUIDITY
79+
);
7780

78-
let before_flash_loan_reserve = usdc_reserve.get_state(&mut banks_client).await;
79-
assert_eq!(before_flash_loan_reserve.liquidity.available_amount, INITIAL_RESERVE_LIQUIDITY);
81+
let before_flash_loan_reserve = usdc_reserve.get_state(&mut banks_client).await;
82+
assert_eq!(
83+
before_flash_loan_reserve.liquidity.available_amount,
84+
INITIAL_RESERVE_LIQUIDITY
85+
);
8086

8187
let before_flash_loan_token_balance =
8288
get_token_balance(&mut banks_client, program_owned_token_account).await;
@@ -108,10 +114,16 @@ async fn test_success() {
108114

109115
let after_flash_loan_reserve_liquidity_token_balance =
110116
get_token_balance(&mut banks_client, usdc_reserve.liquidity_supply_pubkey).await;
111-
assert_eq!(after_flash_loan_reserve_liquidity_token_balance, INITIAL_RESERVE_LIQUIDITY);
117+
assert_eq!(
118+
after_flash_loan_reserve_liquidity_token_balance,
119+
INITIAL_RESERVE_LIQUIDITY
120+
);
112121

113-
let after_flash_loan_reserve = usdc_reserve.get_state(&mut banks_client).await;
114-
assert_eq!(after_flash_loan_reserve.liquidity.available_amount, INITIAL_RESERVE_LIQUIDITY);
122+
let after_flash_loan_reserve = usdc_reserve.get_state(&mut banks_client).await;
123+
assert_eq!(
124+
after_flash_loan_reserve.liquidity.available_amount,
125+
INITIAL_RESERVE_LIQUIDITY
126+
);
115127

116128
let after_flash_loan_token_balance =
117129
get_token_balance(&mut banks_client, program_owned_token_account).await;

0 commit comments

Comments
 (0)