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
Show 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 {
...
@@ -10,7 +10,6 @@ import {
getDurationUntilTimestampSeconds
,
getDurationUntilTimestampSeconds
,
getTokenAddress
,
getTokenAddress
,
}
from
'
components/AmplitudeAnalytics/utils
'
}
from
'
components/AmplitudeAnalytics/utils
'
import
{
useStablecoinValue
}
from
'
hooks/useStablecoinPrice
'
import
useTransactionDeadline
from
'
hooks/useTransactionDeadline
'
import
useTransactionDeadline
from
'
hooks/useTransactionDeadline
'
import
{
ReactNode
}
from
'
react
'
import
{
ReactNode
}
from
'
react
'
import
{
Text
}
from
'
rebass
'
import
{
Text
}
from
'
rebass
'
...
@@ -30,8 +29,6 @@ interface AnalyticsEventProps {
...
@@ -30,8 +29,6 @@ interface AnalyticsEventProps {
transactionDeadlineSecondsSinceEpoch
:
number
|
undefined
transactionDeadlineSecondsSinceEpoch
:
number
|
undefined
isAutoSlippage
:
boolean
isAutoSlippage
:
boolean
isAutoRouterApi
:
boolean
isAutoRouterApi
:
boolean
tokenInAmountUsd
:
string
|
undefined
tokenOutAmountUsd
:
string
|
undefined
swapQuoteReceivedDate
:
Date
|
undefined
swapQuoteReceivedDate
:
Date
|
undefined
routes
:
RoutingDiagramEntry
[]
routes
:
RoutingDiagramEntry
[]
}
}
...
@@ -70,16 +67,12 @@ const formatAnalyticsEventProperties = ({
...
@@ -70,16 +67,12 @@ const formatAnalyticsEventProperties = ({
transactionDeadlineSecondsSinceEpoch
,
transactionDeadlineSecondsSinceEpoch
,
isAutoSlippage
,
isAutoSlippage
,
isAutoRouterApi
,
isAutoRouterApi
,
tokenInAmountUsd
,
tokenOutAmountUsd
,
swapQuoteReceivedDate
,
swapQuoteReceivedDate
,
routes
,
routes
,
}:
AnalyticsEventProps
)
=>
({
}:
AnalyticsEventProps
)
=>
({
estimated_network_fee_usd
:
trade
.
gasUseEstimateUSD
?
formatToDecimal
(
trade
.
gasUseEstimateUSD
,
2
)
:
undefined
,
estimated_network_fee_usd
:
trade
.
gasUseEstimateUSD
?
formatToDecimal
(
trade
.
gasUseEstimateUSD
,
2
)
:
undefined
,
transaction_hash
:
hash
,
transaction_hash
:
hash
,
transaction_deadline_seconds
:
getDurationUntilTimestampSeconds
(
transactionDeadlineSecondsSinceEpoch
),
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_in_address
:
getTokenAddress
(
trade
.
inputAmount
.
currency
),
token_out_address
:
getTokenAddress
(
trade
.
outputAmount
.
currency
),
token_out_address
:
getTokenAddress
(
trade
.
outputAmount
.
currency
),
token_in_symbol
:
trade
.
inputAmount
.
currency
.
symbol
,
token_in_symbol
:
trade
.
inputAmount
.
currency
.
symbol
,
...
@@ -121,8 +114,6 @@ export default function SwapModalFooter({
...
@@ -121,8 +114,6 @@ export default function SwapModalFooter({
const
transactionDeadlineSecondsSinceEpoch
=
useTransactionDeadline
()?.
toNumber
()
// in seconds since epoch
const
transactionDeadlineSecondsSinceEpoch
=
useTransactionDeadline
()?.
toNumber
()
// in seconds since epoch
const
isAutoSlippage
=
useUserSlippageTolerance
()[
0
]
===
'
auto
'
const
isAutoSlippage
=
useUserSlippageTolerance
()[
0
]
===
'
auto
'
const
[
clientSideRouter
]
=
useClientSideRouter
()
const
[
clientSideRouter
]
=
useClientSideRouter
()
const
tokenInAmountUsd
=
useStablecoinValue
(
trade
.
inputAmount
)?.
toFixed
(
2
)
const
tokenOutAmountUsd
=
useStablecoinValue
(
trade
.
outputAmount
)?.
toFixed
(
2
)
const
routes
=
getTokenPath
(
trade
)
const
routes
=
getTokenPath
(
trade
)
return
(
return
(
...
@@ -139,8 +130,6 @@ export default function SwapModalFooter({
...
@@ -139,8 +130,6 @@ export default function SwapModalFooter({
transactionDeadlineSecondsSinceEpoch
,
transactionDeadlineSecondsSinceEpoch
,
isAutoSlippage
,
isAutoSlippage
,
isAutoRouterApi
:
!
clientSideRouter
,
isAutoRouterApi
:
!
clientSideRouter
,
tokenInAmountUsd
,
tokenOutAmountUsd
,
swapQuoteReceivedDate
,
swapQuoteReceivedDate
,
routes
,
routes
,
})
}
})
}
...
...
src/state/transactions/updater.tsx
View file @
b82b9acc
...
@@ -4,7 +4,6 @@ import { sendAnalyticsEvent } from 'components/AmplitudeAnalytics'
...
@@ -4,7 +4,6 @@ import { sendAnalyticsEvent } from 'components/AmplitudeAnalytics'
import
{
EventName
}
from
'
components/AmplitudeAnalytics/constants
'
import
{
EventName
}
from
'
components/AmplitudeAnalytics/constants
'
import
{
formatPercentInBasisPointsNumber
,
formatToDecimal
,
getTokenAddress
}
from
'
components/AmplitudeAnalytics/utils
'
import
{
formatPercentInBasisPointsNumber
,
formatToDecimal
,
getTokenAddress
}
from
'
components/AmplitudeAnalytics/utils
'
import
{
DEFAULT_TXN_DISMISS_MS
,
L2_TXN_DISMISS_MS
}
from
'
constants/misc
'
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
LibUpdater
from
'
lib/hooks/transactions/updater
'
import
{
useCallback
,
useMemo
}
from
'
react
'
import
{
useCallback
,
useMemo
}
from
'
react
'
import
{
useAppDispatch
,
useAppSelector
}
from
'
state/hooks
'
import
{
useAppDispatch
,
useAppSelector
}
from
'
state/hooks
'
...
@@ -22,23 +21,12 @@ interface AnalyticsEventProps {
...
@@ -22,23 +21,12 @@ interface AnalyticsEventProps {
trade
:
InterfaceTrade
<
Currency
,
Currency
,
TradeType
>
trade
:
InterfaceTrade
<
Currency
,
Currency
,
TradeType
>
hash
:
string
|
undefined
hash
:
string
|
undefined
allowedSlippage
:
Percent
allowedSlippage
:
Percent
tokenInAmountUsd
:
string
|
undefined
tokenOutAmountUsd
:
string
|
undefined
succeeded
:
boolean
succeeded
:
boolean
}
}
const
formatAnalyticsEventProperties
=
({
const
formatAnalyticsEventProperties
=
({
trade
,
hash
,
allowedSlippage
,
succeeded
}:
AnalyticsEventProps
)
=>
({
trade
,
hash
,
allowedSlippage
,
tokenInAmountUsd
,
tokenOutAmountUsd
,
succeeded
,
}:
AnalyticsEventProps
)
=>
({
estimated_network_fee_usd
:
trade
.
gasUseEstimateUSD
?
formatToDecimal
(
trade
.
gasUseEstimateUSD
,
2
)
:
undefined
,
estimated_network_fee_usd
:
trade
.
gasUseEstimateUSD
?
formatToDecimal
(
trade
.
gasUseEstimateUSD
,
2
)
:
undefined
,
transaction_hash
:
hash
,
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_in_address
:
getTokenAddress
(
trade
.
inputAmount
.
currency
),
token_out_address
:
getTokenAddress
(
trade
.
outputAmount
.
currency
),
token_out_address
:
getTokenAddress
(
trade
.
outputAmount
.
currency
),
token_in_symbol
:
trade
.
inputAmount
.
currency
.
symbol
,
token_in_symbol
:
trade
.
inputAmount
.
currency
.
symbol
,
...
@@ -65,8 +53,6 @@ export default function Updater() {
...
@@ -65,8 +53,6 @@ export default function Updater() {
trade
:
{
trade
},
trade
:
{
trade
},
allowedSlippage
,
allowedSlippage
,
}
=
useDerivedSwapInfo
()
}
=
useDerivedSwapInfo
()
const
tokenInAmountUsd
=
useStablecoinValue
(
trade
?.
inputAmount
)?.
toFixed
(
2
)
const
tokenOutAmountUsd
=
useStablecoinValue
(
trade
?.
outputAmount
)?.
toFixed
(
2
)
const
dispatch
=
useAppDispatch
()
const
dispatch
=
useAppDispatch
()
const
onCheck
=
useCallback
(
const
onCheck
=
useCallback
(
...
@@ -101,8 +87,6 @@ export default function Updater() {
...
@@ -101,8 +87,6 @@ export default function Updater() {
trade
,
trade
,
hash
,
hash
,
allowedSlippage
,
allowedSlippage
,
tokenInAmountUsd
,
tokenOutAmountUsd
,
succeeded
:
receipt
.
status
===
1
,
succeeded
:
receipt
.
status
===
1
,
})
})
)
)
...
@@ -115,7 +99,7 @@ export default function Updater() {
...
@@ -115,7 +99,7 @@ export default function Updater() {
isL2
?
L2_TXN_DISMISS_MS
:
DEFAULT_TXN_DISMISS_MS
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
])
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