ran cargo fmt
This commit is contained in:
parent
3045d7b1df
commit
1526301d0d
|
@ -283,7 +283,7 @@ pub enum LendingInstruction {
|
|||
/// 2. `[writable]` Reserve account.
|
||||
/// 3. `[]` Lending market account.
|
||||
/// 4. `[]` Derived lending market authority.
|
||||
/// 5. `[]` Flash loan receiver program account.
|
||||
/// 5. `[]` Flash loan receiver program account.
|
||||
/// Must implement an instruction that has tag of 0 and a signature of `(repay_amount: u64)`
|
||||
/// This instruction must return the amount to the source liquidity account.
|
||||
/// 6. `[]` Token program id.
|
||||
|
|
|
@ -1656,7 +1656,9 @@ fn process_flash_loan(program_id: &Pubkey, amount: u64, accounts: &[AccountInfo]
|
|||
msg!("Insufficient reserve liquidity after flash loan");
|
||||
return Err(LendingError::NotEnoughLiquidityAfterFlashLoan.into());
|
||||
}
|
||||
reserve.liquidity.repay(flash_loan_amount, flash_loan_amount_decimal)?;
|
||||
reserve
|
||||
.liquidity
|
||||
.repay(flash_loan_amount, flash_loan_amount_decimal)?;
|
||||
|
||||
let mut owner_fee = origination_fee;
|
||||
if host_fee > 0 {
|
||||
|
|
|
@ -644,7 +644,11 @@ impl ReserveFees {
|
|||
&self,
|
||||
flash_loan_amount: Decimal,
|
||||
) -> Result<(u64, u64), ProgramError> {
|
||||
self.calculate_fees(flash_loan_amount, self.flash_loan_fee_wad, FeeCalculation::Exclusive)
|
||||
self.calculate_fees(
|
||||
flash_loan_amount,
|
||||
self.flash_loan_fee_wad,
|
||||
FeeCalculation::Exclusive,
|
||||
)
|
||||
}
|
||||
|
||||
fn calculate_fees(
|
||||
|
|
|
@ -73,10 +73,16 @@ async fn test_success() {
|
|||
|
||||
let before_flash_loan_reserve_liquidity_token_balance =
|
||||
get_token_balance(&mut banks_client, usdc_reserve.liquidity_supply_pubkey).await;
|
||||
assert_eq!(before_flash_loan_reserve_liquidity_token_balance, INITIAL_RESERVE_LIQUIDITY);
|
||||
assert_eq!(
|
||||
before_flash_loan_reserve_liquidity_token_balance,
|
||||
INITIAL_RESERVE_LIQUIDITY
|
||||
);
|
||||
|
||||
let before_flash_loan_reserve = usdc_reserve.get_state(&mut banks_client).await;
|
||||
assert_eq!(before_flash_loan_reserve.liquidity.available_amount, INITIAL_RESERVE_LIQUIDITY);
|
||||
let before_flash_loan_reserve = usdc_reserve.get_state(&mut banks_client).await;
|
||||
assert_eq!(
|
||||
before_flash_loan_reserve.liquidity.available_amount,
|
||||
INITIAL_RESERVE_LIQUIDITY
|
||||
);
|
||||
|
||||
let before_flash_loan_token_balance =
|
||||
get_token_balance(&mut banks_client, program_owned_token_account).await;
|
||||
|
@ -108,10 +114,16 @@ async fn test_success() {
|
|||
|
||||
let after_flash_loan_reserve_liquidity_token_balance =
|
||||
get_token_balance(&mut banks_client, usdc_reserve.liquidity_supply_pubkey).await;
|
||||
assert_eq!(after_flash_loan_reserve_liquidity_token_balance, INITIAL_RESERVE_LIQUIDITY);
|
||||
assert_eq!(
|
||||
after_flash_loan_reserve_liquidity_token_balance,
|
||||
INITIAL_RESERVE_LIQUIDITY
|
||||
);
|
||||
|
||||
let after_flash_loan_reserve = usdc_reserve.get_state(&mut banks_client).await;
|
||||
assert_eq!(after_flash_loan_reserve.liquidity.available_amount, INITIAL_RESERVE_LIQUIDITY);
|
||||
let after_flash_loan_reserve = usdc_reserve.get_state(&mut banks_client).await;
|
||||
assert_eq!(
|
||||
after_flash_loan_reserve.liquidity.available_amount,
|
||||
INITIAL_RESERVE_LIQUIDITY
|
||||
);
|
||||
|
||||
let after_flash_loan_token_balance =
|
||||
get_token_balance(&mut banks_client, program_owned_token_account).await;
|
||||
|
|
Loading…
Reference in New Issue