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

[TRIVIAL] Base: Add support for Balancer #90

Merged
merged 3 commits into from
Dec 2, 2024

Conversation

m-lord-renkse
Copy link
Collaborator

Add support for Balancer chain ID.

@m-lord-renkse m-lord-renkse changed the title Base: Add support for Balancer [TRIVIAL] Base: Add support for Balancer Dec 2, 2024
@@ -189,6 +189,7 @@ impl Chain {
eth::ChainId::Mainnet => Ok(Self::Mainnet),
eth::ChainId::Gnosis => Ok(Self::Gnosis),
eth::ChainId::ArbitrumOne => Ok(Self::Arbitrum),
eth::ChainId::Base => Ok(Self::Base),
unsupported => Err(Error::UnsupportedChainId(unsupported)),
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of using unsupported as the catch-all term we should probably explicitly list the unsupported networks. That way the compiler would have complained about the match statement here when you added the Base variant.

Copy link
Collaborator Author

@m-lord-renkse m-lord-renkse Dec 2, 2024

Choose a reason for hiding this comment

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

This check was made for each request. So, I changed the parsing to be done at startup instead that for each request (which is inefficient). Now it should panic at startup if the network is not supported instead than throwing an error for each request.

Copy link
Contributor

Choose a reason for hiding this comment

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

The actual comment was not addressed, though.
My point was to change the match statement to ensure that the compiler yells at us whenever we add a new chain. So in our case:

eth::ChainId::Goerli => Err(Error::UnsupportedChain(chain_id)),

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh, sorry, I totally misunderstood you. On it!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@MartinquaXD done! let me also know if you agree with the changes of making it as a startup error instead of parsing it for each request.

@m-lord-renkse m-lord-renkse force-pushed the base-add-to-balancer-dto branch from 918d9a8 to 5cfce9b Compare December 2, 2024 11:22
@m-lord-renkse m-lord-renkse merged commit 8ed1470 into main Dec 2, 2024
3 checks passed
@m-lord-renkse m-lord-renkse deleted the base-add-to-balancer-dto branch December 2, 2024 16:05
m-lord-renkse added a commit that referenced this pull request Dec 4, 2024
Add support for Balancer chain ID.
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.

3 participants