fix max swap
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
parent
c40bffb047
commit
a6fe8dfd48
|
@ -600,6 +600,10 @@ export class MangoAccount {
|
|||
sourceBorrow.div(ONE_I80F48().add(sourceBank.loanOriginationFeeRate)),
|
||||
);
|
||||
}
|
||||
|
||||
// Cannot swap more than total deposits in mango for the token
|
||||
maxSource = maxSource.min(sourceBank.nativeDeposits());
|
||||
|
||||
return toUiDecimals(maxSource, group.getMintDecimals(sourceMintPk));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue