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
38cde648
Unverified
Commit
38cde648
authored
May 04, 2023
by
Vignesh Mohankumar
Committed by
GitHub
May 04, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: add a catch on collect static call (#6491)
* fix: add a catch on collect static call * comment
parent
33c09911
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
14 deletions
+19
-14
useV3PositionFees.ts
src/hooks/useV3PositionFees.ts
+19
-14
No files found.
src/hooks/useV3PositionFees.ts
View file @
38cde648
...
@@ -27,21 +27,26 @@ export function useV3PositionFees(
...
@@ -27,21 +27,26 @@ export function useV3PositionFees(
// latestBlockNumber is included to ensure data stays up-to-date every block
// latestBlockNumber is included to ensure data stays up-to-date every block
const
[
amounts
,
setAmounts
]
=
useState
<
[
BigNumber
,
BigNumber
]
|
undefined
>
()
const
[
amounts
,
setAmounts
]
=
useState
<
[
BigNumber
,
BigNumber
]
|
undefined
>
()
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
positionManager
&&
tokenIdHexString
&&
owner
)
{
;(
async
function
getFees
(
)
{
positionManager
.
callStatic
if
(
positionManager
&&
tokenIdHexString
&&
owner
)
{
.
collect
(
try
{
{
const
results
=
await
positionManager
.
callStatic
.
collect
(
tokenId
:
tokenIdHexString
,
{
recipient
:
owner
,
// some tokens might fail if transferred to address(0)
tokenId
:
tokenIdHexString
,
amount0Max
:
MAX_UINT128
,
recipient
:
owner
,
// some tokens might fail if transferred to address(0)
amount1
Max
:
MAX_UINT128
,
amount0
Max
:
MAX_UINT128
,
}
,
amount1Max
:
MAX_UINT128
,
{
from
:
owner
}
// need to simulate the call as the owner
},
)
{
from
:
owner
}
// need to simulate the call as the owner
.
then
((
results
)
=>
{
)
setAmounts
([
results
.
amount0
,
results
.
amount1
])
setAmounts
([
results
.
amount0
,
results
.
amount1
])
})
}
catch
{
}
// If the static call fails, the default state will remain for `amounts`.
// This case is handled by returning unclaimed fees as empty.
// TODO(INFRA-178): Look into why we have failures with call data being 0x.
}
}
})()
},
[
positionManager
,
tokenIdHexString
,
owner
,
latestBlockNumber
])
},
[
positionManager
,
tokenIdHexString
,
owner
,
latestBlockNumber
])
if
(
pool
&&
amounts
)
{
if
(
pool
&&
amounts
)
{
...
...
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