Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add token name to structure #1336

Merged
merged 5 commits into from
Feb 27, 2025
Merged

Add token name to structure #1336

merged 5 commits into from
Feb 27, 2025

Conversation

JIOjosBG
Copy link
Member

@JIOjosBG JIOjosBG commented Feb 25, 2025

Resolves: https://github.com/AmbireTech/ambire-app/issues/3951

adds token name property to:

  • portfolio tokens
  • defi positions
  • networks (for native asset)

@JIOjosBG JIOjosBG added the enhancement New feature or request label Feb 25, 2025
@JIOjosBG JIOjosBG self-assigned this Feb 25, 2025
@JIOjosBG JIOjosBG marked this pull request as ready for review February 26, 2025 12:52
@JIOjosBG JIOjosBG requested a review from jordan-enev February 26, 2025 12:54
@@ -42,7 +44,7 @@ contract BalanceGetter is Simulation {
TokenInfo[] memory results = new TokenInfo[](len);
for (uint256 i = 0; i < len; i++) {
if (tokenAddrs[i] == address(0)) {
results[i] = TokenInfo('ETH', address(account).balance, 18, bytes(''));
results[i] = TokenInfo('ETH', 'Ether', address(account).balance, 18, bytes(''));
Copy link
Member

Choose a reason for hiding this comment

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

not directly related to the PR, but how do we handle this for non-eth networks? as far as I remember we change the hardcoded value somewhere in the portfolio library in common

Copy link
Member Author

@JIOjosBG JIOjosBG Feb 27, 2025

Choose a reason for hiding this comment

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

good catch, it should have been done here it is already done here https://github.com/AmbireTech/ambire-common/blob/v2/src/libs/portfolio/getOnchainBalances.ts#L214

uint256 tokenId = INonfungiblePositionManager(positionManagementAddr).tokenOfOwnerByIndex(userAddr, i);
Position memory positionInfo = INonfungiblePositionManager(positionManagementAddr).positions(tokenId);

if(positionInfo.liquidity == 0) continue;
Copy link
Member

Choose a reason for hiding this comment

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

Nice optimization 👍

@JIOjosBG JIOjosBG merged commit bdfed32 into v2 Feb 27, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants