Skip to content

Commit 3b09200

Browse files
committed
Use AccountDataCache more
1 parent 2471419 commit 3b09200

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/bin/sys-lend.rs

+10-5
Original file line numberDiff line numberDiff line change
@@ -1927,7 +1927,11 @@ fn kamino_deposit_or_withdraw(
19271927
);
19281928

19291929
if reserve_farm_state != Pubkey::default() {
1930-
if rpc_client.get_balance(&obligation_farm_user_state)? == 0 {
1930+
if account_data_cache
1931+
.get(rpc_client, obligation_farm_user_state)?
1932+
.0
1933+
.is_empty()
1934+
{
19311935
return Err(format!("Manually deposit once into {pool} before using sys-lend").into());
19321936
}
19331937
instructions.push(kamino_refresh_obligation_farms_for_reserve.clone());
@@ -2283,10 +2287,11 @@ fn solend_deposit_or_withdraw(
22832287

22842288
let mut instructions = vec![];
22852289

2286-
if matches!(
2287-
rpc_client.get_balance(&user_collateral_token_account),
2288-
Ok(0)
2289-
) {
2290+
if account_data_cache
2291+
.get(rpc_client, user_collateral_token_account)?
2292+
.0
2293+
.is_empty()
2294+
{
22902295
instructions.push(
22912296
spl_associated_token_account::instruction::create_associated_token_account(
22922297
&wallet_address,

0 commit comments

Comments
 (0)