Skip to content

Commit

Permalink
fix(RemoveLiquidity): fixed deps in callback, approval button is now …
Browse files Browse the repository at this point in the history
…displayed in correct circumstances
  • Loading branch information
zachdt committed Mar 13, 2021
1 parent 2112720 commit 6572e89
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,20 @@ const AddLiquidity: React.FC = () => {
) : (
<>
{isApproved() ? (
<> </>
<>
{' '}
<Button
disabled={
!isApproved() ||
!parsedUnderlyingAmount?.gt(0) ||
(hasLiquidity ? null : !parsedOptionAmount?.gt(0))
}
full
size="sm"
onClick={handleSubmitClick}
text={`Add Liquidity`}
/>
</>
) : (
<>
<Button
Expand All @@ -541,18 +554,6 @@ const AddLiquidity: React.FC = () => {
/>
</>
)}

<Button
disabled={
!isApproved() ||
!parsedUnderlyingAmount?.gt(0) ||
(hasLiquidity ? null : !parsedOptionAmount?.gt(0))
}
full
size="sm"
onClick={handleSubmitClick}
text={`Add Liquidity`}
/>
</>
)}
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,11 @@ const RemoveLiquidity: React.FC = () => {

const isOptionApproved = useCallback(() => {
return approved[0] || calculateLongBurn().isZero()
}, [approved, item.entity])
}, [approved, item.entity, ratio])

const isLPApproved = useCallback(() => {
return approved[1] || signData
}, [approved, item.entity, signData])
}, [approved, item.entity, signData, ratio])

const uninitializedMarket = useCallback(() => {
return (
Expand Down Expand Up @@ -225,8 +225,8 @@ const RemoveLiquidity: React.FC = () => {
}, [uninitializedMarket, calculateLongBurn])

const calculateReceived = useCallback(() => {
let underlyingReceived: string = '0'
let shortReceived: string = '0'
let underlyingReceived = '0'
let shortReceived = '0'
if (uninitializedMarket()) {
return { shortReceived, underlyingReceived }
}
Expand Down

0 comments on commit 6572e89

Please sign in to comment.