mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-14 07:26:51 +00:00
noramlize amount
This commit is contained in:
@@ -39,6 +39,9 @@ pub fn process_withdraw(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramRes
|
||||
return Err(ProgramError::InvalidArgument);
|
||||
}
|
||||
|
||||
// Normalize amount
|
||||
let amount = amount.min(stake.collateral);
|
||||
|
||||
// Update stake state.
|
||||
stake.collateral -= amount;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user