Commit Graph

62 Commits

Author SHA1 Message Date
Moody Salem
eeef306bdd
fix(🧦): 🧦 2020-07-10 12:42:24 -04:00
Moody Salem
63a491d4b1
improvement(approval): show approval state approved if allowance exceeds amount to approve, even when pending 2020-07-09 13:34:29 -04:00
Moody Salem
0fa238af0b
fix(swap): swap to account if recipient is null (#940)
* fix(swap): swap to account if recipient is null

* fix naming and strict ts error
2020-07-09 09:55:20 -04:00
Moody Salem
21c1484c0e
feat(send page): remove send page, implement recipient feature in swap page (#934)
* quick poc for removing swap page

* accidental import

* error for recipient field

* query parameter working

* undo id change

* tweaks to match mocks better

* tweaks to match mocks better

* some extra integration tests

* clean up nav tabs a bit

* clean up nav tabs a bit

* space swap/pool better

* stop selecting button text when double clicking

* remove unused transfer modal header

* add info to swap confirm modal

* shorten address

* improve summary message, remove unused send callback, fix react ga event

* fix lint errors

* arrow color
2020-07-08 23:06:29 -04:00
Moody Salem
f5229ca838
linter error 2020-07-06 21:31:08 -04:00
Moody Salem
875203f0ef
fix(responsiveness): small tweaks for mobile 2020-07-06 21:26:38 -04:00
Moody Salem
852e8f749f
fix(swap routing): max hops back to 3 2020-06-26 14:12:12 -04:00
Moody Salem
6694e5e398
improvement(swap routing): consider more bases in the swap (#909)
* consider more bases in the swap

* all match type

* max hops 2, only 1 result
2020-06-26 13:27:38 -04:00
Moody Salem
2c4f4092d8
improvement(advanced): always show advanced (#890)
* always show advanced

* fix test

* always show the price, less jitter

* show tokens in price field

* fix the dropdown sticking around when switching between swap/send

* lint

* fix ios scrolling the modal body into the viewport bug

* don't use react-spring for simple slide animation

* safer price impact constants
2020-06-15 10:13:12 -04:00
Callil Capuozzo
fd162a72ff
feat(expert mode): Add expert mode (#828)
* Add expert mode scaffolding

* move advanced settings to settings tab, add expert mode

* update settings modal

* update font weight

* fix text

* update with modal
;

* add null checks

* update with input checking

* merge and add fixes

* update language and bg

Co-authored-by: ianlapham <ianlapham@gmail.com>
2020-06-12 15:26:28 -04:00
Moody Salem
7e49babff7
improvement(token search): No automatic add (#888)
* no automatic add, major refactors

* fix nit with version link

* add/remove links in the token search modal

* close tooltip when user types

* remove skip
2020-06-12 11:15:18 -04:00
Moody Salem
bafd3f3c05
feat(v1-support): Enable executing swaps on v1 or v2 (#883)
* swap-v1

* toggle the version switch based on the search query parameter

* rework some of the query parameter stuff in send/swap

* hide the url when they click it

* allow switching back to v2 via the toggle

* represent the v1 trade in the UI if they toggle it on

* show trade link in both directions (5% threshold for v1 link)

* input amounts should reflect v1/v2

* perform the approve on v1 exchange for v1 trades

* get swap on v1 working

* move some code around to reduce duplication

* fix ts error

* correct input allowance

* fix exact token to token on v1

* fix pending approvals to be specific to the spender

* google analytics for swap version

* disable the version switch on pages other than swap and send
2020-06-11 15:56:28 -04:00
Moody Salem
9869a9fcb7
fix(swap): if swap fails in FoT router but not in regular router, throw an error (#875)
this is an alternative solution to hard coding forced FoT router tokens
2020-06-08 10:06:37 -04:00
Moody Salem
97deebad37
temporary workaround for tokens that have transfer methods that succeed but do not transfer tokens 2020-06-06 08:41:31 -04:00
Noah Zinsmeister
e667615449
support proposed new FoT-capable methods (#866)
* support new FoT-capable methods

short-circuit modal footer rendering if no trade

improve clarity of tx modal flow

* update router address + ABI
2020-06-05 18:40:02 -04:00
Moody Salem
104be830fc
perf(multicall): use single call to get token information (#855)
* use single call to get token information

* delete the bytes32 overload

* console log statement

* add a bunch of tests to actions.ts for multicall

* fix to work with bytes32 symbols/names

* only include name/symbol

* enforce lowercase calldata
2020-06-03 22:15:26 -04:00
Moody Salem
c1d35cc8b3
feat(migrate): adds the migrate flow to the uniswap exchange site
* links and page

* print all the details of the liquidity

* show working approve/migrate buttons

* testnet v1 factory addresses

* split code up into two pages

* getting closer to styled

* compute min amount out of eth and token

* compute min amount out of eth and token

* add a back button to the list page

* Improve empty states

* Improve the state management

* change the display of the migrate page to be more similar to original

* style fix, pending transaction hook fix

* add forwarding to netlify.toml

* handle case where v2 spot price does not exist because pair does not exist

* make ternaries more accurate

* handle first liquidity provider situation

* Style tweaks for migrate

* merge

* Address feedback
- show pool token amount
- show success when migration complete
- show price warning only if price difference is large

Co-authored-by: Callil Capuozzo <callil.capuozzo@gmail.com>
2020-06-03 14:07:01 -04:00
Noah Zinsmeister
6ffbf756f8
memoize common bases (#853)
* memoize common bases

* improve memoization
2020-06-02 15:43:10 -04:00
Noah Zinsmeister
2d6eddf9d4
introduce batched usePairs (#851)
centralize all lists of bases

pin some pairs
2020-06-01 16:55:31 -04:00
Moody Salem
9492e7375a
chore(multicall/migrate): move some v1 stuff around for migrate 2020-05-29 15:08:07 -04:00
Moody Salem
9c1fe53e4b
perf(ethereum): reduce number of calls by batching all polling node calls (#840)
* initial refactoring

* rebase lint error

* start implementing reducer

* multicall reducer

* working multicall!

* clean up performance, re-fix annoying error

* use multicall everywhere

* use multicall for balances

* fix lint warning

* Use checksummed address

* Fix strict warning

* get it to a working state with the more generic form

* convert useETHBalances

* Remove the eth-scan contract completely

* Remove the eth-scan contract completely more

* Default export

* Put the encoding/decoding in the methods that can do it most efficiently

* Avoid duplicate fetches via debounce

* Reduce delay to something less noticeable

* Return null if pair reserves are undefined to indicate it does not exist
2020-05-28 21:17:45 -04:00
Moody Salem
c9721c42bf
perf(reduce call volume): save a bunch of calls to infura when the tab is not focused, change infura IDs for v2 2020-05-26 13:36:09 -04:00
Moody Salem
7b9b332c42
fix(popover): ios safari not showing the popover 2020-05-25 01:39:50 -04:00
Moody Salem
ccab6f01cf
More tests for add/remove liquidity and fix the automatic loading of tokens in those pages 2020-05-20 23:11:49 -05:00
Moody Salem
04584cc4ac
Fix the add liquidity link from uniswap.info 2020-05-20 21:09:36 -05:00
Moody Salem
7d20dd976b
Fix a crash related to WETH being loaded from add liquidity 2020-05-20 20:51:25 -05:00
Moody Salem
1bb4db5414
Make the hooks directory strict (#817)
* Make the hooks directory strict

* Move using the v1 factory contract to hooks

* Add a comment to why we copy the token map

* Fix another lint error and make AllTokens deep readonly

* Move ALL_TOKENS to constants directory
2020-05-20 14:39:28 -05:00
Moody Salem
1e7072d5f2
Fix swap + send not going to recipient (#810) 2020-05-19 18:28:26 -05:00
Noah Zinsmeister
373b3180d3
manual approve fallback for remove liquidity (#806)
* generalize useApproveCallback

* show proper slippageAdjustedAmounts in dialog

* make confirmed button text readable in light mode

* default timeout from 15 -> 20 minutes

* add manual approve fallback to remove liquidity

* remove console log

* fix bad web3-react import introduced by refactor

* rename our wrapped version of useWeb3React

* return an enum from useApproveCallback

* fix comment
2020-05-19 15:08:58 -04:00
Moody Salem
3b2c21e26d
Fix issue where tokens did not disappear after removed 2020-05-18 22:46:06 -05:00
Moody Salem
0e72f1c5d3
Remove unnecessary memoization that causes a caching issue 2020-05-18 22:40:46 -05:00
Noah Zinsmeister
e311e2fcf9
mainnet (#782)
* mainnet config

* fix token + pair sorting

* standardize wrapped useWeb3React imports

* add final return to pair sorting

* add connecting pairs

* break tokens out into separate files

revert isAddress change

* filter out duplicate pairs

* remove add liquidity prompts

* link to v1 trades that are invalid on v2

* forward v2 subdomain to apex

* update blog link

* get rid of smart quotes

* link to uniswap info in position card

* improve pair sorting/searching

break out token identification

fix crash on early pool position clicks

change pair token separator from : to /
2020-05-18 13:20:42 -04:00
Moody Salem
095beae0c2
Refactor ExchangePage into Swap and Send pages (#774)
* Part 1, separate swap and send, move duplicate code into separate files

* Move some more constants out of the swap/send

* Support defaults from URL parameters

* Implement query string parsing via a redux action

* Finish merging the changes

* Fix the slippage warnings

* Clean up some other files

* More refactoring

* Move the price bar out of the component

* Move advanced details and some computations into utilities

* Make same improvements to send

* Approval hook

* Swap page functional with swap callback hook

* Swap/send page functional with swap callback hook

* Fix lint

* Move styleds.ts

* Fix integration test

* Fix error state in swap and move some things around

* Move send callback out of send page

* Make send behave more like current behavior

* Differentiate swap w/o send on send page from swap w/o send on swap page

* Remove userAdvanced which was always false

* Remove the price bar which is not used in the new UI

* Delete the file

* Fix null in the send dialog and move another component out of send

* Move the swap modal header out to another file

* Include change after merge

* Add recipient to swap message

* Keep input token selected if user has no balance and clicks send with swap

* Move the modal footer out of send component

* Remove the hard coded estimated time

* Fix the label/action for swap/sends

* Share the swap modal footer between swap and send

* Fix integration test

* remove margin from popper to suppress warnings

fix missing ENS name recipient link

default deadline to 15 minutes

* ensure useApproveCallback returns accurate data

* clean up callbacks

* extra space

* Re-apply ignored changes from v2 branch ExchangePage file

Co-authored-by: Noah Zinsmeister <noahwz@gmail.com>
2020-05-16 16:55:22 -05:00
Noah Zinsmeister
7bffea0692
update swr hooks when block number changes (#771)
* key per-block SWR data with block number

* fix + tweak copy and decrease sig figs for lp fee

* don't use blocknumber as a key

instead mutate when it changes

* fix totalsupply + user liquidity sync issues

* fix v1 trade checker logic

* rough fix allowing removal of user added tokens

probably needs a more comprehensive overhaul...

* refactor SWR block updates to custom hook

* typo

* fix import error

* fix footer css to work cross-broswer

* disallow \ to be typing into amount inputs

add test case for this

add value assertions to all input integration tests

* fix import error

* remove console.log

* clean up address input a bit

trim whitespace from pasted addresses

* fix input maxing

remove spurious max output logic
2020-05-14 17:12:59 -04:00
Moody Salem
b1ffab1890
Refactors (#772)
* Bunch of refactoring

* Add an integration test that gets as far as swapping

* Drop the nonce code that isn't doing anything right now

* Undo one of the accidental changes to the reducer
2020-05-14 15:56:40 -04:00
Moody Salem
0733cdd63c
Fix trade routing to not throw 2020-05-13 19:57:12 -04:00
Moody Salem
6da8e2c84d
Introduce redux for one of the state stores (#742)
* Introduce redux for one of the state stores

* Remove unused state

* Clean up hooks

* Add types for react-redux and fix error from any type on useSelector

* Strongly type the web3 provider

* Make the popup content into a POJO

* Lint errors

* Clean up method call

* Fix lint error

* Fix lint error

* Lint
2020-05-11 18:23:01 -04:00
Noah Zinsmeister
d40d81ca6a
noah changes (#739)
* remove duplicated prettier from dependencies

* use swr for allowances

* slight improvements to error cascading

* fetch totalsupply with SWR

fetch pairs with SWR (except persistent pairs, will be refactored later)

* fix lint error

* stop using pair context, instead store per-user pairs in local storage

* add more pairs to the default list

remove unnecessary isWETH

fix lint error

* add more bases to trade consideration

* fix lint warnings

* get SWR data on same schedule

* don't pass value if it's 0

fix WETH equality checks

* clean up fixed/significant formatting

* fix slippage calculation bug in swap

add slippage to remove

* fix token logos

* show fewer sig figs

* lint error

* remove unused signer

* add calculateSlippageAmount safety check and tests

* fix useAllBalances type

stop spuriously sorting token amounts of different tokens

use slightly better comparisons for slippage calculations

* improve priceSlippage comparison logic

* useReserves -> usePair

* use checksum for DAI logo address
2020-05-11 16:39:05 -04:00
Moody Salem
ee92df1554
Handle insufficient reserves/input errors without crashing 2020-05-09 12:41:21 -04:00
Moody Salem
843d5e790a
Done with linter errors! 2020-05-08 18:32:36 -04:00
Moody Salem
3b3f281319
Use eslint/prettier for typescript files 2020-05-08 14:50:27 -04:00
Moody Salem
17eceebcf5
Final typescript migration push 2020-05-08 14:15:47 -04:00
Moody Salem
2adb0a3dfb
Ts almost everywhere (#736)
* First 2

* More typescript

* More and more

* Almost there

* More

* More typescript

* Fix remove liquidity button

* Make the error chain more readable

* Slippage tabs
2020-05-08 13:48:05 -04:00
Moody Salem
a1a9d9f041
Type safety for styled components (#733) 2020-05-08 11:24:47 -04:00
Moody Salem
9b2fe0bdca
Use best trade to get the best route (#731) 2020-05-08 11:13:16 -04:00
Moody Salem
7fcecc22d9
TS migrations and commit hash in code link (#730)
* TypeScript in the utils directory, README fixes

* Remove unused methods

* Added unnecessary space

* Some env variable cleanup

* Bug in change

* Another file to ts

* App.tsx

* Header and Footer to tsx

* Few more TS migrations and add a commit hash title to the uni icon

* Few more TS migrations and put commit hash in code link

* Splitting up files

* Splitting up files (merged dark mode changes)
2020-05-07 18:52:26 -04:00
Noah Zinsmeister
64dd09f2cc
update to latest deploy (#712) 2020-05-05 16:36:22 -04:00
Ian Lapham
eaf8d5a39c
Add routes through ETH (#665)
* add fix for ETH balance fetching

* add tokens to other testnets

* update with Exchange -> Pair

* routes throuh ETH

* fix logs

* fix conflict
2020-03-26 12:42:06 -04:00
ianlapham
6211dff044 typed pages 2020-03-20 16:03:23 -04:00
ianlapham
e43d9e03f1 add popups to context 2020-03-11 10:44:39 -04:00