Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

[Price Impact]: Base #1509

Merged
merged 14 commits into from
Nov 2, 2020
Merged

[Price Impact]: Base #1509

merged 14 commits into from
Nov 2, 2020

Conversation

W3stside
Copy link
Contributor

@W3stside W3stside commented Oct 8, 2020

Price Impact

Base PR for all waterfalling price impact related PRs

src/components/trade/PriceImpact.tsx Outdated Show resolved Hide resolved
src/components/trade/PriceImpact.tsx Outdated Show resolved Hide resolved
@Velenir
Copy link
Contributor

Velenir commented Oct 8, 2020

Build broke
This has happened before and will happen again, unless...
Since linter doesn't catch type errors in the pre-commit hook, should we maybe add pre-push hook with build

Actually, @W3stside can you try something:

  1. Run yarn build
  2. Note the errors
  3. Run npx tsc --noEmit

If errors are the same, I propose adding pre-push hook with tsc --noEmit

/cc @anxolin @alfetopito

@W3stside
Copy link
Contributor Author

W3stside commented Oct 8, 2020

Build broke
This has happened before and will happen again, unless...
Since linter doesn't catch type errors in the pre-commit hook, should we maybe add pre-push hook with build

Actually, @W3stside can you try something:

  1. Run yarn build
  2. Note the errors
  3. Run npx tsc --noEmit

If errors are the same, I propose adding pre-push hook with tsc --noEmit

/cc @anxolin @alfetopito

how does yarn lint aka eslint not catch these?

@W3stside
Copy link
Contributor Author

W3stside commented Oct 8, 2020

@Velenir npx tsc --noEmit is WAY faster and catches the same errors, please make this PR so we can add asap!

@ghost
Copy link

ghost commented Oct 8, 2020

Travis automatic deployment:

@Velenir
Copy link
Contributor

Velenir commented Oct 8, 2020

how does yarn lint aka eslint not catch these?

because they are types

const n: number = 'string'

won't trigger a linter error, they just do different things. You can explore what triggers linter here

@W3stside W3stside changed the title Price Impact: Price Suggestions impact percentage component [Price Impact]: Price Suggestions impact percentage component Oct 14, 2020
@anxolin
Copy link
Contributor

anxolin commented Oct 14, 2020

What do you mean with BELOW why is it GREEN and negative?
Price impact, as I see it, should be always positive, and between 0 and 100%

Alsop, It show infinite:

image

Copy link
Contributor

@anxolin anxolin left a comment

Choose a reason for hiding this comment

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

The tooltip content is right. We have the same as Uniswap, but in their case they compare the market price with the current price.

We are comparing limit price with current price (honestly, I'm not 100% sure if it makes sense). Price impact officially would be to compare our best ask and market price. I would be concern if users get confused by price impact, I guess, we can try it out and ask for feedback once the demo is working

@W3stside @Rafanator I don't want to

Also: Tooltip is broken:
image

@Rafanator
Copy link
Contributor

I think we should leave the text as it is. A purist definition of market price would be a sort of averaged price amongst all exchanges. Given that we won't do that, I believe it is also fair to call market price the price of the best ask, as that would be the market price in our exchange.

I would just do some small arrangements:

The difference between the market price and the estimated fill price due to order size

@anxolin Please let me know what you think.

@W3stside W3stside requested a review from anxolin October 15, 2020 13:03
@W3stside
Copy link
Contributor Author

What do you mean with BELOW why is it GREEN and negative?
Price impact, as I see it, should be always positive, and between 0 and 100%

Alsop, It show infinite:

image

fair enough, changes made

@anxolin
Copy link
Contributor

anxolin commented Oct 19, 2020

  1. Why if the user doesn't have a price (therefor we cannot show the price impact), we still show a 0%?

image

  1. Can we use also a nicer green. Like in the "price surplus" PR. I believe that green was used for light mode, but in dark mode is not good. Same for the red color in the price impact, it looks a bit purple-brownish.

Regarding rafa's reply

Given that we won't do that, I believe it is also fair to call market price the price of the best ask, as that would be the market price in our exchange.

@Rafanator (and david), with my comment I don't mean this. My point is Uniswap calls Price Impact to the price the user gets, that is the same the user selects as his limit price. We use the limit price, not the "fill price". Not saying is wrong, but ther's a tiny part I don't like. My point is explained here https://gnosisinc.slack.com/archives/CPZA1AGKY/p1603127944112400

  1. @W3stside , I think it would be good if you mimic exactly Uniswap behaviour, ranges for colors, colors and labels. For example, this is how they show tiny amounts.
    image

image

Copy link
Contributor

@anxolin anxolin left a comment

Choose a reason for hiding this comment

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

  • I still have the same concern as the one expressed in my former comment (3).
    I think @Rafanator is looking into it

  • I still have the same concern as the one expressed in my former comment (4). The label is fine now, but the colors...

    1. Are we sure we want to hide the price impact if we have a price selected? I understand in this case, we can show it. Even if it's tiny or 0, it should show <0.01% imo
      image

const { id: baseTokenId, decimals: baseTokenDecimals } = baseToken
const { id: quoteTokenId, decimals: quoteTokenDecimals } = quoteToken

// TODO: useBestAskPrice hook here
Copy link
Contributor

Choose a reason for hiding this comment

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

Hehe, good, maybe make sure is in the check list

Copy link
Contributor

Choose a reason for hiding this comment

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

@anxolin Regarding point 3, I did a suggestion on PR1544. Let me know what you think.

@W3stside W3stside changed the base branch from develop to release/v1.6.0 October 26, 2020 17:17
@W3stside W3stside changed the title [Price Impact]: Price Suggestions impact percentage component [Price Impact]: Base Oct 26, 2020
* small util for checking truthiness

* move PriceImpact into PriceSuggestionsWidget

* move unrelated files into more related FS

* rename isTruthy util fn and use in PriceSUggestions

* styling

1.added button-warning red
2. label no background
3. added midImpact class

* utils: decouple some of the impact level determining logic

1. add midPrice and high price impact thres
2. warning logic fix

* saving warning label change

* address PR comments

1. use standard FormMessage
2. dont show warning on using suggested price
3. change tooltip text

* put in useBestAsk hook

* added placeholder slippage of 0.5%

1. protects against Deep Market warning showing too frequently
2. added some comments for clarity

* addressed PR comments:

1. remove TODO useBestAsk comment
2. simplify priceImpactSmart logic thanks @anxolin
3. use switch cases
4. fix formatSmart broken small amount
5. use enum in priceimpact/utils
6. isStrNumTruthy > isNonZeroNumber rename
* add priceimpact to tradewidget

* [Price Impact] Warnings in PriceSuggestions (#1544)

* small util for checking truthiness

* move PriceImpact into PriceSuggestionsWidget

* move unrelated files into more related FS

* rename isTruthy util fn and use in PriceSUggestions

* styling

1.added button-warning red
2. label no background
3. added midImpact class

* utils: decouple some of the impact level determining logic

1. add midPrice and high price impact thres
2. warning logic fix

* saving warning label change

* address PR comments

1. use standard FormMessage
2. dont show warning on using suggested price
3. change tooltip text

* put in useBestAsk hook

* added placeholder slippage of 0.5%

1. protects against Deep Market warning showing too frequently
2. added some comments for clarity

* addressed PR comments:

1. remove TODO useBestAsk comment
2. simplify priceImpactSmart logic thanks @anxolin
3. use switch cases
4. fix formatSmart broken small amount
5. use enum in priceimpact/utils
6. isStrNumTruthy > isNonZeroNumber rename

* move unrelated files into more related FS

* saving warning label change

* moved logic to usePriceImpact hook

* move types to type subfolder

* add usePRiceImpact hook

* added price impact warnings to TxMessage

* errors as constants

* changed warning message type to object

* removed error title

* usePriceImpact compact logic

* utils:

1. made warnings into constants
2. reworked some of the warning label logic

* PriceImpact %: show 0 when 0 or negative

* remove logDebug

* add PriceImpact into conf modal

* small change

1. extrapolate SimplePriceImpact to reuse
2. new type
3. warnings all have icon

* use fontawesome over system font

* enum doesnt need assigned numbers

* exhaustive cases for switch/case no default

* [Price Impact] Fix broken warnings on adjusted market (#1557)

* commented/cleaned up utils

* Impact: use absolute pair & quote price

* fix warning in confirmation modal

* flip base for quote in low vol calc (#1559)
@W3stside W3stside merged commit 67f474f into release/v1.6.0 Nov 2, 2020
Velenir added a commit that referenced this pull request Nov 3, 2020
* Refactoring: moving OrdeBookWidget component to its own folder

* Refactoring: splitting component into smaller files

* Refactoring: commenting useEffectHooks and ordering them

* Refactoring: renamed component from OrderBookWidget to OrderBookChart

* Adjusting y axis on one sided markets

* Leaving it up to amCharts to decide how to space the grids

* 1295/linear orderbook styling (#1299)

* remove dead CSS

* consistency changes

1. text: BT/QT (/)
2. Volume (BT) Y-axis
3. Price(BT/QT) X-axis

* styling

* make upper scrollbar opacity lower

* adapt chartFuntions

* adapt dataProcessing

* adapt zoomFunctions

* adapt OrderBookChart

* adapt OrderBookWidget

* move stories to components

* rename folder

* fix name

* lint fixes

* xDAI price estimate prod URL

* 1336/tooltip date orders (#1507)

* add dates to OrdersWidget in Trade

* expireDateLocal > expireDateFormatted

* 1.5.1

* updated README to add compatible networks and URLs to wiki (#1537)

* move toast to custom wrapped container (#1539)

1. encapsulates custom styles and moves out of global

* Modal (prev. modali) Storybook stories (#1508)

* export ModalOptions and ModalProps

* Modal stories

* use action and make modal smaller

* rename css variable to generic + variable defaults

* wrapped datetimepicker in global styles (#1542)

1. removed redundant global.ts styles

* [Smart Quote] COMPLETE (#1492)

* Add token priorities

* Add priority and new market types

* Add market util

* Add test for getMarket util

* Improve tests

* Add change in implementation (forgot to commit)

* Load priority for tokens

* User automatic market selection

* Add token priorities and smart quote selection util (#1474)

* Add token priorities

* Add priority and new market types

* Add market util

* Add test for getMarket util

* Improve tests

* Add change in implementation (forgot to commit)

* Smart quote load priority (#1478)

* Add token priorities

* Add priority and new market types

* Add market util

* Add test for getMarket util

* Improve tests

* Add change in implementation (forgot to commit)

* Load priority for tokens

* Memoize and add debug

* Calculate the received tokens using the right price

* Fix typo

* Use cannonical market in tx confirmation

* Simplify prices in order row

* Refactor price calculation into smartPrice component

* Add title to smart price

* Remove title from swap token

* [Smart Quote]  User automatic market selection (#1479)

* Add token priorities

* Add priority and new market types

* Add market util

* Add test for getMarket util

* Improve tests

* Add change in implementation (forgot to commit)

* Load priority for tokens

* User automatic market selection

* Memoize and add debug

* Calculate the received tokens using the right price

* Fix typo

* Use cannonical market in tx confirmation

* Create new price fraction and memoize

* Smart quote market selection widget (#1531)

* Add token priorities

* Add priority and new market types

* Add market util

* Add test for getMarket util

* Improve tests

* Add change in implementation (forgot to commit)

* Load priority for tokens

* User automatic market selection

* Memoize and add debug

* Calculate the received tokens using the right price

* Fix typo

* Use cannonical market in tx confirmation

* Fix var name

* Use setter function for hook

* Show buy sell fills (#1530)

* Show side and price units

* Allow to invert price

* Memoize info

* Do not use anchor for market

* Remove unused var

* [Smart Quote]: Add useBestAsk hook to PriceSuggestionsWidget (#1533)

* useBestAsk hook

* PriceSuggestions: add useBestAsk hook

* [Smart Quote] TradesRow data rearrangement - swap Limit/Fill price and Sell/Bought column split (#1535)

* TradesWidget: move rows around

1. Date is moved right of Order ID
2. Sold/Bought split into 2 columns

* change labels and fix filter

* remove Pair title & css changes

* Trades split limit fill price (#1536)

* add/calc surplus to TradeRow

* make data fit

* surplus bold/green/text change

* fix style issue as table sizes grow

1. orders widget is larger to fit more data

* OrdersWidget: rearrange data presentation (#1541)

1. split total/filled

* remove wasPriorityAdjusted

Co-authored-by: David <david.sato64@gmail.com>

* Network check 2 (#1546)

* deal with incorrect network

* PR changes, thank you to the legend @Velenir

* rel noopener

Update src/hooks/useNetworkCheck.tsx

Co-authored-by: Velenir <Velenir@users.noreply.github.com>

* block toast click close or button

Co-authored-by: Velenir <Velenir@users.noreply.github.com>

* travis yml: sticky node v12 (#1556)

* wxDAI priority list (#1555)

* [Smart Quote] Fix broken **limitPrice** amount (#1554)

* PriceSuggestion: check adjusted market and use correct price

1. pass original token pair to price estimation logic
2. invert price when adjusted market detected

* tradewidget - pricesuggestion

1. pass original tokens as props
2. comment on props for ease

* add autoWidth prop to self adjust (#1560)

* Update orderbookSamples.ts (#1439)

* Update orderbookSamples.ts

Added some new examples, deleted old examples that didn't break the orderbook in the past.

* travis yml: sticky node v12

Co-authored-by: Velenir <Velenir@users.noreply.github.com>
Co-authored-by: David Sato <david.sato64@gmail.com>

* 1545 - Show percentage filled & fix incorrect market order in orders (#1562)

* calculate filled amount percentage

1. change surplus min to 0.01%

* show proper market in orderrow

* logic cleanup for TS

* memo getMarket

* fix filled percentage css

* connect wallet width auto

* [Price Impact]: Base (#1509)

* remove amount shown in Fill Price

* create PriceImpact component

* PriceSuggestionsWidget/Child

1. remove Best Ask comp + calc
2. export Wrapper
3. remove dead props

* add priceimpact to tradewidget

* THRESHOLD constant values

* const: doesnt need threshold vals

1. move to priceimpact

* memoise colourClass and use BigNumber thresholds

* fix stories/build

* format price impact

* fixed tooltip style

* edited calculation, changed smart format limit, dont show on ZERO

* change of red colour

* [Price Impact] Warnings in PriceSuggestions (#1544)

* small util for checking truthiness

* move PriceImpact into PriceSuggestionsWidget

* move unrelated files into more related FS

* rename isTruthy util fn and use in PriceSUggestions

* styling

1.added button-warning red
2. label no background
3. added midImpact class

* utils: decouple some of the impact level determining logic

1. add midPrice and high price impact thres
2. warning logic fix

* saving warning label change

* address PR comments

1. use standard FormMessage
2. dont show warning on using suggested price
3. change tooltip text

* put in useBestAsk hook

* added placeholder slippage of 0.5%

1. protects against Deep Market warning showing too frequently
2. added some comments for clarity

* addressed PR comments:

1. remove TODO useBestAsk comment
2. simplify priceImpactSmart logic thanks @anxolin
3. use switch cases
4. fix formatSmart broken small amount
5. use enum in priceimpact/utils
6. isStrNumTruthy > isNonZeroNumber rename

* [Price Impact] Confirmation Modal Warnings (#1550)

* add priceimpact to tradewidget

* [Price Impact] Warnings in PriceSuggestions (#1544)

* small util for checking truthiness

* move PriceImpact into PriceSuggestionsWidget

* move unrelated files into more related FS

* rename isTruthy util fn and use in PriceSUggestions

* styling

1.added button-warning red
2. label no background
3. added midImpact class

* utils: decouple some of the impact level determining logic

1. add midPrice and high price impact thres
2. warning logic fix

* saving warning label change

* address PR comments

1. use standard FormMessage
2. dont show warning on using suggested price
3. change tooltip text

* put in useBestAsk hook

* added placeholder slippage of 0.5%

1. protects against Deep Market warning showing too frequently
2. added some comments for clarity

* addressed PR comments:

1. remove TODO useBestAsk comment
2. simplify priceImpactSmart logic thanks @anxolin
3. use switch cases
4. fix formatSmart broken small amount
5. use enum in priceimpact/utils
6. isStrNumTruthy > isNonZeroNumber rename

* move unrelated files into more related FS

* saving warning label change

* moved logic to usePriceImpact hook

* move types to type subfolder

* add usePRiceImpact hook

* added price impact warnings to TxMessage

* errors as constants

* changed warning message type to object

* removed error title

* usePriceImpact compact logic

* utils:

1. made warnings into constants
2. reworked some of the warning label logic

* PriceImpact %: show 0 when 0 or negative

* remove logDebug

* add PriceImpact into conf modal

* small change

1. extrapolate SimplePriceImpact to reuse
2. new type
3. warnings all have icon

* use fontawesome over system font

* enum doesnt need assigned numbers

* exhaustive cases for switch/case no default

* [Price Impact] Fix broken warnings on adjusted market (#1557)

* commented/cleaned up utils

* Impact: use absolute pair & quote price

* fix warning in confirmation modal

* flip base for quote in low vol calc (#1559)

* Tx approval timeout (#1547)

Tx approval timeout

* Fix TS issue

Co-authored-by: Leandro Boscariol <leandro.boscariol@gnosis.io>
Co-authored-by: David <david.sato64@gmail.com>
Co-authored-by: Anxo Rodriguez <anxolin@gmail.com>
Co-authored-by: Rafanator <rafael.suarez333@gmail.com>
anxolin added a commit that referenced this pull request Jan 11, 2021
* Refactoring: moving OrdeBookWidget component to its own folder

* Refactoring: splitting component into smaller files

* Refactoring: commenting useEffectHooks and ordering them

* Refactoring: renamed component from OrderBookWidget to OrderBookChart

* Adjusting y axis on one sided markets

* Leaving it up to amCharts to decide how to space the grids

* 1295/linear orderbook styling (#1299)

* remove dead CSS

* consistency changes

1. text: BT/QT (/)
2. Volume (BT) Y-axis
3. Price(BT/QT) X-axis

* styling

* make upper scrollbar opacity lower

* adapt chartFuntions

* adapt dataProcessing

* adapt zoomFunctions

* adapt OrderBookChart

* adapt OrderBookWidget

* move stories to components

* rename folder

* fix name

* lint fixes

* xDAI price estimate prod URL

* 1336/tooltip date orders (#1507)

* add dates to OrdersWidget in Trade

* expireDateLocal > expireDateFormatted

* 1.5.1

* updated README to add compatible networks and URLs to wiki (#1537)

* move toast to custom wrapped container (#1539)

1. encapsulates custom styles and moves out of global

* Modal (prev. modali) Storybook stories (#1508)

* export ModalOptions and ModalProps

* Modal stories

* use action and make modal smaller

* rename css variable to generic + variable defaults

* wrapped datetimepicker in global styles (#1542)

1. removed redundant global.ts styles

* [Smart Quote] COMPLETE (#1492)

* Add token priorities

* Add priority and new market types

* Add market util

* Add test for getMarket util

* Improve tests

* Add change in implementation (forgot to commit)

* Load priority for tokens

* User automatic market selection

* Add token priorities and smart quote selection util (#1474)

* Add token priorities

* Add priority and new market types

* Add market util

* Add test for getMarket util

* Improve tests

* Add change in implementation (forgot to commit)

* Smart quote load priority (#1478)

* Add token priorities

* Add priority and new market types

* Add market util

* Add test for getMarket util

* Improve tests

* Add change in implementation (forgot to commit)

* Load priority for tokens

* Memoize and add debug

* Calculate the received tokens using the right price

* Fix typo

* Use cannonical market in tx confirmation

* Simplify prices in order row

* Refactor price calculation into smartPrice component

* Add title to smart price

* Remove title from swap token

* [Smart Quote]  User automatic market selection (#1479)

* Add token priorities

* Add priority and new market types

* Add market util

* Add test for getMarket util

* Improve tests

* Add change in implementation (forgot to commit)

* Load priority for tokens

* User automatic market selection

* Memoize and add debug

* Calculate the received tokens using the right price

* Fix typo

* Use cannonical market in tx confirmation

* Create new price fraction and memoize

* Smart quote market selection widget (#1531)

* Add token priorities

* Add priority and new market types

* Add market util

* Add test for getMarket util

* Improve tests

* Add change in implementation (forgot to commit)

* Load priority for tokens

* User automatic market selection

* Memoize and add debug

* Calculate the received tokens using the right price

* Fix typo

* Use cannonical market in tx confirmation

* Fix var name

* Use setter function for hook

* Show buy sell fills (#1530)

* Show side and price units

* Allow to invert price

* Memoize info

* Do not use anchor for market

* Remove unused var

* [Smart Quote]: Add useBestAsk hook to PriceSuggestionsWidget (#1533)

* useBestAsk hook

* PriceSuggestions: add useBestAsk hook

* [Smart Quote] TradesRow data rearrangement - swap Limit/Fill price and Sell/Bought column split (#1535)

* TradesWidget: move rows around

1. Date is moved right of Order ID
2. Sold/Bought split into 2 columns

* change labels and fix filter

* remove Pair title & css changes

* Trades split limit fill price (#1536)

* add/calc surplus to TradeRow

* make data fit

* surplus bold/green/text change

* fix style issue as table sizes grow

1. orders widget is larger to fit more data

* OrdersWidget: rearrange data presentation (#1541)

1. split total/filled

* remove wasPriorityAdjusted

Co-authored-by: David <david.sato64@gmail.com>

* Network check 2 (#1546)

* deal with incorrect network

* PR changes, thank you to the legend @Velenir

* rel noopener

Update src/hooks/useNetworkCheck.tsx

Co-authored-by: Velenir <Velenir@users.noreply.github.com>

* block toast click close or button

Co-authored-by: Velenir <Velenir@users.noreply.github.com>

* travis yml: sticky node v12 (#1556)

* wxDAI priority list (#1555)

* [Smart Quote] Fix broken **limitPrice** amount (#1554)

* PriceSuggestion: check adjusted market and use correct price

1. pass original token pair to price estimation logic
2. invert price when adjusted market detected

* tradewidget - pricesuggestion

1. pass original tokens as props
2. comment on props for ease

* add autoWidth prop to self adjust (#1560)

* Update orderbookSamples.ts (#1439)

* Update orderbookSamples.ts

Added some new examples, deleted old examples that didn't break the orderbook in the past.

* travis yml: sticky node v12

Co-authored-by: Velenir <Velenir@users.noreply.github.com>
Co-authored-by: David Sato <david.sato64@gmail.com>

* 1545 - Show percentage filled & fix incorrect market order in orders (#1562)

* calculate filled amount percentage

1. change surplus min to 0.01%

* show proper market in orderrow

* logic cleanup for TS

* memo getMarket

* fix filled percentage css

* connect wallet width auto

* [Price Impact]: Base (#1509)

* remove amount shown in Fill Price

* create PriceImpact component

* PriceSuggestionsWidget/Child

1. remove Best Ask comp + calc
2. export Wrapper
3. remove dead props

* add priceimpact to tradewidget

* THRESHOLD constant values

* const: doesnt need threshold vals

1. move to priceimpact

* memoise colourClass and use BigNumber thresholds

* fix stories/build

* format price impact

* fixed tooltip style

* edited calculation, changed smart format limit, dont show on ZERO

* change of red colour

* [Price Impact] Warnings in PriceSuggestions (#1544)

* small util for checking truthiness

* move PriceImpact into PriceSuggestionsWidget

* move unrelated files into more related FS

* rename isTruthy util fn and use in PriceSUggestions

* styling

1.added button-warning red
2. label no background
3. added midImpact class

* utils: decouple some of the impact level determining logic

1. add midPrice and high price impact thres
2. warning logic fix

* saving warning label change

* address PR comments

1. use standard FormMessage
2. dont show warning on using suggested price
3. change tooltip text

* put in useBestAsk hook

* added placeholder slippage of 0.5%

1. protects against Deep Market warning showing too frequently
2. added some comments for clarity

* addressed PR comments:

1. remove TODO useBestAsk comment
2. simplify priceImpactSmart logic thanks @anxolin
3. use switch cases
4. fix formatSmart broken small amount
5. use enum in priceimpact/utils
6. isStrNumTruthy > isNonZeroNumber rename

* [Price Impact] Confirmation Modal Warnings (#1550)

* add priceimpact to tradewidget

* [Price Impact] Warnings in PriceSuggestions (#1544)

* small util for checking truthiness

* move PriceImpact into PriceSuggestionsWidget

* move unrelated files into more related FS

* rename isTruthy util fn and use in PriceSUggestions

* styling

1.added button-warning red
2. label no background
3. added midImpact class

* utils: decouple some of the impact level determining logic

1. add midPrice and high price impact thres
2. warning logic fix

* saving warning label change

* address PR comments

1. use standard FormMessage
2. dont show warning on using suggested price
3. change tooltip text

* put in useBestAsk hook

* added placeholder slippage of 0.5%

1. protects against Deep Market warning showing too frequently
2. added some comments for clarity

* addressed PR comments:

1. remove TODO useBestAsk comment
2. simplify priceImpactSmart logic thanks @anxolin
3. use switch cases
4. fix formatSmart broken small amount
5. use enum in priceimpact/utils
6. isStrNumTruthy > isNonZeroNumber rename

* move unrelated files into more related FS

* saving warning label change

* moved logic to usePriceImpact hook

* move types to type subfolder

* add usePRiceImpact hook

* added price impact warnings to TxMessage

* errors as constants

* changed warning message type to object

* removed error title

* usePriceImpact compact logic

* utils:

1. made warnings into constants
2. reworked some of the warning label logic

* PriceImpact %: show 0 when 0 or negative

* remove logDebug

* add PriceImpact into conf modal

* small change

1. extrapolate SimplePriceImpact to reuse
2. new type
3. warnings all have icon

* use fontawesome over system font

* enum doesnt need assigned numbers

* exhaustive cases for switch/case no default

* [Price Impact] Fix broken warnings on adjusted market (#1557)

* commented/cleaned up utils

* Impact: use absolute pair & quote price

* fix warning in confirmation modal

* flip base for quote in low vol calc (#1559)

* Tx approval timeout (#1547)

Tx approval timeout

* Fix TS issue

Co-authored-by: Leandro Boscariol <leandro.boscariol@gnosis.io>
Co-authored-by: David <david.sato64@gmail.com>
Co-authored-by: Anxo Rodriguez <anxolin@gmail.com>
Co-authored-by: Rafanator <rafael.suarez333@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants