Skip to content

project-10-lending - Why was the user's deposited amount(usdc or sol) not deducted when withdraw? #46

@pzpzpz

Description

@pzpzpz

in project-10-lending/programs/lending/src/instructions/withdraw.rs, I find that the use‘s deposited amount was deducted using value of shares_to_remove variable, just like the following:

   if ctx.accounts.mint.to_account_info().key() == user.usdc_address {
        user.deposited_usdc -= shares_to_remove as u64;
    } else {
        user.deposited_sol -= shares_to_remove as u64;
    }

I think it should use amount variable instead of shares_to_remove , is it right?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions