Skip to content

Commit

Permalink
fix: put amount scaling
Browse files Browse the repository at this point in the history
  • Loading branch information
zachdt committed Sep 25, 2021
1 parent 60dd378 commit 80e8673
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/components/Market/OrderCard/components/Swap/Swap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,11 @@ const Swap: React.FC = () => {
orderType === Operation.CLOSE_SHORT &&
!parseEther(prem).isZero()
) {
onUserInput(formatEther(scaledShortToken.raw.toString()))
if (entity.isPut) {
onUserInput(formatEther(scaledOptionAmount.raw.toString()))
} else {
onUserInput(formatEther(scaledShortToken.raw.toString()))
}
}
}, [tokenBalance, onUserInput, prem, underlyingBalance, orderType])

Expand Down Expand Up @@ -627,7 +631,9 @@ const Swap: React.FC = () => {
orderType === Operation.CLOSE_LONG
? scaledOptionAmount
: orderType === Operation.CLOSE_SHORT
? scaledShortToken
? entity.isPut
? shortTokenAmount
: scaledShortToken
: null
}
/>
Expand Down Expand Up @@ -749,7 +755,7 @@ const Swap: React.FC = () => {
isLoading={loading}
text={
!isBelowSlippage() && typedValue !== ''
? 'Price Impact Too High'
? 'Amount Too High'
: getHasEnoughForTrade()
? 'Confirm Trade'
: 'Insufficient Balance'
Expand Down

0 comments on commit 80e8673

Please sign in to comment.