lending: Add user transfer authority for all instructions (#1034)

* Add user transfer authority to deposit

* Add user transfer authority to withdraw

* Add user transfer authority to borrow

* Add user transfer authority to repay

* Add user transfer authority to liquidate

* Add user transfer authority to init reserve

* Cargo fmt

* Fix client

* Cargo fmt again
This commit is contained in:
Jon Cinque 2021-01-06 20:55:56 +01:00 committed by GitHub
parent a86abe49cd
commit b2712c6c2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 121 additions and 58 deletions

View File

@ -165,9 +165,7 @@ pub fn create_reserve(
let collateral_supply_keypair = Keypair::new();
let liquidity_supply_keypair = Keypair::new();
let user_collateral_token_keypair = Keypair::new();
let (authority_pubkey, _bump_seed) =
Pubkey::find_program_address(&[&lending_market_keypair.pubkey().to_bytes()[..32]], &id());
let user_transfer_authority = Keypair::new();
let liquidity_source_account = client.get_account(&liquidity_source_pubkey).unwrap();
let liquidity_source_token = Token::unpack(&liquidity_source_account.data).unwrap();
@ -242,7 +240,7 @@ pub fn create_reserve(
approve(
&spl_token::id(),
&liquidity_source_pubkey,
&authority_pubkey,
&user_transfer_authority.pubkey(),
&payer.pubkey(),
&[],
liquidity_source_token.amount,
@ -260,13 +258,17 @@ pub fn create_reserve(
collateral_mint_keypair.pubkey(),
collateral_supply_keypair.pubkey(),
lending_market_keypair.pubkey(),
user_transfer_authority.pubkey(),
dex_market_pubkey,
),
],
Some(&payer.pubkey()),
);
transaction.sign(&vec![payer, &lending_market_keypair], recent_blockhash);
transaction.sign(
&vec![payer, &lending_market_keypair, &user_transfer_authority],
recent_blockhash,
);
client.send_and_confirm_transaction(&transaction).unwrap();

View File

@ -41,11 +41,12 @@ pub enum LendingInstruction {
/// 5. `[writable]` Reserve collateral SPL Token mint - uninitialized
/// 6. `[writable]` Reserve collateral token supply - uninitialized
/// 7. `[signer]` Lending market account.
/// 8. `[]` Derived lending market authority ($authority).
/// 9. `[]` Clock sysvar
/// 10 `[]` Rent sysvar
/// 11 '[]` Token program id
/// 12 `[optional]` Serum DEX market account. Not required for quote currency reserves. Must be initialized and match quote and base currency.
/// 8. `[]` Derived lending market authority.
/// 9. `[]` User transfer authority ($authority).
/// 10 `[]` Clock sysvar
/// 11 `[]` Rent sysvar
/// 12 '[]` Token program id
/// 13 `[optional]` Serum DEX market account. Not required for quote currency reserves. Must be initialized and match quote and base currency.
InitReserve {
/// Initial amount of liquidity to deposit into the new reserve
liquidity_amount: u64,
@ -62,9 +63,10 @@ pub enum LendingInstruction {
/// 3. `[writable]` Reserve liquidity supply SPL Token account.
/// 4. `[writable]` Reserve collateral SPL Token mint.
/// 5. `[]` Lending market account.
/// 6. `[]` Derived lending market authority ($authority).
/// 7. `[]` Clock sysvar
/// 8. '[]` Token program id
/// 6. `[]` Derived lending market authority.
/// 7. `[]` User transfer authority ($authority).
/// 8. `[]` Clock sysvar
/// 9. '[]` Token program id
DepositReserveLiquidity {
/// Amount to deposit into the reserve
liquidity_amount: u64,
@ -79,8 +81,9 @@ pub enum LendingInstruction {
/// 3. `[writable]` Reserve collateral SPL Token mint.
/// 4. `[writable]` Reserve liquidity supply SPL Token account.
/// 5. `[]` Lending market account.
/// 6. `[]` Derived lending market authority ($authority).
/// 7. '[]` Token program id
/// 6. `[]` Derived lending market authority.
/// 7. `[]` User transfer authority ($authority).
/// 8. '[]` Token program id
WithdrawReserveLiquidity {
/// Amount of collateral to deposit in exchange for liquidity
collateral_amount: u64,
@ -101,13 +104,14 @@ pub enum LendingInstruction {
/// 8. `[writable]` Obligation token output
/// 9. `[]` Obligation token owner
/// 10 `[]` Lending market account.
/// 11 `[]` Derived lending market authority ($authority).
/// 12 `[]` Dex market
/// 13 `[]` Dex market order book side
/// 14 `[]` Temporary memory
/// 15 `[]` Clock sysvar
/// 16 `[]` Rent sysvar
/// 17 '[]` Token program id
/// 11 `[]` Derived lending market authority.
/// 12 `[]` User transfer authority ($authority).
/// 13 `[]` Dex market
/// 14 `[]` Dex market order book side
/// 15 `[]` Temporary memory
/// 16 `[]` Clock sysvar
/// 17 `[]` Rent sysvar
/// 18 '[]` Token program id
BorrowReserveLiquidity {
// TODO: slippage constraint
/// Amount whose usage depends on `amount_type`
@ -130,9 +134,10 @@ pub enum LendingInstruction {
/// 7. `[writable]` Obligation token mint
/// 8. `[writable]` Obligation token input, $authority can transfer calculated amount
/// 9. `[]` Lending market account.
/// 10 `[]` Derived lending market authority ($authority).
/// 11 `[]` Clock sysvar
/// 12 `[]` Token program id
/// 10 `[]` Derived lending market authority.
/// 11 `[]` User transfer authority ($authority).
/// 12 `[]` Clock sysvar
/// 13 `[]` Token program id
RepayReserveLiquidity {
/// Amount of loan to repay
liquidity_amount: u64,
@ -149,12 +154,13 @@ pub enum LendingInstruction {
/// 5. `[writable]` Withdraw reserve collateral supply SPL Token account
/// 6. `[writable]` Obligation - initialized
/// 7. `[]` Lending market account.
/// 8. `[]` Derived lending market authority ($authority).
/// 9. `[]` Dex market
/// 10 `[]` Dex market order book side
/// 11 `[]` Temporary memory
/// 12 `[]` Clock sysvar
/// 13 `[]` Token program id
/// 8. `[]` Derived lending market authority.
/// 9. `[]` User transfer authority ($authority).
/// 10 `[]` Dex market
/// 11 `[]` Dex market order book side
/// 12 `[]` Temporary memory
/// 13 `[]` Clock sysvar
/// 14 `[]` Token program id
LiquidateObligation {
/// Amount of loan to repay
liquidity_amount: u64,
@ -340,6 +346,7 @@ pub fn init_reserve(
reserve_collateral_mint_pubkey: Pubkey,
reserve_collateral_supply_pubkey: Pubkey,
lending_market_pubkey: Pubkey,
user_transfer_authority_pubkey: Pubkey,
dex_market_pubkey: Option<Pubkey>,
) -> Instruction {
let (lending_market_authority_pubkey, _bump_seed) =
@ -354,6 +361,7 @@ pub fn init_reserve(
AccountMeta::new(reserve_collateral_supply_pubkey, false),
AccountMeta::new_readonly(lending_market_pubkey, true),
AccountMeta::new_readonly(lending_market_authority_pubkey, false),
AccountMeta::new_readonly(user_transfer_authority_pubkey, true),
AccountMeta::new_readonly(sysvar::clock::id(), false),
AccountMeta::new_readonly(sysvar::rent::id(), false),
AccountMeta::new_readonly(spl_token::id(), false),
@ -386,6 +394,7 @@ pub fn deposit_reserve_liquidity(
reserve_collateral_mint_pubkey: Pubkey,
lending_market_pubkey: Pubkey,
lending_market_authority_pubkey: Pubkey,
user_transfer_authority_pubkey: Pubkey,
) -> Instruction {
Instruction {
program_id,
@ -397,6 +406,7 @@ pub fn deposit_reserve_liquidity(
AccountMeta::new(reserve_collateral_mint_pubkey, false),
AccountMeta::new_readonly(lending_market_pubkey, false),
AccountMeta::new_readonly(lending_market_authority_pubkey, false),
AccountMeta::new_readonly(user_transfer_authority_pubkey, true),
AccountMeta::new_readonly(sysvar::clock::id(), false),
AccountMeta::new_readonly(spl_token::id(), false),
],
@ -416,6 +426,7 @@ pub fn withdraw_reserve_liquidity(
reserve_liquidity_supply_pubkey: Pubkey,
lending_market_pubkey: Pubkey,
lending_market_authority_pubkey: Pubkey,
user_transfer_authority_pubkey: Pubkey,
) -> Instruction {
Instruction {
program_id,
@ -427,6 +438,7 @@ pub fn withdraw_reserve_liquidity(
AccountMeta::new(reserve_liquidity_supply_pubkey, false),
AccountMeta::new_readonly(lending_market_pubkey, false),
AccountMeta::new_readonly(lending_market_authority_pubkey, false),
AccountMeta::new_readonly(user_transfer_authority_pubkey, true),
AccountMeta::new_readonly(sysvar::clock::id(), false),
AccountMeta::new_readonly(spl_token::id(), false),
],
@ -448,6 +460,7 @@ pub fn borrow_reserve_liquidity(
borrow_reserve_liquidity_supply_pubkey: Pubkey,
lending_market_pubkey: Pubkey,
lending_market_authority_pubkey: Pubkey,
user_transfer_authority_pubkey: Pubkey,
obligation_pubkey: Pubkey,
obligation_token_mint_pubkey: Pubkey,
obligation_token_output_pubkey: Pubkey,
@ -471,6 +484,7 @@ pub fn borrow_reserve_liquidity(
AccountMeta::new_readonly(obligation_token_owner_pubkey, false),
AccountMeta::new_readonly(lending_market_pubkey, false),
AccountMeta::new_readonly(lending_market_authority_pubkey, false),
AccountMeta::new_readonly(user_transfer_authority_pubkey, true),
AccountMeta::new_readonly(dex_market_pubkey, false),
AccountMeta::new_readonly(dex_market_order_book_side_pubkey, false),
AccountMeta::new_readonly(memory_pubkey, false),
@ -502,6 +516,7 @@ pub fn repay_reserve_liquidity(
obligation_output_pubkey: Pubkey,
lending_market_pubkey: Pubkey,
lending_market_authority_pubkey: Pubkey,
user_transfer_authority_pubkey: Pubkey,
) -> Instruction {
Instruction {
program_id,
@ -517,6 +532,7 @@ pub fn repay_reserve_liquidity(
AccountMeta::new(obligation_output_pubkey, false),
AccountMeta::new_readonly(lending_market_pubkey, false),
AccountMeta::new_readonly(lending_market_authority_pubkey, false),
AccountMeta::new_readonly(user_transfer_authority_pubkey, true),
AccountMeta::new_readonly(sysvar::clock::id(), false),
AccountMeta::new_readonly(spl_token::id(), false),
],
@ -538,6 +554,7 @@ pub fn liquidate_obligation(
obligation_pubkey: Pubkey,
lending_market_pubkey: Pubkey,
lending_market_authority_pubkey: Pubkey,
user_transfer_authority_pubkey: Pubkey,
dex_market_pubkey: Pubkey,
dex_market_order_book_side_pubkey: Pubkey,
memory_pubkey: Pubkey,
@ -554,6 +571,7 @@ pub fn liquidate_obligation(
AccountMeta::new(obligation_pubkey, false),
AccountMeta::new_readonly(lending_market_pubkey, false),
AccountMeta::new_readonly(lending_market_authority_pubkey, false),
AccountMeta::new_readonly(user_transfer_authority_pubkey, true),
AccountMeta::new_readonly(dex_market_pubkey, false),
AccountMeta::new_readonly(dex_market_order_book_side_pubkey, false),
AccountMeta::new_readonly(memory_pubkey, false),

View File

@ -137,6 +137,7 @@ fn process_init_reserve(
let reserve_collateral_supply_info = next_account_info(account_info_iter)?;
let lending_market_info = next_account_info(account_info_iter)?;
let lending_market_authority_info = next_account_info(account_info_iter)?;
let user_transfer_authority_info = next_account_info(account_info_iter)?;
let clock = &Clock::from_account_info(next_account_info(account_info_iter)?)?;
let rent_info = next_account_info(account_info_iter)?;
let rent = &Rent::from_account_info(rent_info)?;
@ -235,8 +236,8 @@ fn process_init_reserve(
source: source_liquidity_info.clone(),
destination: reserve_liquidity_supply_info.clone(),
amount: liquidity_amount,
authority: lending_market_authority_info.clone(),
authority_signer_seeds,
authority: user_transfer_authority_info.clone(),
authority_signer_seeds: &[],
token_program: token_program_id.clone(),
})?;
@ -285,6 +286,7 @@ fn process_deposit(
let reserve_collateral_mint_info = next_account_info(account_info_iter)?;
let lending_market_info = next_account_info(account_info_iter)?;
let lending_market_authority_info = next_account_info(account_info_iter)?;
let user_transfer_authority_info = next_account_info(account_info_iter)?;
let clock = &Clock::from_account_info(next_account_info(account_info_iter)?)?;
let token_program_id = next_account_info(account_info_iter)?;
@ -336,8 +338,8 @@ fn process_deposit(
source: source_liquidity_info.clone(),
destination: reserve_liquidity_supply_info.clone(),
amount: liquidity_amount,
authority: lending_market_authority_info.clone(),
authority_signer_seeds,
authority: user_transfer_authority_info.clone(),
authority_signer_seeds: &[],
token_program: token_program_id.clone(),
})?;
@ -370,6 +372,7 @@ fn process_withdraw(
let reserve_liquidity_supply_info = next_account_info(account_info_iter)?;
let lending_market_info = next_account_info(account_info_iter)?;
let lending_market_authority_info = next_account_info(account_info_iter)?;
let user_transfer_authority_info = next_account_info(account_info_iter)?;
let clock = &Clock::from_account_info(next_account_info(account_info_iter)?)?;
let token_program_id = next_account_info(account_info_iter)?;
@ -430,8 +433,8 @@ fn process_withdraw(
mint: reserve_collateral_mint_info.clone(),
source: source_collateral_info.clone(),
amount: collateral_amount,
authority: lending_market_authority_info.clone(),
authority_signer_seeds,
authority: user_transfer_authority_info.clone(),
authority_signer_seeds: &[],
token_program: token_program_id.clone(),
})?;
@ -462,6 +465,7 @@ fn process_borrow(
let obligation_token_owner_info = next_account_info(account_info_iter)?;
let lending_market_info = next_account_info(account_info_iter)?;
let lending_market_authority_info = next_account_info(account_info_iter)?;
let user_transfer_authority_info = next_account_info(account_info_iter)?;
let dex_market_info = next_account_info(account_info_iter)?;
let dex_market_order_book_side_info = next_account_info(account_info_iter)?;
let memory = next_account_info(account_info_iter)?;
@ -643,8 +647,8 @@ fn process_borrow(
source: source_collateral_info.clone(),
destination: deposit_reserve_collateral_supply_info.clone(),
amount: collateral_deposit_amount,
authority: lending_market_authority_info.clone(),
authority_signer_seeds,
authority: user_transfer_authority_info.clone(),
authority_signer_seeds: &[],
token_program: token_program_id.clone(),
})?;
@ -731,6 +735,7 @@ fn process_repay(
let obligation_token_input_info = next_account_info(account_info_iter)?;
let lending_market_info = next_account_info(account_info_iter)?;
let lending_market_authority_info = next_account_info(account_info_iter)?;
let user_transfer_authority_info = next_account_info(account_info_iter)?;
let clock = &Clock::from_account_info(next_account_info(account_info_iter)?)?;
let token_program_id = next_account_info(account_info_iter)?;
@ -840,8 +845,8 @@ fn process_repay(
source: source_liquidity_info.clone(),
destination: repay_reserve_liquidity_supply_info.clone(),
amount: rounded_repay_amount,
authority: lending_market_authority_info.clone(),
authority_signer_seeds,
authority: user_transfer_authority_info.clone(),
authority_signer_seeds: &[],
token_program: token_program_id.clone(),
})?;
@ -860,8 +865,8 @@ fn process_repay(
mint: obligation_token_mint_info.clone(),
source: obligation_token_input_info.clone(),
amount: obligation_token_amount,
authority: lending_market_authority_info.clone(),
authority_signer_seeds,
authority: user_transfer_authority_info.clone(),
authority_signer_seeds: &[],
token_program: token_program_id.clone(),
})?;
@ -888,6 +893,7 @@ fn process_liquidate(
let obligation_info = next_account_info(account_info_iter)?;
let lending_market_info = next_account_info(account_info_iter)?;
let lending_market_authority_info = next_account_info(account_info_iter)?;
let user_transfer_authority_info = next_account_info(account_info_iter)?;
let dex_market_info = next_account_info(account_info_iter)?;
let dex_market_order_book_side_info = next_account_info(account_info_iter)?;
let memory = next_account_info(account_info_iter)?;
@ -1045,8 +1051,8 @@ fn process_liquidate(
source: source_liquidity_info.clone(),
destination: repay_reserve_liquidity_supply_info.clone(),
amount: rounded_repay_amount,
authority: lending_market_authority_info.clone(),
authority_signer_seeds,
authority: user_transfer_authority_info.clone(),
authority_signer_seeds: &[],
token_program: token_program_id.clone(),
})?;

View File

@ -365,12 +365,13 @@ impl TestLendingMarket {
reserve: &TestReserve,
amount: u64,
) {
let user_transfer_authority = Keypair::new();
let mut transaction = Transaction::new_with_payer(
&[
approve(
&spl_token::id(),
&reserve.user_liquidity_account,
&self.authority,
&user_transfer_authority.pubkey(),
&user_accounts_owner.pubkey(),
&[],
amount,
@ -386,13 +387,17 @@ impl TestLendingMarket {
reserve.collateral_mint,
self.keypair.pubkey(),
self.authority,
user_transfer_authority.pubkey(),
),
],
Some(&payer.pubkey()),
);
let recent_blockhash = banks_client.get_recent_blockhash().await.unwrap();
transaction.sign(&[payer, user_accounts_owner], recent_blockhash);
transaction.sign(
&[payer, user_accounts_owner, &user_transfer_authority],
recent_blockhash,
);
assert_matches!(banks_client.process_transaction(transaction).await, Ok(()));
}
@ -405,6 +410,7 @@ impl TestLendingMarket {
) -> TestObligation {
let rent = banks_client.get_rent().await.unwrap();
let memory_keypair = Keypair::new();
let user_transfer_authority = Keypair::new();
let BorrowArgs {
borrow_reserve,
@ -487,7 +493,7 @@ impl TestLendingMarket {
approve(
&spl_token::id(),
&deposit_reserve.user_collateral_account,
&self.authority,
&user_transfer_authority.pubkey(),
&user_accounts_owner.pubkey(),
&[],
approve_amount,
@ -512,6 +518,7 @@ impl TestLendingMarket {
borrow_reserve.liquidity_supply,
self.keypair.pubkey(),
self.authority,
user_transfer_authority.pubkey(),
obligation.keypair.pubkey(),
obligation.token_mint,
obligation.token_account,
@ -526,7 +533,12 @@ impl TestLendingMarket {
let recent_blockhash = banks_client.get_recent_blockhash().await.unwrap();
transaction.sign(
&vec![payer, user_accounts_owner, &memory_keypair],
&vec![
payer,
user_accounts_owner,
&memory_keypair,
&user_transfer_authority,
],
recent_blockhash,
);
@ -589,6 +601,7 @@ impl TestReserve {
let collateral_supply_keypair = Keypair::new();
let liquidity_supply_keypair = Keypair::new();
let user_collateral_token_keypair = Keypair::new();
let user_transfer_authority_keypair = Keypair::new();
let dex_market_pubkey = if liquidity_mint_pubkey != lending_market.quote_token_mint {
Some(dex_market.pubkey)
@ -631,7 +644,7 @@ impl TestReserve {
approve(
&spl_token::id(),
&user_liquidity_account,
&lending_market.authority,
&user_transfer_authority_keypair.pubkey(),
&user_accounts_owner.pubkey(),
&[],
reserve_amount,
@ -684,6 +697,7 @@ impl TestReserve {
collateral_mint_keypair.pubkey(),
collateral_supply_keypair.pubkey(),
lending_market.keypair.pubkey(),
user_transfer_authority_keypair.pubkey(),
dex_market_pubkey,
),
],
@ -701,6 +715,7 @@ impl TestReserve {
&collateral_supply_keypair,
&liquidity_supply_keypair,
&user_collateral_token_keypair,
&user_transfer_authority_keypair,
],
recent_blockhash,
);

View File

@ -80,6 +80,7 @@ async fn test_already_initialized() {
);
let user_accounts_owner = Keypair::new();
let user_transfer_authority = Keypair::new();
let sol_usdc_dex_market =
TestDexMarket::setup(&mut test, "sol_usdc", SOL_USDC_BIDS, SOL_USDC_ASKS);
let usdc_mint = add_usdc_mint(&mut test);
@ -114,11 +115,15 @@ async fn test_already_initialized() {
usdc_reserve.collateral_mint,
usdc_reserve.collateral_supply,
lending_market.keypair.pubkey(),
user_transfer_authority.pubkey(),
Some(sol_usdc_dex_market.pubkey),
)],
Some(&payer.pubkey()),
);
transaction.sign(&[&payer, &lending_market.keypair], recent_blockhash);
transaction.sign(
&[&payer, &lending_market.keypair, &user_transfer_authority],
recent_blockhash,
);
assert_eq!(
banks_client
.process_transaction(transaction)

View File

@ -43,6 +43,7 @@ async fn test_success() {
const OBLIGATION_SOL_COLLATERAL: u64 = INITIAL_COLLATERAL_RATE * LAMPORTS_TO_SOL;
let user_accounts_owner = Keypair::new();
let user_transfer_authority = Keypair::new();
let sol_usdc_dex_market =
TestDexMarket::setup(&mut test, "sol_usdc", SOL_USDC_BIDS, SOL_USDC_ASKS);
let usdc_mint = add_usdc_mint(&mut test);
@ -103,7 +104,7 @@ async fn test_success() {
approve(
&spl_token::id(),
&usdc_reserve.user_liquidity_account,
&lending_market.authority,
&user_transfer_authority.pubkey(),
&user_accounts_owner.pubkey(),
&[],
OBLIGATION_USDC_LOAN,
@ -121,6 +122,7 @@ async fn test_success() {
obligation.keypair.pubkey(),
lending_market.keypair.pubkey(),
lending_market.authority,
user_transfer_authority.pubkey(),
sol_usdc_dex_market.pubkey,
sol_usdc_dex_market.bids_pubkey,
memory_keypair.pubkey(),
@ -130,7 +132,12 @@ async fn test_success() {
);
transaction.sign(
&[&payer, &memory_keypair, &user_accounts_owner],
&[
&payer,
&memory_keypair,
&user_accounts_owner,
&user_transfer_authority,
],
recent_blockhash,
);
assert!(banks_client.process_transaction(transaction).await.is_ok());

View File

@ -39,6 +39,7 @@ async fn test_success() {
const OBLIGATION_COLLATERAL: u64 = 500;
let user_accounts_owner = Keypair::new();
let user_transfer_authority = Keypair::new();
let sol_usdc_dex_market =
TestDexMarket::setup(&mut test, "sol_usdc", SOL_USDC_BIDS, SOL_USDC_ASKS);
let usdc_mint = add_usdc_mint(&mut test);
@ -91,7 +92,7 @@ async fn test_success() {
approve(
&spl_token::id(),
&usdc_reserve.user_liquidity_account,
&lending_market.authority,
&user_transfer_authority.pubkey(),
&user_accounts_owner.pubkey(),
&[],
OBLIGATION_LOAN,
@ -100,7 +101,7 @@ async fn test_success() {
approve(
&spl_token::id(),
&obligation.token_account,
&lending_market.authority,
&user_transfer_authority.pubkey(),
&user_accounts_owner.pubkey(),
&[],
OBLIGATION_COLLATERAL,
@ -120,11 +121,15 @@ async fn test_success() {
obligation.token_account,
lending_market.keypair.pubkey(),
lending_market.authority,
user_transfer_authority.pubkey(),
),
],
Some(&payer.pubkey()),
);
transaction.sign(&[&payer, &user_accounts_owner], recent_blockhash);
transaction.sign(
&[&payer, &user_accounts_owner, &user_transfer_authority],
recent_blockhash,
);
assert!(banks_client.process_transaction(transaction).await.is_ok());
}

View File

@ -49,12 +49,13 @@ async fn test_success() {
let (mut banks_client, payer, recent_blockhash) = test.start().await;
let user_transfer_authority = Keypair::new();
let mut transaction = Transaction::new_with_payer(
&[
approve(
&spl_token::id(),
&usdc_reserve.user_collateral_account,
&lending_market.authority,
&user_transfer_authority.pubkey(),
&user_accounts_owner.pubkey(),
&[],
WITHDRAW_COLLATERAL_AMOUNT,
@ -70,11 +71,15 @@ async fn test_success() {
usdc_reserve.liquidity_supply,
lending_market.keypair.pubkey(),
lending_market.authority,
user_transfer_authority.pubkey(),
),
],
Some(&payer.pubkey()),
);
transaction.sign(&[&payer, &user_accounts_owner], recent_blockhash);
transaction.sign(
&[&payer, &user_accounts_owner, &user_transfer_authority],
recent_blockhash,
);
assert!(banks_client.process_transaction(transaction).await.is_ok());
}