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
b82b9acc
Unverified
Commit
b82b9acc
authored
Aug 30, 2022
by
lynn
Committed by
GitHub
Aug 30, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: remove stablecoin usd val fetch in logging to reduce infura spend (#4543)
remove stablecoin usd val fetch reduce infura
parent
fac38457
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
29 deletions
+2
-29
SwapModalFooter.tsx
src/components/swap/SwapModalFooter.tsx
+0
-11
updater.tsx
src/state/transactions/updater.tsx
+2
-18
No files found.
src/components/swap/SwapModalFooter.tsx
View file @
b82b9acc
...
...
@@ -10,7 +10,6 @@ import {
getDurationUntilTimestampSeconds
,
getTokenAddress
,
}
from
'
components/AmplitudeAnalytics/utils
'
import
{
useStablecoinValue
}
from
'
hooks/useStablecoinPrice
'
import
useTransactionDeadline
from
'
hooks/useTransactionDeadline
'
import
{
ReactNode
}
from
'
react
'
import
{
Text
}
from
'
rebass
'
...
...
@@ -30,8 +29,6 @@ interface AnalyticsEventProps {
transactionDeadlineSecondsSinceEpoch
:
number
|
undefined
isAutoSlippage
:
boolean
isAutoRouterApi
:
boolean
tokenInAmountUsd
:
string
|
undefined
tokenOutAmountUsd
:
string
|
undefined
swapQuoteReceivedDate
:
Date
|
undefined
routes
:
RoutingDiagramEntry
[]
}
...
...
@@ -70,16 +67,12 @@ const formatAnalyticsEventProperties = ({
transactionDeadlineSecondsSinceEpoch
,
isAutoSlippage
,
isAutoRouterApi
,
tokenInAmountUsd
,
tokenOutAmountUsd
,
swapQuoteReceivedDate
,
routes
,
}:
AnalyticsEventProps
)
=>
({
estimated_network_fee_usd
:
trade
.
gasUseEstimateUSD
?
formatToDecimal
(
trade
.
gasUseEstimateUSD
,
2
)
:
undefined
,
transaction_hash
:
hash
,
transaction_deadline_seconds
:
getDurationUntilTimestampSeconds
(
transactionDeadlineSecondsSinceEpoch
),
token_in_amount_usd
:
tokenInAmountUsd
?
parseFloat
(
tokenInAmountUsd
)
:
undefined
,
token_out_amount_usd
:
tokenOutAmountUsd
?
parseFloat
(
tokenOutAmountUsd
)
:
undefined
,
token_in_address
:
getTokenAddress
(
trade
.
inputAmount
.
currency
),
token_out_address
:
getTokenAddress
(
trade
.
outputAmount
.
currency
),
token_in_symbol
:
trade
.
inputAmount
.
currency
.
symbol
,
...
...
@@ -121,8 +114,6 @@ export default function SwapModalFooter({
const
transactionDeadlineSecondsSinceEpoch
=
useTransactionDeadline
()?.
toNumber
()
// in seconds since epoch
const
isAutoSlippage
=
useUserSlippageTolerance
()[
0
]
===
'
auto
'
const
[
clientSideRouter
]
=
useClientSideRouter
()
const
tokenInAmountUsd
=
useStablecoinValue
(
trade
.
inputAmount
)?.
toFixed
(
2
)
const
tokenOutAmountUsd
=
useStablecoinValue
(
trade
.
outputAmount
)?.
toFixed
(
2
)
const
routes
=
getTokenPath
(
trade
)
return
(
...
...
@@ -139,8 +130,6 @@ export default function SwapModalFooter({
transactionDeadlineSecondsSinceEpoch
,
isAutoSlippage
,
isAutoRouterApi
:
!
clientSideRouter
,
tokenInAmountUsd
,
tokenOutAmountUsd
,
swapQuoteReceivedDate
,
routes
,
})
}
...
...
src/state/transactions/updater.tsx
View file @
b82b9acc
...
...
@@ -4,7 +4,6 @@ import { sendAnalyticsEvent } from 'components/AmplitudeAnalytics'
import
{
EventName
}
from
'
components/AmplitudeAnalytics/constants
'
import
{
formatPercentInBasisPointsNumber
,
formatToDecimal
,
getTokenAddress
}
from
'
components/AmplitudeAnalytics/utils
'
import
{
DEFAULT_TXN_DISMISS_MS
,
L2_TXN_DISMISS_MS
}
from
'
constants/misc
'
import
{
useStablecoinValue
}
from
'
hooks/useStablecoinPrice
'
import
LibUpdater
from
'
lib/hooks/transactions/updater
'
import
{
useCallback
,
useMemo
}
from
'
react
'
import
{
useAppDispatch
,
useAppSelector
}
from
'
state/hooks
'
...
...
@@ -22,23 +21,12 @@ interface AnalyticsEventProps {
trade
:
InterfaceTrade
<
Currency
,
Currency
,
TradeType
>
hash
:
string
|
undefined
allowedSlippage
:
Percent
tokenInAmountUsd
:
string
|
undefined
tokenOutAmountUsd
:
string
|
undefined
succeeded
:
boolean
}
const
formatAnalyticsEventProperties
=
({
trade
,
hash
,
allowedSlippage
,
tokenInAmountUsd
,
tokenOutAmountUsd
,
succeeded
,
}:
AnalyticsEventProps
)
=>
({
const
formatAnalyticsEventProperties
=
({
trade
,
hash
,
allowedSlippage
,
succeeded
}:
AnalyticsEventProps
)
=>
({
estimated_network_fee_usd
:
trade
.
gasUseEstimateUSD
?
formatToDecimal
(
trade
.
gasUseEstimateUSD
,
2
)
:
undefined
,
transaction_hash
:
hash
,
token_in_amount_usd
:
tokenInAmountUsd
?
parseFloat
(
tokenInAmountUsd
)
:
undefined
,
token_out_amount_usd
:
tokenOutAmountUsd
?
parseFloat
(
tokenOutAmountUsd
)
:
undefined
,
token_in_address
:
getTokenAddress
(
trade
.
inputAmount
.
currency
),
token_out_address
:
getTokenAddress
(
trade
.
outputAmount
.
currency
),
token_in_symbol
:
trade
.
inputAmount
.
currency
.
symbol
,
...
...
@@ -65,8 +53,6 @@ export default function Updater() {
trade
:
{
trade
},
allowedSlippage
,
}
=
useDerivedSwapInfo
()
const
tokenInAmountUsd
=
useStablecoinValue
(
trade
?.
inputAmount
)?.
toFixed
(
2
)
const
tokenOutAmountUsd
=
useStablecoinValue
(
trade
?.
outputAmount
)?.
toFixed
(
2
)
const
dispatch
=
useAppDispatch
()
const
onCheck
=
useCallback
(
...
...
@@ -101,8 +87,6 @@ export default function Updater() {
trade
,
hash
,
allowedSlippage
,
tokenInAmountUsd
,
tokenOutAmountUsd
,
succeeded
:
receipt
.
status
===
1
,
})
)
...
...
@@ -115,7 +99,7 @@ export default function Updater() {
isL2
?
L2_TXN_DISMISS_MS
:
DEFAULT_TXN_DISMISS_MS
)
},
[
addPopup
,
allowedSlippage
,
dispatch
,
isL2
,
t
okenInAmountUsd
,
tokenOutAmountUsd
,
t
rade
,
transactions
]
[
addPopup
,
allowedSlippage
,
dispatch
,
isL2
,
trade
,
transactions
]
)
const
pendingTransactions
=
useMemo
(()
=>
(
chainId
?
transactions
[
chainId
]
??
{}
:
{}),
[
chainId
,
transactions
])
...
...
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