Implementing DeFi Yield Display in Mobile Wallets

TRUETECH is engaged in the development, support and maintenance of iOS, Android, PWA mobile applications. We have extensive experience and expertise in publishing mobile applications in popular markets like Google Play, App Store, Amazon, AppGallery and others.

Development and support of all types of mobile applications:

Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1All 1734 services
Implementing DeFi Yield Display in Mobile Wallets
Medium
~3-5 days
Frequently Asked Questions

Our competencies:

Development stages

Latest works

  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    860
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    746
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1163
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    1035
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    970
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    564

How to Display DeFi Position Yields in a Mobile Wallet?

We constantly solve the problem of displaying DeFi positions in mobile wallets. Clients want to see all their investments — liquidity in Uniswap v3, staking in Lido, lending in Aave — on one screen. The issue is that each protocol has its own smart contract and yield calculation formula. Without a ready-made aggregator, implementation drags on for months. We have accumulated experience integrating with dozens of protocols and guarantee stable operation.

Data Sources for DeFi Positions

  • DeFi Llama API — a free protocol aggregator. Endpoint /tvl/{protocol} returns TVL, /yields returns current APY by pools. It's good for displaying market data but does not provide positions for a specific address.
  • Zapper API / Zerion API — portfolio aggregators. One request with a wallet address returns all DeFi positions across supported protocols with current balance and P&L. Zerion supports 400+ protocols on 10+ networks. They are paid but save a month of development (cost reduction of 60–70%).
  • Direct smart contract calls via eth_call — for specific protocols or custom data not available in aggregators.

Why an Aggregator is Better Than Direct Calls?

An aggregator (Zerion or Zapper) provides coverage of 400+ protocols in 1–2 weeks of integration, whereas direct integration with one protocol takes 2–4 weeks. That's 4 times faster and significantly reduces development costs — budget savings can reach thousands of dollars per protocol.

Method Number of Protocols Integration Time Data Accuracy
Aggregator (Zerion) 400+ 1–2 weeks Medium (depends on API)
Direct calls (Aave) 1 at a time 2–4 weeks per protocol High (blockchain)
Subgraph (Uniswap) 1 at a time 1–2 weeks High (indexed data)

How to Read a Position Directly from an Aave v3 Contract?

For Aave v3, the main contract is UiPoolDataProviderV3. One eth_call returns all data for all user reserves:

Aave v3 call example
final contract = DeployedContract(
  ContractAbi.fromJson(aaveUiDataProviderAbi, 'UiPoolDataProviderV3'),
  EthereumAddress.fromHex('0x91c0eA31b49B69Ea18607702c5d9aC360bf3dE7d'),
);

final result = await ethClient.call(
  contract: contract,
  function: contract.function('getUserReservesData'),
  params: [
    EthereumAddress.fromHex(poolAddressProvider),
    EthereumAddress.fromHex(userAddress),
  ],
);

The UserReserveData structure contains currentATokenBalance (how much deposited including accrued interest) and currentVariableDebt (variable debt). APY is calculated from the reserve's liquidityRate using the formula APY = (1 + liquidityRate/10^27 / secondsPerYear)^secondsPerYear - 1. We have verified calculations on 100+ pools — error less than 0.01%.

How to Display Uniswap v3 Positions with Price Range?

Uniswap v3 is more complex because each position is an NFT with an individual concentrated liquidity range. NFT positions are stored in NonfungiblePositionManager (address 0xC36442b4a4522E871399CD717aBDD847Ab11FE88 on mainnet).

To obtain user positions:

  1. balanceOf(userAddress) — number of NFT positions.
  2. tokenOfOwnerByIndex(userAddress, index) — token IDs for each position.
  3. positions(tokenId) — position parameters: token0/token1, fee tier, tickLower, tickUpper, liquidity.

Calculating the current amount of token0/token1 from liquidity and the current sqrtPriceX96 is non-trivial math following formulas from the Uniswap v3 whitepaper. It's better to use the ready-made @uniswap/v3-sdk on JS via WebView bridge or port the formulas to Dart/Kotlin/Swift. Simpler: Uniswap Subgraph on The Graph returns position with already computed collectedFeesToken0, collectedFeesToken1, depositedToken0, depositedToken1.

What About Impermanent Loss in P&L Calculation?

P&L = (current value of position in USD) - (initial invested value in USD). The pitfall is impermanent loss. If you invested 1 ETH + 1000 USDC in a Uniswap v3 pool, and ETH goes up — the pool will have less ETH and more USDC. Simply comparing current balance to initial in USD is insufficient — you need to account for IL relative to a hold strategy. For displaying P&L to the user: we show "fees earned" separately from "price change of underlying assets" — this is more understandable than a single P&L number.

How to Optimize Data Updates and Caching?

DeFi data changes with every block (~12 seconds on Ethereum). Fetching it on every screen open is sufficient; pull-to-refresh is a standard UX pattern. Cache with a TTL of 60 seconds: users don't expect real-time accuracy for lending. For staking positions with slow yield accumulation (Lido stETH) — we locally compute accumulated yield based on current APY and time since last update, displaying an optimistic estimate without extra requests.

Scenario Request Frequency Cache TTL Notes
Opening position screen On every open 60 s Pull-to-refresh updates
Staking (Lido) Every 5 minutes 300 s Local yield estimate
Pull-to-refresh On request Forced update

What's Included in the Work and How We Do It

Integration steps:

  1. Protocol analysis — determine which DeFi protocols to support, choose optimal data source (aggregator or direct contract).
  2. Aggregator integration — connect Zerion or Zapper for fast coverage of 400+ protocols.
  3. Custom calls — implement direct eth_call or Subgraph for specific protocols.
  4. P&L and APY calculation — implement formulas, verify on historical data.
  5. Caching optimization — configure TTL, local estimates for staking.
  6. Testing and deployment — cover with unit tests, integration tests on testnets.

What You Get as a Result

  • Position display for priority protocols (Aave, Uniswap, Compound, Lido, etc.)
  • Current balance and APY calculation
  • Fees earned and P&L display
  • Caching with appropriate TTL
  • Multichain support (Ethereum, Arbitrum, Optimism, Base)

Timeline: integration via aggregator with position display — 1–2 weeks. Direct integration with 3–5 protocols with custom P&L calculation — 4–6 weeks. Cost calculated individually. Our experience — 7+ years in mobile development and 15+ DeFi projects — ensures deadlines are met. Contact us to discuss your project. Request a consultation — we'll help implement a DeFi wallet with yield view in your mobile application.

Mobile App Analytics: Firebase, Amplitude, AppsFlyer and Attribution

Our team regularly encounters projects where analytics is already "set up" but yields no real insights. A typical example is a startup with 50k DAU: tracking dozens of events without a single answer to the question "why don't users reach payment?". In two weeks we built a basic funnel and found that 70% of users drop off at the phone number verification screen. After fixing the bug, retention increased by 12%. The takeaway: analytics should start with specific questions, not tracking everything indiscriminately.

Why Event Taxonomy is the Foundation of Mobile App Analytics?

Firebase Analytics, Amplitude, Mixpanel — technically similar. The difference lies in what you put into them. A common mistake: events like screen_view, button_tap_1, button_tap_2 without context. A month later, no one remembers what button_tap_2 means.

Proper taxonomy: object + action + context. product_viewed, checkout_started, payment_completed with parameters product_id, category, price, source. This allows building funnels, cohort analysis, and retention without additional tracking.

We document the naming convention in a tracking plan — a document (Google Sheet or Amplitude Data Catalog) describing every event, its parameters, and triggering conditions. The tracking plan is synced with the analytics team before development begins, not after. This approach ensures that data remains interpretable months later and doesn't become a dump. Experience from 50+ projects confirms: without a tracking plan, analytics maintenance costs increase 2-3 times due to rework.

What Should You Choose for Mobile App Analytics: Firebase, Amplitude, or Mixpanel?

The table below highlights key differences between the three popular platforms. Choice depends on budget, traffic, and tasks.

Criteria Firebase Analytics Amplitude Mixpanel
Free limit Unlimited (Spark plan) Up to 10M events/month Up to 1K MTU/month (Special)
Data latency Up to 24 hours (standard) Minutes (real-time) Minutes (real-time)
Funnels and cohorts Basic funnels, limited count Deep funnels, Journeys, cohorts Funnels, Retention, Insights
BigQuery export Yes (free, raw data) Yes (subscription) Yes (Enterprise)
Session Replay No Yes (iOS/Android SDK) No
Ad integration Google Ads (native) Via Universal Links Via partners

Firebase Analytics — free, deep integration with Google Ads, BigQuery export for raw data. Limitations: data latency up to 24 hours, limited funnels. For startups with Google Ads traffic, it's the first choice.

Amplitude — product analytics focused on cohorts and user journeys. Journeys (formerly Pathfinder) shows actual paths between events — not assumed funnels but real routes. Session Replay records sessions for UX analysis. The free tier up to 10M events/month is enough for most products at launch.

Mixpanel — close to Amplitude, stronger in real-time segmentation. Insights, Funnels, Retention cover 90% of product analysts' tasks.

How to Solve Multi-Channel Attribution with AppsFlyer?

Knowing where a user came from is a separate task. Firebase Attribution works only within the Google ecosystem. For multi-channel attribution (Facebook Ads, TikTok, Apple Search Ads, programmatic), an MMP (Mobile Measurement Partner) is needed.

AppsFlyer is the market leader. OneLink — universal deep link working on iOS and Android, correctly attributing installs from any channel. Protect360 — built-in fraud protection (fake installs, click injection on Android). Adjust and Branch are competitors with similar features. Branch excels in deep linking; Adjust is popular in gaming.

According to Apple, with iOS 14.5, apps must obtain user permission via ATT before collecting IDFA for tracking. AppsFlyer uses probabilistic matching (IP + user agent + timing) for these users — accuracy is lower but better than nothing. SKAdNetwork and Privacy Preserving Attribution provide aggregated data from Apple with a 24-72 hour delay.

How to Set Up Crash Analytics to Not Miss Bugs?

Firebase Crashlytics is the standard for crash reporting. It automatically groups crashes by stack trace, shows affected users %, and sends velocity alerts when crash rate increases by more than 10% per hour.

Important: symbolication. On iOS, .dSYM files must be automatically uploaded with each build — via Fastlane upload_symbols_to_crashlytics or Xcode Cloud built-in. Without symbols, crashes in Crashlytics appear as memory addresses. This happens more often than expected when switching to a new CI — in one project with 500k users, we found that 40% of crashes remained unsymbolicated due to a missing CI/CD step. After automation, bug response time dropped from 3 hours to 15 minutes.

For React Native and Flutter, @sentry/react-native and sentry_flutter provide additional context: breadcrumbs, network requests before the crash, Redux/Provider state.

Below is a comparison of popular crash analytics tools to choose according to your needs.

Criteria Firebase Crashlytics Sentry Instabug
Free limit Unlimited (Spark) 5k events/month 250 MAU
Grouping By stack trace + parameters By fingerprint By stack trace + metadata
Symbolication Automatic (via file) Automatic (via CLI) Automatic
Velocity alerts Yes (by % change) Yes (by count) Yes (by threshold)
Extra context Logs, Keys, Custom Keys Breadcrumbs, User, Tags User steps, network requests
Price Free (in Firebase) Paid plans available Paid plans available

Environment Setup

Three environments with separate Firebase projects: dev, staging, production. Mixing analytics from test sessions and production is a common mistake that skews all metrics. On iOS via GoogleService-Info.plist per scheme, on Android via google-services.json in each flavor folder.

Timelines: basic analytics with Firebase + Crashlytics — 3-5 days. Full tracking plan + Amplitude/Mixpanel with funnels and cohorts — 2-3 weeks. Attribution via AppsFlyer with deep linking and fraud protection — 1-2 weeks. Cost is calculated individually based on integration complexity.

What Is Included in Our Work

As part of analytics implementation, we provide:

  • Development and approval of a tracking plan with product and marketing teams.
  • SDK integration (Firebase, Amplitude, Mixpanel, AppsFlyer) considering your stack (Swift/Kotlin/Flutter/React Native).
  • Setup of funnels, cohorts, dashboards, and alerts.
  • Automation of symbolication and .dSYM upload via Fastlane.
  • Documentation of events and parameters.
  • Team training on the analytics platform.
  • Two weeks of post-release support and tracking adjustments.

Our experience: 7 years of analytics implementation and over 80 successful projects in mobile development. We guarantee data correctness and transparency at every stage.

Contact us for a consultation on setting up analytics for your app. Request an audit of your current analytics — and we will show you which metrics you are losing.