Skip to content

Commit 103b592

Browse files
committed
fix tests
1 parent 02b699e commit 103b592

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

token-lending/program/tests/liquidate_obligation.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use solana_sdk::{
1212
use 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
};
1717
use 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;

token-lending/program/tests/liquidate_obligation_and_redeem_collateral.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use solana_sdk::{
1212
use 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
};
1717
use 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;

0 commit comments

Comments
 (0)