Skip to content

Ensure custom slippage is a number#9915

Merged
Gudahtt merged 1 commit intodevelopfrom
ensure-custom-slippage-is-a-number
Nov 19, 2020
Merged

Ensure custom slippage is a number#9915
Gudahtt merged 1 commit intodevelopfrom
ensure-custom-slippage-is-a-number

Conversation

@Gudahtt
Copy link
Copy Markdown
Member

@Gudahtt Gudahtt commented Nov 19, 2020

This fixes a PropType error when using non-custom slippage, and it fixes a type inconsistency when custom slippage is used.

Previously, slippage was being converted explicitly to a Number as it was passed into BuildQuote, but not as it was passed into AwaitingSwap. Also the PropType was set as string, despite the fact that it's a number in most cases, and is used for math.

The PropType has been changed to number, and the selective casting to Number has been removed. Instead, the maxSlippage value is cast to a Number as it's being selected, so that the type is always consistent.

This fixes a PropType error when using non-custom slippage, and it
fixes a type inconsistency when custom slippage is used.

Previously, `slippage` was being converted explicitly to a `Number` as
it was passed into `BuildQuote`, but not as it was passed into
`AwaitingSwap`. Also the PropType was set as `string`, despite the fact
that it's a number in most cases, and is used for math.

The PropType has been changed to `number`, and the selective casting to
`Number` has been removed. Instead, the `maxSlippage` value is cast to
a `Number` as it's being selected, so that the type is always
consistent.
@Gudahtt Gudahtt requested a review from a team as a code owner November 19, 2020 12:48
@Gudahtt Gudahtt requested a review from rekmarks November 19, 2020 12:48
@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [9d114c9]
Page Load Metrics (361 ± 38 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint308341147
domContentLoaded2446013597838
load2456033617838
domInteractive2446013597838

Copy link
Copy Markdown
Contributor

@brad-decker brad-decker left a comment

Choose a reason for hiding this comment

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

LGTM

@Gudahtt Gudahtt merged commit bb3a042 into develop Nov 19, 2020
@Gudahtt Gudahtt deleted the ensure-custom-slippage-is-a-number branch November 19, 2020 15:26
@github-actions github-actions bot locked and limited conversation to collaborators Nov 19, 2020
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