Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit b389053

Browse files
authored
lending: fix market and reserve initialization (#1346)
* lending: set lending market bump seed * fix: Set correct reserve token account owner * bump lending comp unit limit
1 parent 833ea93 commit b389053

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

token-lending/program/src/processor.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ pub fn process_instruction(
8080
}
8181

8282
fn process_init_lending_market(
83-
_program_id: &Pubkey,
83+
program_id: &Pubkey,
8484
market_owner: Pubkey,
8585
accounts: &[AccountInfo],
8686
) -> ProgramResult {
@@ -97,7 +97,9 @@ fn process_init_lending_market(
9797

9898
assert_rent_exempt(rent, lending_market_info)?;
9999
let mut new_lending_market: LendingMarket = assert_uninitialized(lending_market_info)?;
100+
let bump_seed = Pubkey::find_program_address(&[lending_market_info.key.as_ref()], program_id).1;
100101
new_lending_market.version = PROGRAM_VERSION;
102+
new_lending_market.bump_seed = bump_seed;
101103
new_lending_market.owner = market_owner;
102104
new_lending_market.quote_token_mint = *quote_token_mint_info.key;
103105
new_lending_market.token_program_id = *token_program_id.key;
@@ -287,7 +289,7 @@ fn process_init_reserve(
287289
spl_token_init_account(TokenInitializeAccountParams {
288290
account: destination_collateral_info.clone(),
289291
mint: reserve_collateral_mint_info.clone(),
290-
owner: lending_market_authority_info.clone(),
292+
owner: user_transfer_authority_info.clone(),
291293
rent: rent_info.clone(),
292294
token_program: token_program_id.clone(),
293295
})?;

token-lending/program/tests/init_lending_market.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ async fn test_success() {
2222
);
2323

2424
// limit to track compute unit increase
25-
test.set_bpf_compute_max_units(5_000);
25+
test.set_bpf_compute_max_units(8_000);
2626

2727
let usdc_mint = add_usdc_mint(&mut test);
2828
let (mut banks_client, payer, _recent_blockhash) = test.start().await;

0 commit comments

Comments
 (0)