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

fix(TXL-399): Use contract abi to decode the amounts of token balance changes #4775

Merged
merged 8 commits into from
Oct 15, 2024

Conversation

dbrans
Copy link
Contributor

@dbrans dbrans commented Oct 9, 2024

Explanation

  • Use contract abi's to decode the amounts of token balance changes – instead of the raw output from a balanceOf call.

References

Changelog

@metamask/transaction-controller

  • FIXED: Use contract abi's to decode the amounts of token balance changes – instead of the raw output from a balanceOf call.

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 highlighted breaking changes using the "BREAKING" category above as appropriate
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

@dbrans dbrans changed the title tests passing fix(TXL-399): Use contract abi to decode the amounts of token balance changes Oct 9, 2024
@dbrans dbrans marked this pull request as ready for review October 9, 2024 17:54
@dbrans dbrans requested a review from a team as a code owner October 9, 2024 17:54
@sleepytanya
Copy link

Accurate token amount and fiat price for vUSDC:

Screenshot 2024-10-09 at 21 40 59
vusdc.mov

*/
function getValueFromBalanceTransaction(
export function getValueFromBalanceTransaction(
Copy link
Member

Choose a reason for hiding this comment

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

We want to limit the public API as much as possible, so can we avoid exporting this purely for the sake of a unit test, and instead verify any new logic via a call to getSimulationData?

packages/transaction-controller/src/utils/simulation.ts Outdated Show resolved Hide resolved
packages/transaction-controller/src/utils/simulation.ts Outdated Show resolved Hide resolved
packages/transaction-controller/src/utils/simulation.ts Outdated Show resolved Hide resolved
matthewwalsh0
matthewwalsh0 previously approved these changes Oct 11, 2024
@dbrans dbrans merged commit 7aff044 into main Oct 15, 2024
116 checks passed
@dbrans dbrans deleted the djb/sim-abi-decode branch October 15, 2024 11:26
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.

[Bug]: Wrong token amount for vUSDC minting and withdrawing on Venus
3 participants