Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dapp-oeth/src/components/WalletSelectContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const WalletSelectContent = ({ isMobile }) => {
closeWalletSelectModal()
event({
'event': 'connect',
'connect_address': account
'connect_address': account?.slice(2)
})
}
}, [active])
Expand Down
46 changes: 28 additions & 18 deletions dapp-oeth/src/components/wrap/WrapHomepage.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { getUserSource } from 'utils/user'
import usePrevious from 'utils/usePrevious'
import ApproveSwap from 'components/buySell/ApproveSwap'
import { useWeb3React } from '@web3-react/core'
import { event } from '../../../lib/gtm'

import analytics from 'utils/analytics'
import {
Expand Down Expand Up @@ -168,14 +169,14 @@ const WrapHomepage = ({
}

const onWrapOETH = async () => {
analytics.track(
swapMode === 'mint' ? 'On Wrap to wETH' : 'On Unwrap from wETH',
{
category: 'wrap',
label: swapMetadata.coinUsed,
value: swapMetadata.swapAmount,
}
)
const wrapTokenUsed = swapMode === 'mint' ? 'woeth' : 'oeth'
const wrapTokenAmount = swapMode === 'mint' ? inputAmount : wrapEstimate
// mint = wrap
event({
'event': 'wrap_started',
'wrap_token': wrapTokenUsed,
'wrap_amount': wrapTokenAmount
})

const metadata = swapMetadata()

Expand Down Expand Up @@ -208,24 +209,33 @@ const WrapHomepage = ({
setInputAmount('')

await rpcProvider.waitForTransaction(result.hash)

analytics.track('Wrap succeeded', {
category: 'wrap',
label: metadata.coinUsed,
value: metadata.swapAmount,
event({
'event': 'wrap_complete',
'wrap_type': swapMode,
'wrap_token': wrapTokenUsed,
'wrap_amount': wrapTokenAmount,
'wrap_address': '',
'wrap_tx': ''
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be result.hash rather than being a empty string?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will fix forward, just wanted to get this up, address/tx are known empty for now

})
} catch (e) {
const metadata = swapMetadata()
// 4001 code happens when a user rejects the transaction
if (e.code !== 4001) {
await storeTransactionError(swapMode, 'oeth')
analytics.track('Wrap failed', {
category: 'wrap',
label: e?.message,
event({
'event': 'wrap_failed',
'wrap_type': swapMode,
'wrap_token': wrapTokenUsed,
'wrap_amount': wrapTokenAmount,
'wrap_address' : ''
})
} else {
analytics.track('Wrap canceled', {
category: 'wrap',
event({
'event': 'wrap_rejected',
'wrap_type': swapMode,
'wrap_token': wrapTokenUsed,
'wrap_amount': wrapTokenAmount,
'wrap_address': ''
})
}

Expand Down