Skip to content

Commit de92b8d

Browse files
committed
sys-lend: adapt to latest kamino program instruction changes
1 parent bca0c99 commit de92b8d

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

src/bin/sys-lend.rs

+21-20
Original file line numberDiff line numberDiff line change
@@ -2157,11 +2157,6 @@ fn kamino_deposit_or_withdraw(
21572157
)
21582158
.0;
21592159

2160-
let reserve_farm_state = reserve.farm_collateral;
2161-
let reserve_liquidity_supply = reserve.liquidity.supply_vault;
2162-
let reserve_collateral_mint = reserve.collateral.mint_pubkey;
2163-
let reserve_destination_deposit_collateral = reserve.collateral.supply_vault;
2164-
21652160
let obligation_address = kamino_find_obligation_address(wallet_address, reserve.lending_market);
21662161
let obligation = kamino_unsafe_load_obligation(obligation_address, account_data_cache)?;
21672162

@@ -2172,7 +2167,7 @@ fn kamino_deposit_or_withdraw(
21722167
let obligation_farm_user_state = Pubkey::find_program_address(
21732168
&[
21742169
b"user",
2175-
&reserve_farm_state.to_bytes(),
2170+
&reserve.farm_collateral.to_bytes(),
21762171
&obligation_address.to_bytes(),
21772172
],
21782173
&FARMS_PROGRAM,
@@ -2275,7 +2270,7 @@ fn kamino_deposit_or_withdraw(
22752270
// Reserve
22762271
AccountMeta::new(market_reserve_address, false),
22772272
// Reserve Farm State
2278-
AccountMeta::new(reserve_farm_state, false),
2273+
AccountMeta::new(reserve.farm_collateral, false),
22792274
// Obligation Farm User State
22802275
AccountMeta::new(obligation_farm_user_state, false),
22812276
// Lending Market
@@ -2284,14 +2279,12 @@ fn kamino_deposit_or_withdraw(
22842279
AccountMeta::new_readonly(FARMS_PROGRAM, false),
22852280
// Rent
22862281
AccountMeta::new_readonly(sysvar::rent::ID, false),
2287-
// Token Program
2288-
AccountMeta::new_readonly(spl_token::id(), false),
22892282
// System Program
22902283
AccountMeta::new_readonly(system_program::ID, false),
22912284
],
22922285
);
22932286

2294-
if reserve_farm_state != Pubkey::default() {
2287+
if reserve.farm_collateral != Pubkey::default() {
22952288
if account_data_cache
22962289
.get(obligation_farm_user_state)?
22972290
.0
@@ -2331,12 +2324,14 @@ fn kamino_deposit_or_withdraw(
23312324
AccountMeta::new(lending_market_authority, false),
23322325
// Reserve
23332326
AccountMeta::new(market_reserve_address, false),
2327+
// Reserve Liquidity Mint
2328+
AccountMeta::new(reserve.liquidity.mint_pubkey, false),
23342329
// Reserve Source Collateral
2335-
AccountMeta::new(reserve_destination_deposit_collateral, false),
2330+
AccountMeta::new(reserve.collateral.supply_vault, false),
23362331
// Reserve Collateral Mint
2337-
AccountMeta::new(reserve_collateral_mint, false),
2332+
AccountMeta::new(reserve.collateral.mint_pubkey, false),
23382333
// Reserve Liquidity Supply
2339-
AccountMeta::new(reserve_liquidity_supply, false),
2334+
AccountMeta::new(reserve.liquidity.supply_vault, false),
23402335
// User Liquidity
23412336
AccountMeta::new(
23422337
spl_associated_token_account::get_associated_token_address(
@@ -2349,6 +2344,8 @@ fn kamino_deposit_or_withdraw(
23492344
AccountMeta::new_readonly(KAMINO_LEND_PROGRAM, false),
23502345
// Token Program
23512346
AccountMeta::new_readonly(spl_token::id(), false),
2347+
// Token Program
2348+
AccountMeta::new_readonly(spl_token::id(), false),
23522349
// Sysvar: Instructions
23532350
AccountMeta::new_readonly(sysvar::instructions::ID, false),
23542351
],
@@ -2373,17 +2370,19 @@ fn kamino_deposit_or_withdraw(
23732370
// Obligation
23742371
AccountMeta::new(obligation_address, false),
23752372
// Lending Market
2376-
AccountMeta::new_readonly(reserve.lending_market, false),
2373+
AccountMeta::new_readonly(dbg!(reserve.lending_market), false),
23772374
// Lending Market Authority
2378-
AccountMeta::new(lending_market_authority, false),
2375+
AccountMeta::new(dbg!(lending_market_authority), false),
23792376
// Reserve
2380-
AccountMeta::new(market_reserve_address, false),
2377+
AccountMeta::new(dbg!(market_reserve_address), false),
2378+
// Reserve Liquidity Mint
2379+
AccountMeta::new(reserve.liquidity.mint_pubkey, false),
23812380
// Reserve Liquidity Supply
2382-
AccountMeta::new(reserve_liquidity_supply, false),
2381+
AccountMeta::new(reserve.liquidity.supply_vault, false),
23832382
// Reserve Collateral Mint
2384-
AccountMeta::new(reserve_collateral_mint, false),
2383+
AccountMeta::new(reserve.collateral.mint_pubkey, false),
23852384
// Reserve Destination Deposit Collateral
2386-
AccountMeta::new(reserve_destination_deposit_collateral, false),
2385+
AccountMeta::new(reserve.collateral.supply_vault, false),
23872386
// User Source Liquidity
23882387
AccountMeta::new(
23892388
spl_associated_token_account::get_associated_token_address(
@@ -2396,6 +2395,8 @@ fn kamino_deposit_or_withdraw(
23962395
AccountMeta::new_readonly(KAMINO_LEND_PROGRAM, false),
23972396
// Token Program
23982397
AccountMeta::new_readonly(spl_token::id(), false),
2398+
// Token Program
2399+
AccountMeta::new_readonly(spl_token::id(), false),
23992400
// Sysvar: Instructions
24002401
AccountMeta::new_readonly(sysvar::instructions::ID, false),
24012402
],
@@ -2406,7 +2407,7 @@ fn kamino_deposit_or_withdraw(
24062407
};
24072408

24082409
// Instruction: Kamino: Refresh Obligation Farms For Reserve
2409-
if reserve_farm_state != Pubkey::default() {
2410+
if reserve.farm_collateral != Pubkey::default() {
24102411
instructions.push(kamino_refresh_obligation_farms_for_reserve);
24112412
}
24122413

0 commit comments

Comments
 (0)