File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
token-lending/program/tests Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ use solana_sdk::{
1212use solend_program:: {
1313 instruction:: { liquidate_obligation, refresh_obligation} ,
1414 processor:: process_instruction,
15- state:: INITIAL_COLLATERAL_RATIO ,
15+ state:: { INITIAL_COLLATERAL_RATIO , LIQUIDATION_CLOSE_FACTOR } ,
1616} ;
1717use spl_token:: instruction:: approve;
1818
@@ -32,10 +32,10 @@ async fn test_success() {
3232 // 100 SOL * 80% LTV -> 80 SOL * 20 USDC -> 1600 USDC borrow
3333 const USDC_BORROW_AMOUNT_FRACTIONAL : u64 = 1_600 * FRACTIONAL_TO_USDC ;
3434 // 1600 USDC * 20% -> 320 USDC liquidation
35- const USDC_LIQUIDATION_AMOUNT_FRACTIONAL : u64 = USDC_BORROW_AMOUNT_FRACTIONAL / 5 ;
35+ const USDC_LIQUIDATION_AMOUNT_FRACTIONAL : u64 = USDC_BORROW_AMOUNT_FRACTIONAL * ( LIQUIDATION_CLOSE_FACTOR as u64 ) / 100 ;
3636 // 320 USDC / 20 USDC per SOL -> 16 SOL + 10% bonus -> 17.6 SOL (88/5)
3737 const SOL_LIQUIDATION_AMOUNT_LAMPORTS : u64 =
38- LAMPORTS_TO_SOL * INITIAL_COLLATERAL_RATIO * 88 / 5 ;
38+ LAMPORTS_TO_SOL * INITIAL_COLLATERAL_RATIO * 88 * ( LIQUIDATION_CLOSE_FACTOR as u64 ) / 100 ;
3939
4040 const SOL_RESERVE_COLLATERAL_LAMPORTS : u64 = 2 * SOL_DEPOSIT_AMOUNT_LAMPORTS ;
4141 const USDC_RESERVE_LIQUIDITY_FRACTIONAL : u64 = 2 * USDC_BORROW_AMOUNT_FRACTIONAL ;
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ use solana_sdk::{
1212use solend_program:: {
1313 instruction:: { liquidate_obligation_and_redeem_reserve_collateral, refresh_obligation} ,
1414 processor:: process_instruction,
15- state:: INITIAL_COLLATERAL_RATIO ,
15+ state:: { INITIAL_COLLATERAL_RATIO , LIQUIDATION_CLOSE_FACTOR } ,
1616} ;
1717use std:: cmp:: max;
1818
@@ -32,10 +32,10 @@ async fn test_success() {
3232 // 100 SOL * 80% LTV -> 80 SOL * 20 USDC -> 1600 USDC borrow
3333 const USDC_BORROW_AMOUNT_FRACTIONAL : u64 = 1_600 * FRACTIONAL_TO_USDC ;
3434 // 1600 USDC * 20% -> 320 USDC liquidation
35- const USDC_LIQUIDATION_AMOUNT_FRACTIONAL : u64 = USDC_BORROW_AMOUNT_FRACTIONAL / 5 ;
35+ const USDC_LIQUIDATION_AMOUNT_FRACTIONAL : u64 = USDC_BORROW_AMOUNT_FRACTIONAL * ( LIQUIDATION_CLOSE_FACTOR as u64 ) / 100 ;
3636 // 320 USDC / 20 USDC per SOL -> 16 SOL + 10% bonus -> 17.6 SOL (88/5)
3737 const SOL_LIQUIDATION_AMOUNT_LAMPORTS : u64 =
38- LAMPORTS_TO_SOL * INITIAL_COLLATERAL_RATIO * 88 / 5 ;
38+ LAMPORTS_TO_SOL * INITIAL_COLLATERAL_RATIO * 88 * ( LIQUIDATION_CLOSE_FACTOR as u64 ) / 100 ;
3939
4040 const SOL_RESERVE_COLLATERAL_LAMPORTS : u64 = 2 * SOL_DEPOSIT_AMOUNT_LAMPORTS ;
4141 const USDC_RESERVE_LIQUIDITY_FRACTIONAL : u64 = 2 * USDC_BORROW_AMOUNT_FRACTIONAL ;
You can’t perform that action at this time.
0 commit comments