Skip to content

Adopt defi-positions sim command for a new payload#44

Merged
ivpusic merged 2 commits intomainfrom
defi_positions_fix
Mar 23, 2026
Merged

Adopt defi-positions sim command for a new payload#44
ivpusic merged 2 commits intomainfrom
defi_positions_fix

Conversation

@ivpusic
Copy link
Copy Markdown
Member

@ivpusic ivpusic commented Mar 23, 2026

The current implementation is assuming outdated response payload

@ivpusic ivpusic requested review from charisra and va3093 March 23, 2026 14:44
@ivpusic ivpusic marked this pull request as ready for review March 23, 2026 14:44
@ivpusic
Copy link
Copy Markdown
Member Author

ivpusic commented Mar 23, 2026

@cursor review

@cursor
Copy link
Copy Markdown

cursor bot commented Mar 23, 2026

PR Summary

Medium Risk
Changes the JSON schema used to unmarshal DeFi positions (renamed fields and nested token objects), so incorrect mapping would silently affect displayed balances/values; adds strong unit coverage to mitigate but existing integration tests may need updates for renamed JSON keys.

Overview
Updates sim evm defi-positions to match the latest defi-positions API response schema by renaming value fields (e.g. usd_value/total_usd_value -> value_usd/total_value_usd), adding chain, and switching from flat token metadata fields to nested token objects (token, underlying_token, token0, token1) including new fields like lending_pool, pool_id, salt, and NFT per-token details.

Adjusts positionDetails formatting to read symbols from the nested token structs via a new tokenSymbol helper, and adds a comprehensive unit test that unmarshals a real API JSON payload to ensure all supported position types (Erc4626/Tokenized/UniswapV2/Nft/NftV4) decode correctly, including null logos and aggregation breakdowns.

Written by Cursor Bugbot for commit 17a78ed. Configure here.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

@ivpusic ivpusic merged commit 272151c into main Mar 23, 2026
2 checks passed
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.

2 participants