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
73f29eea
Unverified
Commit
73f29eea
authored
May 05, 2021
by
Noah Zinsmeister
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
don't show approve for both assets...
...in the single-sided liquidity provision case
parent
8057cb9f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
8 deletions
+12
-8
useApproveCallback.ts
src/hooks/useApproveCallback.ts
+4
-4
index.tsx
src/pages/AddLiquidity/index.tsx
+8
-4
No files found.
src/hooks/useApproveCallback.ts
View file @
73f29eea
...
...
@@ -13,10 +13,10 @@ import { useActiveWeb3React } from './index'
import
{
useTokenAllowance
}
from
'
./useTokenAllowance
'
export
enum
ApprovalState
{
UNKNOWN
,
NOT_APPROVED
,
PENDING
,
APPROVED
,
UNKNOWN
=
'
UNKNOWN
'
,
NOT_APPROVED
=
'
NOT_APPROVED
'
,
PENDING
=
'
PENDING
'
,
APPROVED
=
'
APPROVED
'
,
}
// returns a variable indicating the state of the approval and a function which approves if necessary or early returns
...
...
src/pages/AddLiquidity/index.tsx
View file @
73f29eea
...
...
@@ -353,6 +353,10 @@ export default function AddLiquidity({
pool
)
// we need an existence check on parsed amounts for single-asset deposits
const
showApprovalA
=
approvalA
!==
ApprovalState
.
APPROVED
&&
!!
parsedAmounts
[
Field
.
CURRENCY_A
]
const
showApprovalB
=
approvalB
!==
ApprovalState
.
APPROVED
&&
!!
parsedAmounts
[
Field
.
CURRENCY_B
]
return
(
<
ScrollablePage
>
<
TransactionConfirmationModal
...
...
@@ -623,13 +627,13 @@ export default function AddLiquidity({
approvalB
===
ApprovalState
.
PENDING
)
&&
isValid
&&
(
<
RowBetween
>
{
approvalA
!==
ApprovalState
.
APPROVED
&&
(
{
showApprovalA
&&
(
<
ButtonPrimary
borderRadius=
"12px"
padding=
{
'
12px
'
}
onClick=
{
approveACallback
}
disabled=
{
approvalA
===
ApprovalState
.
PENDING
}
width=
{
approvalB
!==
ApprovalState
.
APPROVED
?
'
48%
'
:
'
100%
'
}
width=
{
showApprovalB
?
'
48%
'
:
'
100%
'
}
>
{
approvalA
===
ApprovalState
.
PENDING
?
(
<
Dots
>
Approving
{
currencies
[
Field
.
CURRENCY_A
]?.
symbol
}
</
Dots
>
...
...
@@ -638,13 +642,13 @@ export default function AddLiquidity({
)
}
</
ButtonPrimary
>
)
}
{
approvalB
!==
ApprovalState
.
APPROVED
&&
(
{
showApprovalB
&&
(
<
ButtonPrimary
borderRadius=
"12px"
padding=
{
'
12px
'
}
onClick=
{
approveBCallback
}
disabled=
{
approvalB
===
ApprovalState
.
PENDING
}
width=
{
approvalA
!==
ApprovalState
.
APPROVED
?
'
48%
'
:
'
100%
'
}
width=
{
showApprovalA
?
'
48%
'
:
'
100%
'
}
>
{
approvalB
===
ApprovalState
.
PENDING
?
(
<
Dots
>
Approving
{
currencies
[
Field
.
CURRENCY_B
]?.
symbol
}
</
Dots
>
...
...
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