Skip to content

[Bug]: Swap is showing zero balance for ERC20 tokens, user are unable to swap #30040

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

Closed
davibroc opened this issue Jan 31, 2025 · 1 comment · Fixed by #30046 or #30108
Closed

[Bug]: Swap is showing zero balance for ERC20 tokens, user are unable to swap #30040

davibroc opened this issue Jan 31, 2025 · 1 comment · Fixed by #30046 or #30108
Assignees
Labels
regression-RC-12.11.0 Regression bug that was found in release candidate (RC) for release 12.11.0 regression-RC-12.12.0 Regression bug that was found in release candidate (RC) for release 12.12.0 release-12.11.0 Issue or pull request that will be included in release 12.11.0 release-12.12.0 Issue or pull request that will be included in release 12.12.0 release-12.13.0 Issue or pull request that will be included in release 12.13.0 release-blocker This bug is blocking the next release Sev1-high High severity; partial loss of service with severe impact upon users, with no workaround. team-assets team-swaps DEPRECATED: Use team-swaps-and-bridge type-bug Something isn't working

Comments

@davibroc
Copy link
Contributor

davibroc commented Jan 31, 2025

Describe the bug

After I import an account and switch to Populat Network I am unable to see balance for ERC20 tokens when I swap . See video

Expected behavior

I can see balances for ERC20 tokens and I can swap

Screenshots/Recordings

Reprocase.mov

Steps to reproduce

  1. Make sure Ethereum network is selected with account 0xB0dA5965D43369968574D399dBe6374683773a65 already imported
  2. Delete the account
  3. Import it again
  4. Notice that the now you can see the balances on Swap
  5. Switch to Popular network
  6. Try to Swap and see the balances are gone

Error messages or log output

Detection stage

During release testing

Version

12.12.0

Build type

None

Browser

Chrome

Operating system

MacOS

Hardware wallet

No response

Additional context

No response

Severity

No response

@davibroc davibroc added the type-bug Something isn't working label Jan 31, 2025
@github-project-automation github-project-automation bot moved this to To be fixed in Bugs by severity Jan 31, 2025
@davibroc davibroc added team-swaps DEPRECATED: Use team-swaps-and-bridge regression-prod-12.12.0 Regression bug that was found in production in release 12.12.0 release-blocker This bug is blocking the next release Sev1-high High severity; partial loss of service with severe impact upon users, with no workaround. release-12.11.0 Issue or pull request that will be included in release 12.11.0 regression-RC-12.11.0 Regression bug that was found in release candidate (RC) for release 12.11.0 release-12.12.0 Issue or pull request that will be included in release 12.12.0 team-assets and removed regression-prod-12.12.0 Regression bug that was found in production in release 12.12.0 labels Jan 31, 2025
@metamaskbot metamaskbot added regression-prod-12.12.0 Regression bug that was found in production in release 12.12.0 regression-RC-12.12.0 Regression bug that was found in release candidate (RC) for release 12.12.0 and removed regression-RC-12.11.0 Regression bug that was found in release candidate (RC) for release 12.11.0 regression-prod-12.12.0 Regression bug that was found in production in release 12.12.0 labels Jan 31, 2025
@jvbriones jvbriones added regression-RC-12.3 Regression bug that was found in release candidate (RC) for release 12.3 and removed regression-RC-12.3 Regression bug that was found in release candidate (RC) for release 12.3 labels Feb 3, 2025
@dbrans dbrans added the regression-RC-12.11.0 Regression bug that was found in release candidate (RC) for release 12.11.0 label Feb 3, 2025
github-merge-queue bot pushed a commit that referenced this issue Feb 3, 2025
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

Balances should be displayed on the swap from picker

core PR: MetaMask/core#5257

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/30046?quickstart=1)

## **Related issues**

Fixes: #30040 

## **Manual testing steps**

1. Choose popular network on the network tokens filter
2. Click on swap button
3. balances should be displayed on the from and to picker 

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
@metamaskbot metamaskbot added the release-12.13.0 Issue or pull request that will be included in release 12.13.0 label Feb 3, 2025
salimtb added a commit that referenced this issue Feb 3, 2025
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

Balances should be displayed on the swap from picker

core PR: MetaMask/core#5257

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/30046?quickstart=1)

Fixes: #30040

1. Choose popular network on the network tokens filter
2. Click on swap button
3. balances should be displayed on the from and to picker

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

<!-- [screenshots/recordings] -->

<!-- [screenshots/recordings] -->

- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
salimtb added a commit that referenced this issue Feb 3, 2025
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/30071?quickstart=1)

## **Related issues**

Related: #30040

## **Manual testing steps**

1. Go to this page...
2.
3.

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
Mrtenz pushed a commit that referenced this issue Feb 4, 2025
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

Balances should be displayed on the swap from picker

core PR: MetaMask/core#5257

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/30046?quickstart=1)

## **Related issues**

Fixes: #30040 

## **Manual testing steps**

1. Choose popular network on the network tokens filter
2. Click on swap button
3. balances should be displayed on the from and to picker 

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
Mrtenz pushed a commit that referenced this issue Feb 4, 2025
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

Balances should be displayed on the swap from picker

core PR: MetaMask/core#5257

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/30046?quickstart=1)

## **Related issues**

Fixes: #30040 

## **Manual testing steps**

1. Choose popular network on the network tokens filter
2. Click on swap button
3. balances should be displayed on the from and to picker 

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
@dbrans dbrans reopened this Feb 4, 2025
@dbrans dbrans closed this as completed Feb 4, 2025
@itsyoboieltr itsyoboieltr linked a pull request Feb 4, 2025 that will close this issue
7 tasks
seaona pushed a commit that referenced this issue Feb 6, 2025
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

Balances should be displayed on the swap from picker

core PR: MetaMask/core#5257

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/30046?quickstart=1)

## **Related issues**

Fixes: #30040 

## **Manual testing steps**

1. Choose popular network on the network tokens filter
2. Click on swap button
3. balances should be displayed on the from and to picker 

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
@darkwing
Copy link
Contributor

darkwing commented Feb 14, 2025

1️⃣ What was the issue?

. This issue involved two separate problems: first, the token state had been corrupted, and second, the token list was not refreshing correctly.

2️⃣ Why did it happen and why wasn’t it caught earlier?

. In this case, the refresh issue appeared to be caused by a missing dependency in the useEffect, suggesting that it was an existing bug.

Regarding the state corruption, the update to the asset controllers required migrating tokensState to allTokens across the extension. However, it seems that the swap feature was still relying on the old tokensState.

3️⃣ What actions are we taking to prevent this in the future?

  • Token state was migrated to a fresh, fixed state
  • Test was added

4️⃣ Any related tickets and ETAs for follow-up actions?

.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression-RC-12.11.0 Regression bug that was found in release candidate (RC) for release 12.11.0 regression-RC-12.12.0 Regression bug that was found in release candidate (RC) for release 12.12.0 release-12.11.0 Issue or pull request that will be included in release 12.11.0 release-12.12.0 Issue or pull request that will be included in release 12.12.0 release-12.13.0 Issue or pull request that will be included in release 12.13.0 release-blocker This bug is blocking the next release Sev1-high High severity; partial loss of service with severe impact upon users, with no workaround. team-assets team-swaps DEPRECATED: Use team-swaps-and-bridge type-bug Something isn't working
Projects
Archived in project
9 participants
@darkwing @dbrans @jvbriones @davibroc @salimtb @metamaskbot and others