Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LuckySwap
interface
Commits
b35653ad
Unverified
Commit
b35653ad
authored
Jun 11, 2020
by
Noah Zinsmeister
Committed by
GitHub
Jun 11, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix approval bugs (#887)
clear signature on input in remove
parent
57b53013
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
4 deletions
+13
-4
index.tsx
src/pages/AddLiquidity/index.tsx
+2
-2
index.tsx
src/pages/RemoveLiquidity/index.tsx
+11
-2
No files found.
src/pages/AddLiquidity/index.tsx
View file @
b35653ad
...
...
@@ -400,7 +400,7 @@ export default function AddLiquidity({ match: { params } }: RouteComponentProps<
{approvalA !== ApprovalState.APPROVED && (
<ButtonPrimary
onClick={approveACallback}
disabled={approvalA === ApprovalState.PENDING
|| !isValid
}
disabled={approvalA === ApprovalState.PENDING}
width={approvalB !== ApprovalState.APPROVED ? '48%' : '100%'}
>
{approvalA === ApprovalState.PENDING ? (
...
...
@@ -413,7 +413,7 @@ export default function AddLiquidity({ match: { params } }: RouteComponentProps<
{approvalB !== ApprovalState.APPROVED && (
<ButtonPrimary
onClick={approveBCallback}
disabled={approvalB === ApprovalState.PENDING
|| !isValid
}
disabled={approvalB === ApprovalState.PENDING}
width={approvalA !== ApprovalState.APPROVED ? '48%' : '100%'}
>
{approvalB === ApprovalState.PENDING ? (
...
...
src/pages/RemoveLiquidity/index.tsx
View file @
b35653ad
...
...
@@ -48,7 +48,7 @@ export default function RemoveLiquidity({ match: { params } }: RouteComponentPro
// burn state
const
{
independentField
,
typedValue
}
=
useBurnState
()
const
{
tokens
,
pair
,
route
,
parsedAmounts
,
error
}
=
useDerivedBurnInfo
()
const
{
onUserInput
}
=
useBurnActionHandlers
()
const
{
onUserInput
:
_onUserInput
}
=
useBurnActionHandlers
()
const
isValid
=
!
error
// modal and loading
...
...
@@ -144,6 +144,15 @@ export default function RemoveLiquidity({ match: { params } }: RouteComponentPro
})
}
// wrapped onUserInput to clear signatures
const
onUserInput
=
useCallback
(
(
field
:
Field
,
typedValue
:
string
)
=>
{
setSignatureData
(
null
)
return
_onUserInput
(
field
,
typedValue
)
},
[
_onUserInput
]
)
// tx sending
const
addTransaction
=
useTransactionAdder
()
async
function
onRemove
()
{
...
...
@@ -569,7 +578,7 @@ export default function RemoveLiquidity({ match: { params } }: RouteComponentPro
onClick={() => {
setShowConfirm(true)
}}
disabled={!isValid ||
signatureData === null
}
disabled={!isValid ||
(signatureData === null && approval !== ApprovalState.APPROVED)
}
error={!isValid && !!parsedAmounts[Field.TOKEN_A] && !!parsedAmounts[Field.TOKEN_B]}
>
<Text fontSize={16} fontWeight={500}>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment