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::{
12
12
use solend_program:: {
13
13
instruction:: { liquidate_obligation, refresh_obligation} ,
14
14
processor:: process_instruction,
15
- state:: INITIAL_COLLATERAL_RATIO ,
15
+ state:: { INITIAL_COLLATERAL_RATIO , LIQUIDATION_CLOSE_FACTOR } ,
16
16
} ;
17
17
use spl_token:: instruction:: approve;
18
18
@@ -32,10 +32,10 @@ async fn test_success() {
32
32
// 100 SOL * 80% LTV -> 80 SOL * 20 USDC -> 1600 USDC borrow
33
33
const USDC_BORROW_AMOUNT_FRACTIONAL : u64 = 1_600 * FRACTIONAL_TO_USDC ;
34
34
// 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 ;
36
36
// 320 USDC / 20 USDC per SOL -> 16 SOL + 10% bonus -> 17.6 SOL (88/5)
37
37
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 ;
39
39
40
40
const SOL_RESERVE_COLLATERAL_LAMPORTS : u64 = 2 * SOL_DEPOSIT_AMOUNT_LAMPORTS ;
41
41
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::{
12
12
use solend_program:: {
13
13
instruction:: { liquidate_obligation_and_redeem_reserve_collateral, refresh_obligation} ,
14
14
processor:: process_instruction,
15
- state:: INITIAL_COLLATERAL_RATIO ,
15
+ state:: { INITIAL_COLLATERAL_RATIO , LIQUIDATION_CLOSE_FACTOR } ,
16
16
} ;
17
17
use std:: cmp:: max;
18
18
@@ -32,10 +32,10 @@ async fn test_success() {
32
32
// 100 SOL * 80% LTV -> 80 SOL * 20 USDC -> 1600 USDC borrow
33
33
const USDC_BORROW_AMOUNT_FRACTIONAL : u64 = 1_600 * FRACTIONAL_TO_USDC ;
34
34
// 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 ;
36
36
// 320 USDC / 20 USDC per SOL -> 16 SOL + 10% bonus -> 17.6 SOL (88/5)
37
37
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 ;
39
39
40
40
const SOL_RESERVE_COLLATERAL_LAMPORTS : u64 = 2 * SOL_DEPOSIT_AMOUNT_LAMPORTS ;
41
41
const USDC_RESERVE_LIQUIDITY_FRACTIONAL : u64 = 2 * USDC_BORROW_AMOUNT_FRACTIONAL ;
You can’t perform that action at this time.
0 commit comments