Fix insufficient balance error to use bet amount net loan
This commit is contained in:
parent
6abf235505
commit
405604adef
|
@ -57,7 +57,12 @@ export function AmountInput(props: {
|
||||||
|
|
||||||
onChange(str ? amount : undefined)
|
onChange(str ? amount : undefined)
|
||||||
|
|
||||||
if (user && user.balance < amount) {
|
const loanAmount = contractIdForLoan
|
||||||
|
? Math.min(amount, MAX_LOAN_PER_CONTRACT - prevLoanAmount)
|
||||||
|
: 0
|
||||||
|
const amountNetLoan = amount - loanAmount
|
||||||
|
|
||||||
|
if (user && user.balance < amountNetLoan) {
|
||||||
setError('Insufficient balance')
|
setError('Insufficient balance')
|
||||||
} else if (minimumAmount && amount < minimumAmount) {
|
} else if (minimumAmount && amount < minimumAmount) {
|
||||||
setError('Minimum amount: ' + formatMoney(minimumAmount))
|
setError('Minimum amount: ' + formatMoney(minimumAmount))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user