Skip to content

fix: default usd_amount_source#7899

Merged
infiniteflower merged 7 commits intomainfrom
swaps-3592-usd-amount-source-failed
Feb 13, 2026
Merged

fix: default usd_amount_source#7899
infiniteflower merged 7 commits intomainfrom
swaps-3592-usd-amount-source-failed

Conversation

@infiniteflower
Copy link
Contributor

@infiniteflower infiniteflower commented Feb 10, 2026

Explanation

This PR fixes issues with non-EVM chains metrics fields: usd_amount_source, usd_quoted_gas, and usd_quoted_return being empty.

BTC > Ethereum ETH

{
  "event": "Unified SwapBridge Submitted",
  "properties": {
    "action_type": "swapbridge-v1",
    "chain_id_destination": "eip155:1",
    "chain_id_source": "bip122:000000000019d6689c085ae165831e93",
    "token_symbol_destination": "ETH",
    "token_symbol_source": "BTC",
    "usd_amount_source": 8.552348546334175,
    "usd_quoted_gas": 0.1528316510665362,
    "usd_quoted_return": 8.077899232411106
  }
}

Solana USDC > Ethereum USDC

{
  "event": "Unified SwapBridge Submitted",
  "properties": {
    "action_type": "swapbridge-v1",
    "chain_id_destination": "eip155:1",
    "chain_id_source": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
    "token_symbol_destination": "USDC",
    "token_symbol_source": "USDC",
    "usd_amount_source": 7.610396854485804,
    "usd_quoted_gas": 0.0004258844456526694,
    "usd_quoted_return": 7.509516072087331
  }
}
{
  "event": "Unified SwapBridge Completed",
  "properties": {
    "action_type": "swapbridge-v1",
    "actual_time_minutes": 0.7352166666666666,
    "chain_id_destination": "eip155:1",
    "chain_id_source": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
    "token_symbol_destination": "USDC",
    "token_symbol_source": "USDC",
    "usd_actual_gas": 0,
    "usd_actual_return": 7.509941956532984,
    "usd_amount_source": 7.610396854485804,
    "usd_quoted_gas": 0.0004258844456526694,
    "usd_quoted_return": 7.509941956532984
  }
}

Solana SOL > Solana USDC

{
  "event": "Unified SwapBridge Submitted",
  "properties": {
    "action_type": "swapbridge-v1",
    "chain_id_destination": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
    "chain_id_source": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
    "token_symbol_destination": "USDC",
    "token_symbol_source": "SOL",
    "usd_amount_source": 2.279447465339925,
    "usd_quoted_gas": 0.000425849999999986,
    "usd_quoted_return": 2.267409556725925
  }
}
{
  "event": "Unified SwapBridge Completed",
  "properties": {
    "action_type": "swapbridge-v1",
    "actual_time_minutes": 0,
    "chain_id_destination": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
    "chain_id_source": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
    "token_address_destination": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
    "token_address_source": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501",
    "token_symbol_destination": "USDC",
    "token_symbol_source": "SOL",
    "usd_actual_gas": 0,
    "usd_actual_return": 0,
    "usd_amount_source": 2.279447465339925,
    "usd_quoted_gas": 0.000425849999999986,
    "usd_quoted_return": 2.267835406725925
  }
}

References

Fixes: https://consensyssoftware.atlassian.net/browse/SWAPS-3592
Fixes: https://consensyssoftware.atlassian.net/browse/SWAPS-4121

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Medium Risk
Changes exchange-rate derivation logic for non-EVM chains and alters emitted metrics defaults; risk is mainly incorrect USD calculations if currencyRates is missing or inconsistent.

Overview
Fixes metrics gaps for non-EVM swaps/bridges by deriving usdExchangeRate from multichain asset rates using an inferred user-currency→USD conversion factor, enabling usd_amount_source, usd_quoted_gas, and usd_quoted_return to be populated.

Also changes EVM transaction metrics defaults so usd_amount_source is 0 instead of 100, and updates/expands unit tests and snapshots accordingly; both packages’ changelogs are updated.

Written by Cursor Bugbot for commit 7ee3057. This will update automatically on new commits. Configure here.

@infiniteflower infiniteflower marked this pull request as ready for review February 13, 2026 19:12
@infiniteflower infiniteflower requested review from a team as code owners February 13, 2026 19:12
micaelae
micaelae previously approved these changes Feb 13, 2026
@infiniteflower infiniteflower force-pushed the swaps-3592-usd-amount-source-failed branch from 864c9bf to 0a49a98 Compare February 13, 2026 19:54
@infiniteflower infiniteflower added this pull request to the merge queue Feb 13, 2026
Merged via the queue into main with commit 16bdd03 Feb 13, 2026
302 checks passed
@infiniteflower infiniteflower deleted the swaps-3592-usd-amount-source-failed branch February 13, 2026 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants