Fix flash loan3 - fetching of bank from retriever

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
microwavedcola1 2022-07-06 17:41:08 +02:00
parent 8a1e9136a6
commit ab3abc69e7
1 changed files with 4 additions and 5 deletions

View File

@ -157,6 +157,7 @@ pub fn flash_loan3_begin<'key, 'accounts, 'remaining, 'info>(
}
struct TokenVaultChange {
token_index: TokenIndex,
bank_index: usize,
raw_token_index: usize,
amount: I80F48,
@ -243,6 +244,7 @@ pub fn flash_loan3_end<'key, 'accounts, 'remaining, 'info>(
}
changes.push(TokenVaultChange {
token_index: bank.token_index,
bank_index: i,
raw_token_index,
amount: change,
@ -263,11 +265,8 @@ pub fn flash_loan3_end<'key, 'accounts, 'remaining, 'info>(
// Prices for logging
let mut prices = vec![];
for change in &changes {
let (_, oracle_price) = retriever.bank_and_oracle(
&account.group,
change.bank_index,
change.raw_token_index as TokenIndex,
)?;
let (_, oracle_price) =
retriever.bank_and_oracle(&account.group, change.bank_index, change.token_index)?;
prices.push(oracle_price);
}