refactor: code optimisation for erc20#7553
Merged
ArunBala-Bitgo merged 1 commit intomasterfrom Nov 24, 2025
Merged
Conversation
0bbc64f to
c0491b5
Compare
Taseen08
previously approved these changes
Nov 20, 2025
Contributor
Taseen08
left a comment
There was a problem hiding this comment.
lgtm from WP, coins team review would be more relevant
c0491b5 to
b6a8478
Compare
pritam-gembali
previously requested changes
Nov 20, 2025
Contributor
pritam-gembali
left a comment
There was a problem hiding this comment.
Good effort to simplify. Let's do it the right way please
Taseen08
previously approved these changes
Nov 20, 2025
5c25d02 to
e58fc9e
Compare
e58fc9e to
ccd5a2f
Compare
3dda2b1 to
d325b85
Compare
Contributor
mmcshinsky-bitgo
left a comment
There was a problem hiding this comment.
Can we add tests to make sure there aren't any regressions to these changes?
Taseen08
reviewed
Nov 21, 2025
Contributor
Taseen08
left a comment
There was a problem hiding this comment.
can we address the comment regarding test cov?
d325b85 to
644708d
Compare
644708d to
d8693ab
Compare
Contributor
Author
d8693ab to
b76e247
Compare
mmcshinsky-bitgo
approved these changes
Nov 21, 2025
ravibitgo
approved these changes
Nov 21, 2025
Taseen08
approved these changes
Nov 21, 2025
venkateshv1266
approved these changes
Nov 24, 2025
concerns addressed - EthLikeErc20Token is used for evm coins and ERC20Token instance is already being used by eth coin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Ticket: WIN-7914
Optimisation:
coinFactory.ts - Added map-based routing for EthLike chains
Adding to the above map would reduce code bloat by decreasing the size of the switch case. Around 6 chains from the switch case would be removed and added to the map, and future coins would only be added to the map, reducing multiple lines of code and code bloat for each chain.
tokenConfig.ts - Currently has repetitive token config functions
the above generic method reduces around 120 lines by removing all the token specific methods:
This avoids code repetition, keeping the code clean and preventing code bloat.
Also extracted TokenNetwork interface and created reusable type definition for token network structure, created getFormattedTokensByNetwork helper and consolidated mainnet/testnet token formatting logic
Before & After

Before (Token Configuration)
After (Token Configuration)

Test case results: