Skip to content

Commit

Permalink
feat(earn): Deposit entrypoint updates (#5932)
Browse files Browse the repository at this point in the history
### Description

When clicking deposit:
- Can deposit -> takes you to enter amount screen
- Can't deposit -> shows bottom sheet with options to get you closer to
a deposit

### Test plan

| Can Deposit | Can Swap & Deposit | Can cross-chain swap | Can't swap |
| --- | --- | --- | --- |
| <video
src="https://github.com/user-attachments/assets/2139497f-3f97-41ac-a68a-a194941fb5e1"
/> |
![swap-and-deposit](https://github.com/user-attachments/assets/94abb649-ed02-4f3b-a35d-f47c050e8cf5)
| ![Simulator Screenshot - iPhone 14 Pro - 2024-09-10 at 13 22
27](https://github.com/user-attachments/assets/0668877a-c28c-4804-ae4b-59dd121ac88b)
|
![no-tokens](https://github.com/user-attachments/assets/943e0899-7b73-4176-ba6c-c310a7d7cc0b)
|


### Related issues

- Fixes ACT-1359

### Backwards compatibility

Yes

### Network scalability

If a new NetworkId and/or Network are added in the future, the changes
in this PR will:

- [X] Continue to work without code changes, OR trigger a compilation
error (guaranteeing we find it when a new network is added)

---------

Co-authored-by: Satish Ravi <satish.ravi@valoraapp.com>
  • Loading branch information
finnian0826 and satish-ravi authored Sep 19, 2024
1 parent f284401 commit cc12ac5
Show file tree
Hide file tree
Showing 18 changed files with 790 additions and 57 deletions.
18 changes: 18 additions & 0 deletions locales/base/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -2701,6 +2701,24 @@
"yieldRateTitle": "Yield Rate",
"yieldRateDescription": "While most pools offer earnings in the form of a liquidity pool token, some give additional token(s) as a reward or added incentive.\n\nSince {{appName}} aggregates pools across multiple protocols, we have combined all the earning and reward rates into a single, overall yield rate to help easily evaluate your earning potential. This number is an estimate since the earning and reward values fluctuate constantly.\n\nFor further information about earning breakdowns you can visit <0>{{providerName}}</0>."
}
},
"beforeDepositBottomSheet": {
"youNeedTitle": "You Need {{tokenSymbol}} on {{tokenNetwork}} to Deposit",
"crossChainAlternativeDescription": "If you don’t want to use your tokens on {{tokenNetwork}}, choose an option below. You’ll need to return to complete your pool deposit later.",
"beforeYouCanDepositTitle": "Before you can deposit...",
"beforeYouCanDepositDescription": "You’ll need to add one of the pool tokens. Once added, you’ll need to return to complete your pool deposit.",
"action": {
"swapAndDeposit": "Swap & Deposit",
"swapAndDepositDescription": "Choose any token on {{tokenNetwork}}. We’ll swap and deposit it simultaneously for you.",
"crossChainSwap": "Cross-chain Swap",
"crossChainSwapDescription": "Swap a token on another network for {{tokenSymbol}}",
"swap": "Swap",
"swapDescription": "Swap into {{tokenSymbol}} on {{tokenNetwork}} from another token in your wallet",
"add": "Buy",
"addDescription": "Buy {{tokenSymbol}} on {{tokenNetwork}} using one of our trusted providers",
"transfer": "Transfer",
"transferDescription": "Use any {{tokenNetwork}} compatible wallet or exchange to deposit {{tokenSymbol}}"
}
}
},
"addFundsActions": {
Expand Down
2 changes: 1 addition & 1 deletion src/analytics/Events.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ export enum PointsEvents {
export enum EarnEvents {
earn_cta_press = 'earn_cta_press',
earn_entrypoint_press = 'earn_entrypoint_press',
earn_add_crypto_action_press = 'earn_add_crypto_action_press',
earn_before_deposit_action_press = 'earn_before_deposit_action_press',
earn_deposit_provider_info_press = 'earn_deposit_provider_info_press',
earn_deposit_terms_and_conditions_press = 'earn_deposit_terms_and_conditions_press',
earn_deposit_complete = 'earn_deposit_complete',
Expand Down
12 changes: 8 additions & 4 deletions src/analytics/Properties.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ import { ErrorMessages } from 'src/app/ErrorMessages'
import { AddAssetsActionType } from 'src/components/AddAssetsBottomSheet'
import { TokenPickerOrigin } from 'src/components/TokenBottomSheet'
import { DappSection } from 'src/dapps/types'
import { EarnDepositMode, SerializableRewardsInfo } from 'src/earn/types'
import { EarnDepositMode, BeforeDepositActionName, SerializableRewardsInfo } from 'src/earn/types'
import { ProviderSelectionAnalyticsData } from 'src/fiatExchanges/types'
import { CICOFlow, FiatExchangeFlow, PaymentMethod } from 'src/fiatExchanges/utils'
import { HomeActionName, NotificationBannerCTATypes, NotificationType } from 'src/home/types'
Expand Down Expand Up @@ -1578,8 +1578,8 @@ interface EarnEventsProperties {
depositTokenId: string
}
[EarnEvents.earn_entrypoint_press]: undefined
[EarnEvents.earn_add_crypto_action_press]: {
action: AddAssetsActionType
[EarnEvents.earn_before_deposit_action_press]: {
action: BeforeDepositActionName
} & TokenProperties
[EarnEvents.earn_deposit_provider_info_press]: EarnDepositProperties
[EarnEvents.earn_deposit_terms_and_conditions_press]: EarnDepositProperties
Expand Down Expand Up @@ -1638,7 +1638,11 @@ interface EarnEventsProperties {
[EarnEvents.earn_pool_info_tap_withdraw]: {
poolAmount: string
} & EarnCommonProperties
[EarnEvents.earn_pool_info_tap_deposit]: EarnCommonProperties
[EarnEvents.earn_pool_info_tap_deposit]: EarnCommonProperties & {
hasDepositToken: boolean
hasTokensOnSameNetwork: boolean
hasTokensOnOtherNetworks: boolean
}
}

export type AnalyticsPropertiesList = AppEventsProperties &
Expand Down
3 changes: 2 additions & 1 deletion src/analytics/docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ export const eventDocs: Record<AnalyticsEventType, string> = {
// Events related to earn program
[EarnEvents.earn_cta_press]: `When a user taps on the earn your stablecoins CTA on the discover tab (only for MVP w/ AAVE)`,
[EarnEvents.earn_entrypoint_press]: `When a user taps on the earn your stablecoins entrypoint on the discover tab (only for multiple pools)`,
[EarnEvents.earn_add_crypto_action_press]: `When a user in the Earn flow enters an amount higher than their balance and chooses an option to add crypto`,
[EarnEvents.earn_before_deposit_action_press]: `When a user in the Earn flow doesn't have the deposit token and so chooses an option to add it`,
[EarnEvents.earn_deposit_provider_info_press]: `When a user taps on the info icon next to the provider name on the deposit bottom sheet`,
[EarnEvents.earn_deposit_terms_and_conditions_press]: `When a user taps on the terms and conditions link on the deposit bottom sheet`,
[EarnEvents.earn_deposit_complete]: `When a user taps on the complete button on the deposit bottom sheet`,
Expand Down Expand Up @@ -658,4 +658,5 @@ export const eventDocs: Record<AnalyticsEventType, string> = {
// [KeylessBackupEvents.cab_sign_in_with_google_success]: ``, renamed to cab_sign_in_success when we started supporting Apple sign in
// [EarnEvents.earn_pool_card_cta_press]: `When the user taps a cta button on the pool card`,
// [EarnEvents.earn_active_pools_cta_press]: `cta buttons on the card were removed and replaced with a single card press event`,
// [EarnEvents.earn_add_crypto_action_press]: `When a user in the Earn flow enters an amount higher than their balance and chooses an option to add crypto`,
}
4 changes: 2 additions & 2 deletions src/components/AddAssetsBottomSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import BottomSheet, { BottomSheetModalRefType } from 'src/components/BottomSheet
import Touchable from 'src/components/Touchable'
import QuickActionsAdd from 'src/icons/quick-actions/Add'
import QuickActionsSend from 'src/icons/quick-actions/Send'
import QuickActionsSwap from 'src/icons/quick-actions/Swap'
import SwapArrows from 'src/icons/SwapArrows'
import { Colors } from 'src/styles/colors'
import { typeScale } from 'src/styles/fonts'
import { Spacing } from 'src/styles/styles'
Expand Down Expand Up @@ -47,7 +47,7 @@ export default function AddAssetsBottomSheet({
title: t('addFundsActions.transfer'),
},
[TokenActionName.Swap]: {
iconComponent: QuickActionsSwap,
iconComponent: SwapArrows,
title: t('addFundsActions.swap'),
},
}
Expand Down
Loading

0 comments on commit cc12ac5

Please sign in to comment.