Skip to content

Disable swaps based on chainId, instead of network id#10155

Merged
danjm merged 1 commit intodevelopfrom
swaps-disabled-based-on-chainId
Jan 7, 2021
Merged

Disable swaps based on chainId, instead of network id#10155
danjm merged 1 commit intodevelopfrom
swaps-disabled-based-on-chainId

Conversation

@danjm
Copy link
Copy Markdown
Contributor

@danjm danjm commented Jan 7, 2021

Currently, the swaps button is disabled when the current network id is not the mainnet network id. There are, however, some networks that have the same network id as ethereum mainnet. Ethereum Classic is a prominent example. This means that users connected to the ethereum classic network can access and use the swaps feature.

Unfortunately doing so would just cause them to lose funds, as there is no swaps contract on networks other than mainnet.

This PR prevents this problem by disabling access to swaps based on chainId instead of networkId. In addition, it prevents accessing swaps routes entirely when not on mainnet.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 7, 2021

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@danjm danjm requested a review from a team as a code owner January 7, 2021 15:40
@danjm danjm requested a review from darkwing January 7, 2021 15:40
Copy link
Copy Markdown
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this breaks stuff

@danjm danjm force-pushed the swaps-disabled-based-on-chainId branch from 4d3fd72 to 8cb244e Compare January 7, 2021 16:21
@danjm danjm force-pushed the swaps-disabled-based-on-chainId branch from 8cb244e to 30fdf69 Compare January 7, 2021 16:33
Copy link
Copy Markdown
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

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

LGTM!

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [30fdf69]
Page Load Metrics (567 ± 54 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint34674994
domContentLoaded34670856611254
load34871056711254
domInteractive34670756511254

@danjm danjm merged commit 9a1e83c into develop Jan 7, 2021
@danjm danjm deleted the swaps-disabled-based-on-chainId branch January 7, 2021 16:59
@github-actions github-actions bot locked and limited conversation to collaborators Jan 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants