-
Notifications
You must be signed in to change notification settings - Fork 230
Open
Description
In project 10 process_liquidate
function, I think there's a big error in calculating and transferring.
let total_collateral = (sol_price.price as u64 * user.deposited_sol) + (usdc_price.price as u64 * user.deposited_usdc);
let total_borrowed = (sol_price.price as u64 * user.borrowed_sol) + (usdc_price.price as u64 * user.borrowed_usdc);
These two indicates value totalled in $, so they are not parameters for token_interface::transfer_checked
which needs an amount parameter.
In order to calculate amount of liquidation_tokens to transfer, we need divide liquidation_value
by borrowed_price
. The same goes for collateral.
I know the lending protocol is kind of simplified, but the mistake of API calling should be remedied.
Metadata
Metadata
Assignees
Labels
No labels