Skip to content

Commit 73260f0

Browse files
authored
update liquidation close factor as part of param updates (#74)
* update liquidation close factor as part of param updates * fix test
1 parent d1e3f50 commit 73260f0

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use std::{
1818
};
1919

2020
/// Percentage of an obligation that can be repaid during each liquidation call
21-
pub const LIQUIDATION_CLOSE_FACTOR: u8 = 50;
21+
pub const LIQUIDATION_CLOSE_FACTOR: u8 = 20;
2222

2323
/// Obligation borrow amount that is small enough to close out
2424
pub const LIQUIDATION_CLOSE_AMOUNT: u64 = 2;

token-lending/program/tests/liquidate_obligation.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ async fn test_success() {
3131
const SOL_DEPOSIT_AMOUNT_LAMPORTS: u64 = 100 * LAMPORTS_TO_SOL * INITIAL_COLLATERAL_RATIO;
3232
// 100 SOL * 80% LTV -> 80 SOL * 20 USDC -> 1600 USDC borrow
3333
const USDC_BORROW_AMOUNT_FRACTIONAL: u64 = 1_600 * FRACTIONAL_TO_USDC;
34-
// 1600 USDC * 50% -> 800 USDC liquidation
35-
const USDC_LIQUIDATION_AMOUNT_FRACTIONAL: u64 = USDC_BORROW_AMOUNT_FRACTIONAL / 2;
36-
// 800 USDC / 20 USDC per SOL -> 40 SOL + 10% bonus -> 44 SOL
37-
const SOL_LIQUIDATION_AMOUNT_LAMPORTS: u64 = 44 * LAMPORTS_TO_SOL * INITIAL_COLLATERAL_RATIO;
34+
// 1600 USDC * 20% -> 320 USDC liquidation
35+
const USDC_LIQUIDATION_AMOUNT_FRACTIONAL: u64 = USDC_BORROW_AMOUNT_FRACTIONAL / 5;
36+
// 320 USDC / 20 USDC per SOL -> 16 SOL + 10% bonus -> 17.6 SOL (88/5)
37+
const SOL_LIQUIDATION_AMOUNT_LAMPORTS: u64 =
38+
LAMPORTS_TO_SOL * INITIAL_COLLATERAL_RATIO * 88 / 5;
3839

3940
const SOL_RESERVE_COLLATERAL_LAMPORTS: u64 = 2 * SOL_DEPOSIT_AMOUNT_LAMPORTS;
4041
const USDC_RESERVE_LIQUIDITY_FRACTIONAL: u64 = 2 * USDC_BORROW_AMOUNT_FRACTIONAL;

0 commit comments

Comments
 (0)