Skip to content

Commit e8de93b

Browse files
authored
Merge pull request #85 from mrgnlabs/superagg-update
bugfixes & improvements
2 parents f87cc45 + 394dafd commit e8de93b

File tree

2 files changed

+10
-21
lines changed

2 files changed

+10
-21
lines changed

src/liquidator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ impl Liquidator {
109109
self.run_liquidation.store(false, Ordering::Relaxed);
110110

111111
// TODO: come up with a better heuristics here
112-
if liquidation_rounds % 5 == 0 {
112+
if liquidation_rounds % 10 == 0 {
113113
if let Err(e) = self.liquidator_account.refresh_integrations() {
114114
error!("Integrations failed to refresh: {}", e);
115115
}

src/wrappers/liquidator_account.rs

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ use solana_sdk::{
4242
signature::{Keypair, Signature},
4343
signer::{Signer, SignerError},
4444
system_instruction::transfer,
45-
system_program,
4645
transaction::VersionedTransaction,
4746
};
4847
use std::{collections::HashSet, sync::Arc, thread, time::Duration};
@@ -305,7 +304,7 @@ impl LiquidatorAccount {
305304
} else {
306305
(
307306
*asset_amount,
308-
liab_amount.checked_mul(I80F48::from_num(0.925)).unwrap(),
307+
liab_amount.checked_mul(I80F48::from_num(0.915)).unwrap(),
309308
)
310309
};
311310

@@ -395,17 +394,10 @@ impl LiquidatorAccount {
395394
))
396395
.map_err(LiquidationError::from_anyhow)?;
397396

398-
let drift_oracle = if spot_market.market.mint
399-
== Pubkey::from_str_const("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v")
400-
{
401-
system_program::id()
402-
} else {
403-
spot_market.market.oracle
404-
};
405397
let refresh_spot_market_ix = make_refresh_spot_market_ix(
406398
spot_market_address,
407399
spot_market.market.vault,
408-
drift_oracle,
400+
spot_market.market.oracle,
409401
&mut participating_accounts,
410402
);
411403
ixs.push(refresh_spot_market_ix);
@@ -862,6 +854,10 @@ impl LiquidatorAccount {
862854
.for_each(|(address, reserve)| {
863855
let refresh_reserve_ix =
864856
make_refresh_reserve_ix(*address, reserve, &mut participating_accounts);
857+
debug!(
858+
"Refreshing: reserve {}, mint {}!!!",
859+
address, reserve.reserve.collateral.mint_pubkey
860+
);
865861

866862
ixs.push(refresh_reserve_ix);
867863
});
@@ -870,23 +866,15 @@ impl LiquidatorAccount {
870866
.drift_markets
871867
.iter()
872868
.for_each(|(address, spot_market)| {
873-
// TODO check
874-
let drift_oracle = if spot_market.market.mint
875-
== Pubkey::from_str_const("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v")
876-
{
877-
system_program::id()
878-
} else {
879-
spot_market.market.oracle
880-
};
881869
debug!(
882870
"Refreshing: market {}, mint {}, oracle {}!!!",
883-
address, spot_market.market.mint, drift_oracle
871+
address, spot_market.market.mint, spot_market.market.oracle
884872
);
885873

886874
let refresh_spot_market_ix = make_refresh_spot_market_ix(
887875
*address,
888876
spot_market.market.vault,
889-
drift_oracle,
877+
spot_market.market.oracle,
890878
&mut participating_accounts,
891879
);
892880

@@ -916,6 +904,7 @@ impl LiquidatorAccount {
916904
warn!("The refresh tx was too large: adding the observation accounts to a LUT and retrying");
917905
self.retry_with_new_luts(ixs, participating_accounts)?;
918906
}
907+
return Err(anyhow!(err.to_string()));
919908
}
920909
Ok(())
921910
}

0 commit comments

Comments
 (0)