├── src ├── App.css ├── config │ ├── package.json │ ├── config.jsx │ ├── development.config.js │ └── production.config.js ├── stores │ ├── package.json │ └── connectors.jsx ├── theme │ ├── package.json │ └── theme.jsx ├── constants │ ├── package.json │ └── constants.jsx ├── components │ ├── footer │ │ ├── package.json │ │ └── footer.jsx │ ├── header │ │ ├── package.json │ │ └── header.jsx │ ├── home │ │ ├── package.json │ │ └── home.jsx │ ├── loader │ │ ├── package.json │ │ └── loader.jsx │ ├── pool │ │ ├── package.json │ │ ├── deposit │ │ │ ├── package.json │ │ │ └── deposit.jsx │ │ ├── exchange │ │ │ └── package.json │ │ ├── withdraw │ │ │ ├── package.json │ │ │ └── withdraw.jsx │ │ └── pool.jsx │ ├── unlock │ │ ├── package.json │ │ ├── unlockModal.jsx │ │ ├── hooks.jsx │ │ └── unlock.jsx │ ├── account │ │ ├── package.json │ │ └── account.jsx │ └── snackbar │ │ ├── package.json │ │ └── snackbar.jsx ├── assets │ ├── aave.png │ ├── bzx.png │ ├── ddex.jpg │ ├── ddex.png │ ├── dydx.jpg │ ├── ledger.png │ ├── lendf.png │ ├── torus.jpg │ ├── trezor.png │ ├── BAT-logo.png │ ├── BUSD-logo.png │ ├── COMP-logo.png │ ├── CRV-icon.png │ ├── CRV-logo.jpg │ ├── CRV-logo.png │ ├── DAI-logo.png │ ├── ENJ-logo.png │ ├── ETH-icon.png │ ├── ETH-logo.png │ ├── FTM-logo.png │ ├── KNC-logo.png │ ├── LEND-logo.png │ ├── LINK-logo.png │ ├── LRC-logo.png │ ├── MANA-logo.png │ ├── MKR-logo.png │ ├── REN-logo.png │ ├── REP-logo.png │ ├── SAI-logo.png │ ├── SNX-logo.png │ ├── SUSD-logo.png │ ├── TUSD-logo.png │ ├── USDC-icon.png │ ├── USDC-logo.png │ ├── USDT-icon.png │ ├── USDT-logo.png │ ├── ZRX-logo.png │ ├── aBAT-logo.png │ ├── aDAI-logo.png │ ├── aETH-logo.png │ ├── aKNC-logo.png │ ├── aMKR-logo.png │ ├── aREP-logo.png │ ├── aSNX-logo.png │ ├── aZRX-logo.png │ ├── compound.png │ ├── curvefi.jpg │ ├── defipulse.png │ ├── defizap.png │ ├── ethereum.png │ ├── etherscan.png │ ├── fUSD-logo.png │ ├── iDAI-logo.png │ ├── metamask.png │ ├── synthetix.png │ ├── truffle.png │ ├── uniswap.png │ ├── wBTC-icon.png │ ├── wBTC-logo.png │ ├── IEARN-icon.png │ ├── aBUSD-logo.png │ ├── aLEND-logo.png │ ├── aLINK-logo.png │ ├── aMANA-logo.png │ ├── aSUSD-logo.png │ ├── aTUSD-logo.png │ ├── aUSDC-logo.png │ ├── aUSDT-logo.png │ ├── aWBTC-logo.png │ ├── cUSDC-logo.png │ ├── cUSDT-logo.png │ ├── portisIcon.png │ ├── squarelink.png │ ├── trustWallet.png │ ├── ycUSDC-logo.png │ ├── ycUSDT-logo.png │ ├── fortmaticIcon.png │ ├── kybernetwork.png │ ├── fonts │ │ └── WorkSans-VariableFont_wght.ttf │ ├── icn-ledger.svg │ ├── defisnap.svg │ ├── icn-aethereum.svg │ ├── aave.svg │ ├── lendf.svg │ ├── uniswap.svg │ ├── metamask.svg │ ├── dydx.svg │ ├── icn-metamask.svg │ └── walletConnectIcon.svg ├── App.test.js ├── index.js ├── i18n.js ├── index.css ├── locales │ ├── ja │ │ └── translation.json │ ├── zh │ │ └── translation.json │ └── en │ │ └── translation.json ├── App.js └── serviceWorker.js ├── public ├── aave.png ├── busd.png ├── lendf.png ├── BAT-logo.png ├── DAI-logo.png ├── ETH-icon.png ├── FTM-logo.png ├── KNC-logo.png ├── MKR-logo.png ├── REP-logo.png ├── SAI-logo.png ├── SNX-logo.png ├── ZRX-logo.png ├── compound.png ├── defizap.png ├── favicon.ico ├── ledger.png ├── metamask.png ├── trezor.png ├── truffle.png ├── uniswap.png ├── LEND-logo.png ├── LINK-logo.png ├── MANA-logo.png ├── SUSD-logo.png ├── TUSD-logo.png ├── USDC-icon.png ├── USDC-logo.png ├── USDT-icon.png ├── USDT-logo.png ├── apple-icon.png ├── etherscan.png ├── portisIcon.png ├── squarelink.png ├── wBTC-icon.png ├── wBTC-logo.png ├── favicon-16x16.png ├── favicon-32x32.png ├── favicon-96x96.png ├── favicon.png.png ├── fortmaticIcon.png ├── kybernetwork.png ├── ms-icon-70x70.png ├── trustWallet.png ├── ms-icon-144x144.png ├── ms-icon-150x150.png ├── ms-icon-310x310.png ├── android-icon-36x36.png ├── android-icon-48x48.png ├── android-icon-72x72.png ├── android-icon-96x96.png ├── apple-icon-114x114.png ├── apple-icon-120x120.png ├── apple-icon-144x144.png ├── apple-icon-152x152.png ├── apple-icon-180x180.png ├── apple-icon-57x57.png ├── apple-icon-60x60.png ├── apple-icon-72x72.png ├── apple-icon-76x76.png ├── android-icon-144x144.png ├── android-icon-192x192.png ├── apple-icon-precomposed.png ├── browserconfig.xml ├── manifest.json └── index.html ├── .gitignore ├── LICENSE ├── package.json └── README.md /src/App.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/config/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "config.jsx" 3 | } 4 | -------------------------------------------------------------------------------- /src/stores/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "store.jsx" 3 | } 4 | -------------------------------------------------------------------------------- /src/theme/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "theme.jsx" 3 | } 4 | -------------------------------------------------------------------------------- /src/constants/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "constants.jsx" 3 | } 4 | -------------------------------------------------------------------------------- /src/components/footer/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "footer.jsx" 3 | } 4 | -------------------------------------------------------------------------------- /src/components/header/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "header.jsx" 3 | } 4 | -------------------------------------------------------------------------------- /src/components/home/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "home.jsx" 3 | } 4 | -------------------------------------------------------------------------------- /src/components/loader/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "loader.jsx" 3 | } 4 | -------------------------------------------------------------------------------- /src/components/pool/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "pool.jsx" 3 | } 4 | -------------------------------------------------------------------------------- /src/components/unlock/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "unlock.jsx" 3 | } 4 | -------------------------------------------------------------------------------- /src/components/account/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "account.jsx" 3 | } 4 | -------------------------------------------------------------------------------- /src/components/snackbar/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "snackbar.jsx" 3 | } 4 | -------------------------------------------------------------------------------- /src/components/pool/deposit/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "deposit.jsx" 3 | } 4 | -------------------------------------------------------------------------------- /src/components/pool/exchange/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "exchange.jsx" 3 | } 4 | -------------------------------------------------------------------------------- /src/components/pool/withdraw/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "withdraw.jsx" 3 | } 4 | -------------------------------------------------------------------------------- /public/aave.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/aave.png -------------------------------------------------------------------------------- /public/busd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/busd.png -------------------------------------------------------------------------------- /public/lendf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/lendf.png -------------------------------------------------------------------------------- /public/BAT-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/BAT-logo.png -------------------------------------------------------------------------------- /public/DAI-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/DAI-logo.png -------------------------------------------------------------------------------- /public/ETH-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/ETH-icon.png -------------------------------------------------------------------------------- /public/FTM-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/FTM-logo.png -------------------------------------------------------------------------------- /public/KNC-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/KNC-logo.png -------------------------------------------------------------------------------- /public/MKR-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/MKR-logo.png -------------------------------------------------------------------------------- /public/REP-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/REP-logo.png -------------------------------------------------------------------------------- /public/SAI-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/SAI-logo.png -------------------------------------------------------------------------------- /public/SNX-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/SNX-logo.png -------------------------------------------------------------------------------- /public/ZRX-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/ZRX-logo.png -------------------------------------------------------------------------------- /public/compound.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/compound.png -------------------------------------------------------------------------------- /public/defizap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/defizap.png -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /public/ledger.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/ledger.png -------------------------------------------------------------------------------- /public/metamask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/metamask.png -------------------------------------------------------------------------------- /public/trezor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/trezor.png -------------------------------------------------------------------------------- /public/truffle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/truffle.png -------------------------------------------------------------------------------- /public/uniswap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/uniswap.png -------------------------------------------------------------------------------- /src/assets/aave.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/aave.png -------------------------------------------------------------------------------- /src/assets/bzx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/bzx.png -------------------------------------------------------------------------------- /src/assets/ddex.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/ddex.jpg -------------------------------------------------------------------------------- /src/assets/ddex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/ddex.png -------------------------------------------------------------------------------- /src/assets/dydx.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/dydx.jpg -------------------------------------------------------------------------------- /public/LEND-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/LEND-logo.png -------------------------------------------------------------------------------- /public/LINK-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/LINK-logo.png -------------------------------------------------------------------------------- /public/MANA-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/MANA-logo.png -------------------------------------------------------------------------------- /public/SUSD-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/SUSD-logo.png -------------------------------------------------------------------------------- /public/TUSD-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/TUSD-logo.png -------------------------------------------------------------------------------- /public/USDC-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/USDC-icon.png -------------------------------------------------------------------------------- /public/USDC-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/USDC-logo.png -------------------------------------------------------------------------------- /public/USDT-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/USDT-icon.png -------------------------------------------------------------------------------- /public/USDT-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/USDT-logo.png -------------------------------------------------------------------------------- /public/apple-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/apple-icon.png -------------------------------------------------------------------------------- /public/etherscan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/etherscan.png -------------------------------------------------------------------------------- /public/portisIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/portisIcon.png -------------------------------------------------------------------------------- /public/squarelink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/squarelink.png -------------------------------------------------------------------------------- /public/wBTC-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/wBTC-icon.png -------------------------------------------------------------------------------- /public/wBTC-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/wBTC-logo.png -------------------------------------------------------------------------------- /src/assets/ledger.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/ledger.png -------------------------------------------------------------------------------- /src/assets/lendf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/lendf.png -------------------------------------------------------------------------------- /src/assets/torus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/torus.jpg -------------------------------------------------------------------------------- /src/assets/trezor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/trezor.png -------------------------------------------------------------------------------- /public/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/favicon-16x16.png -------------------------------------------------------------------------------- /public/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/favicon-32x32.png -------------------------------------------------------------------------------- /public/favicon-96x96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/favicon-96x96.png -------------------------------------------------------------------------------- /public/favicon.png.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/favicon.png.png -------------------------------------------------------------------------------- /public/fortmaticIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/fortmaticIcon.png -------------------------------------------------------------------------------- /public/kybernetwork.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/kybernetwork.png -------------------------------------------------------------------------------- /public/ms-icon-70x70.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/ms-icon-70x70.png -------------------------------------------------------------------------------- /public/trustWallet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/trustWallet.png -------------------------------------------------------------------------------- /src/assets/BAT-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/BAT-logo.png -------------------------------------------------------------------------------- /src/assets/BUSD-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/BUSD-logo.png -------------------------------------------------------------------------------- /src/assets/COMP-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/COMP-logo.png -------------------------------------------------------------------------------- /src/assets/CRV-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/CRV-icon.png -------------------------------------------------------------------------------- /src/assets/CRV-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/CRV-logo.jpg -------------------------------------------------------------------------------- /src/assets/CRV-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/CRV-logo.png -------------------------------------------------------------------------------- /src/assets/DAI-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/DAI-logo.png -------------------------------------------------------------------------------- /src/assets/ENJ-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/ENJ-logo.png -------------------------------------------------------------------------------- /src/assets/ETH-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/ETH-icon.png -------------------------------------------------------------------------------- /src/assets/ETH-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/ETH-logo.png -------------------------------------------------------------------------------- /src/assets/FTM-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/FTM-logo.png -------------------------------------------------------------------------------- /src/assets/KNC-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/KNC-logo.png -------------------------------------------------------------------------------- /src/assets/LEND-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/LEND-logo.png -------------------------------------------------------------------------------- /src/assets/LINK-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/LINK-logo.png -------------------------------------------------------------------------------- /src/assets/LRC-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/LRC-logo.png -------------------------------------------------------------------------------- /src/assets/MANA-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/MANA-logo.png -------------------------------------------------------------------------------- /src/assets/MKR-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/MKR-logo.png -------------------------------------------------------------------------------- /src/assets/REN-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/REN-logo.png -------------------------------------------------------------------------------- /src/assets/REP-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/REP-logo.png -------------------------------------------------------------------------------- /src/assets/SAI-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/SAI-logo.png -------------------------------------------------------------------------------- /src/assets/SNX-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/SNX-logo.png -------------------------------------------------------------------------------- /src/assets/SUSD-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/SUSD-logo.png -------------------------------------------------------------------------------- /src/assets/TUSD-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/TUSD-logo.png -------------------------------------------------------------------------------- /src/assets/USDC-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/USDC-icon.png -------------------------------------------------------------------------------- /src/assets/USDC-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/USDC-logo.png -------------------------------------------------------------------------------- /src/assets/USDT-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/USDT-icon.png -------------------------------------------------------------------------------- /src/assets/USDT-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/USDT-logo.png -------------------------------------------------------------------------------- /src/assets/ZRX-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/ZRX-logo.png -------------------------------------------------------------------------------- /src/assets/aBAT-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/aBAT-logo.png -------------------------------------------------------------------------------- /src/assets/aDAI-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/aDAI-logo.png -------------------------------------------------------------------------------- /src/assets/aETH-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/aETH-logo.png -------------------------------------------------------------------------------- /src/assets/aKNC-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/aKNC-logo.png -------------------------------------------------------------------------------- /src/assets/aMKR-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/aMKR-logo.png -------------------------------------------------------------------------------- /src/assets/aREP-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/aREP-logo.png -------------------------------------------------------------------------------- /src/assets/aSNX-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/aSNX-logo.png -------------------------------------------------------------------------------- /src/assets/aZRX-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/aZRX-logo.png -------------------------------------------------------------------------------- /src/assets/compound.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/compound.png -------------------------------------------------------------------------------- /src/assets/curvefi.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/curvefi.jpg -------------------------------------------------------------------------------- /src/assets/defipulse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/defipulse.png -------------------------------------------------------------------------------- /src/assets/defizap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/defizap.png -------------------------------------------------------------------------------- /src/assets/ethereum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/ethereum.png -------------------------------------------------------------------------------- /src/assets/etherscan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/etherscan.png -------------------------------------------------------------------------------- /src/assets/fUSD-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/fUSD-logo.png -------------------------------------------------------------------------------- /src/assets/iDAI-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/iDAI-logo.png -------------------------------------------------------------------------------- /src/assets/metamask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/metamask.png -------------------------------------------------------------------------------- /src/assets/synthetix.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/synthetix.png -------------------------------------------------------------------------------- /src/assets/truffle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/truffle.png -------------------------------------------------------------------------------- /src/assets/uniswap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/uniswap.png -------------------------------------------------------------------------------- /src/assets/wBTC-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/wBTC-icon.png -------------------------------------------------------------------------------- /src/assets/wBTC-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/wBTC-logo.png -------------------------------------------------------------------------------- /public/ms-icon-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/ms-icon-144x144.png -------------------------------------------------------------------------------- /public/ms-icon-150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/ms-icon-150x150.png -------------------------------------------------------------------------------- /public/ms-icon-310x310.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/ms-icon-310x310.png -------------------------------------------------------------------------------- /src/assets/IEARN-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/IEARN-icon.png -------------------------------------------------------------------------------- /src/assets/aBUSD-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/aBUSD-logo.png -------------------------------------------------------------------------------- /src/assets/aLEND-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/aLEND-logo.png -------------------------------------------------------------------------------- /src/assets/aLINK-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/aLINK-logo.png -------------------------------------------------------------------------------- /src/assets/aMANA-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/aMANA-logo.png -------------------------------------------------------------------------------- /src/assets/aSUSD-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/aSUSD-logo.png -------------------------------------------------------------------------------- /src/assets/aTUSD-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/aTUSD-logo.png -------------------------------------------------------------------------------- /src/assets/aUSDC-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/aUSDC-logo.png -------------------------------------------------------------------------------- /src/assets/aUSDT-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/aUSDT-logo.png -------------------------------------------------------------------------------- /src/assets/aWBTC-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/aWBTC-logo.png -------------------------------------------------------------------------------- /src/assets/cUSDC-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/cUSDC-logo.png -------------------------------------------------------------------------------- /src/assets/cUSDT-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/cUSDT-logo.png -------------------------------------------------------------------------------- /src/assets/portisIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/portisIcon.png -------------------------------------------------------------------------------- /src/assets/squarelink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/squarelink.png -------------------------------------------------------------------------------- /src/assets/trustWallet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/trustWallet.png -------------------------------------------------------------------------------- /src/assets/ycUSDC-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/ycUSDC-logo.png -------------------------------------------------------------------------------- /src/assets/ycUSDT-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/ycUSDT-logo.png -------------------------------------------------------------------------------- /public/android-icon-36x36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/android-icon-36x36.png -------------------------------------------------------------------------------- /public/android-icon-48x48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/android-icon-48x48.png -------------------------------------------------------------------------------- /public/android-icon-72x72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/android-icon-72x72.png -------------------------------------------------------------------------------- /public/android-icon-96x96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/android-icon-96x96.png -------------------------------------------------------------------------------- /public/apple-icon-114x114.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/apple-icon-114x114.png -------------------------------------------------------------------------------- /public/apple-icon-120x120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/apple-icon-120x120.png -------------------------------------------------------------------------------- /public/apple-icon-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/apple-icon-144x144.png -------------------------------------------------------------------------------- /public/apple-icon-152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/apple-icon-152x152.png -------------------------------------------------------------------------------- /public/apple-icon-180x180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/apple-icon-180x180.png -------------------------------------------------------------------------------- /public/apple-icon-57x57.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/apple-icon-57x57.png -------------------------------------------------------------------------------- /public/apple-icon-60x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/apple-icon-60x60.png -------------------------------------------------------------------------------- /public/apple-icon-72x72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/apple-icon-72x72.png -------------------------------------------------------------------------------- /public/apple-icon-76x76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/apple-icon-76x76.png -------------------------------------------------------------------------------- /src/assets/fortmaticIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/fortmaticIcon.png -------------------------------------------------------------------------------- /src/assets/kybernetwork.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/kybernetwork.png -------------------------------------------------------------------------------- /public/android-icon-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/android-icon-144x144.png -------------------------------------------------------------------------------- /public/android-icon-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/android-icon-192x192.png -------------------------------------------------------------------------------- /public/apple-icon-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/public/apple-icon-precomposed.png -------------------------------------------------------------------------------- /src/assets/fonts/WorkSans-VariableFont_wght.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yearn/yswap-finance/HEAD/src/assets/fonts/WorkSans-VariableFont_wght.ttf -------------------------------------------------------------------------------- /public/browserconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | #ffffff -------------------------------------------------------------------------------- /src/App.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import App from './App'; 4 | 5 | it('renders without crashing', () => { 6 | const div = document.createElement('div'); 7 | ReactDOM.render(, div); 8 | ReactDOM.unmountComponentAtNode(div); 9 | }); 10 | -------------------------------------------------------------------------------- /src/config/config.jsx: -------------------------------------------------------------------------------- 1 | import development from "./development.config"; 2 | import production from "./production.config"; 3 | import example from "./example.config"; 4 | const env = process.env.APP_ENV || 'example'; 5 | 6 | const config = { 7 | example, 8 | development, 9 | production 10 | }; 11 | 12 | export default config[env]; 13 | -------------------------------------------------------------------------------- /src/components/loader/loader.jsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react' 2 | import { LinearProgress } from '@material-ui/core' 3 | 4 | class Loader extends Component { 5 | render() { 6 | return ( 7 |
8 | 9 |
10 | ) 11 | } 12 | } 13 | 14 | export default Loader 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './index.css'; 4 | import App from './App'; 5 | import * as serviceWorker from './serviceWorker'; 6 | 7 | ReactDOM.render(, document.getElementById('root')); 8 | 9 | // If you want your app to work offline and load faster, you can change 10 | // unregister() to register() below. Note this comes with some pitfalls. 11 | // Learn more about service workers: https://bit.ly/CRA-PWA 12 | serviceWorker.unregister(); 13 | -------------------------------------------------------------------------------- /src/assets/icn-ledger.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/components/unlock/unlockModal.jsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from "react"; 2 | import { 3 | DialogContent, 4 | Dialog, 5 | Slide 6 | } from '@material-ui/core'; 7 | 8 | import Unlock from './unlock.jsx'; 9 | 10 | function Transition(props) { 11 | return ; 12 | } 13 | 14 | class UnlockModal extends Component { 15 | render() { 16 | const { closeModal, modalOpen } = this.props; 17 | 18 | const fullScreen = window.innerWidth < 450; 19 | 20 | return ( 21 | 22 | 23 | 24 | 25 | 26 | ) 27 | }; 28 | } 29 | 30 | export default UnlockModal; 31 | -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "App", 3 | "icons": [ 4 | { 5 | "src": "\/android-icon-36x36.png", 6 | "sizes": "36x36", 7 | "type": "image\/png", 8 | "density": "0.75" 9 | }, 10 | { 11 | "src": "\/android-icon-48x48.png", 12 | "sizes": "48x48", 13 | "type": "image\/png", 14 | "density": "1.0" 15 | }, 16 | { 17 | "src": "\/android-icon-72x72.png", 18 | "sizes": "72x72", 19 | "type": "image\/png", 20 | "density": "1.5" 21 | }, 22 | { 23 | "src": "\/android-icon-96x96.png", 24 | "sizes": "96x96", 25 | "type": "image\/png", 26 | "density": "2.0" 27 | }, 28 | { 29 | "src": "\/android-icon-144x144.png", 30 | "sizes": "144x144", 31 | "type": "image\/png", 32 | "density": "3.0" 33 | }, 34 | { 35 | "src": "\/android-icon-192x192.png", 36 | "sizes": "192x192", 37 | "type": "image\/png", 38 | "density": "4.0" 39 | } 40 | ] 41 | } -------------------------------------------------------------------------------- /src/i18n.js: -------------------------------------------------------------------------------- 1 | import i18n from "i18next"; 2 | import detector from "i18next-browser-languagedetector"; 3 | import { reactI18nextModule } from "react-i18next"; 4 | 5 | import translationEN from './locales/en/translation.json'; 6 | import translationZH from './locales/zh/translation.json'; 7 | import translationJA from './locales/ja/translation.json'; 8 | 9 | // the translations 10 | const resources = { 11 | en: { 12 | translation: translationEN 13 | }, 14 | zh: { 15 | translation: translationZH 16 | }, 17 | ja: { 18 | translation: translationJA 19 | } 20 | }; 21 | 22 | i18n 23 | .use(detector) 24 | .use(reactI18nextModule) // passes i18n down to react-i18next 25 | .init({ 26 | resources, 27 | lng: "en", 28 | fallbackLng: "en", 29 | 30 | keySeparator: false, // we do not use keys in form messages.welcome 31 | 32 | interpolation: { 33 | escapeValue: false // react already safes from xss 34 | } 35 | }); 36 | 37 | export default i18n; 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 iearn 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/constants/constants.jsx: -------------------------------------------------------------------------------- 1 | export const CONNECTION_CONNECTED = 'CONNECTION_CONNECTED' 2 | export const CONNECTION_DISCONNECTED = 'CONNECTION_DISCONNECTED' 3 | 4 | export const ERROR = 'ERROR' 5 | 6 | export const CONFIGURE = 'CONFIGURE' 7 | export const CONFIGURE_RETURNED = 'CONFIGURE_RETURNED' 8 | 9 | export const GET_POOL_BALANCES = 'GET_POOL_BALANCES' 10 | export const POOL_BALANCES_RETURNED = 'POOL_BALANCES_RETURNED' 11 | 12 | export const DEPOSIT_POOL = 'DEPOSIT_POOL' 13 | export const DEPOSIT_POOL_RETURNED = 'DEPOSIT_POOL_RETURNED' 14 | 15 | export const WITHDRAW_POOL = 'WITHDRAW_POOL' 16 | export const WITHDRAW_POOL_RETURNED = 'WITHDRAW_POOL_RETURNED' 17 | 18 | export const EXCHANGE_POOL = 'EXCHANGE_POOL' 19 | export const EXCHANGE_POOL_RETURNED = 'EXCHANGE_POOL_RETURNED' 20 | 21 | export const GET_EXCHANGE_PRICE = 'GET_EXCHANGE_PRICE' 22 | export const EXCHANGE_PRICE_RETURNED = 'EXCHANGE_PRICE_RETURNED' 23 | 24 | export const GET_WITHDRAW_PRICE = 'GET_WITHDRAW_PRICE' 25 | export const WITHDRAW_PRICE_RETURNED = 'WITHDRAW_PRICE_RETURNED' 26 | 27 | export const GET_DEPOSIT_PRICE = 'GET_DEPOSIT_PRICE' 28 | export const DEPOSIT_PRICE_RETURNED = 'DEPOSIT_PRICE_RETURNED' 29 | -------------------------------------------------------------------------------- /src/assets/defisnap.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | logo 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 15 | -------------------------------------------------------------------------------- /src/assets/icn-aethereum.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | Created by potrace 1.15, written by Peter Selinger 2001-2017 9 | 10 | 12 | 22 | 27 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/index.css: -------------------------------------------------------------------------------- 1 | @import url('https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800'); 2 | @import url('https://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400,600,700,900'); 3 | 4 | * { 5 | outline: none !important; 6 | } 7 | 8 | body { 9 | --blue: #007bff; 10 | --indigo: #6610f2; 11 | --purple: #6f42c1; 12 | --pink: #e83e8c; 13 | --red: #dc3545; 14 | --orange: #fd7e14; 15 | --yellow: #ffc107; 16 | --green: #28a745; 17 | --teal: #20c997; 18 | --cyan: #17a2b8; 19 | --white: #fff; 20 | --gray: #6c757d; 21 | --gray-dark: #343a40; 22 | --primary: #007bff; 23 | --secondary: #6c757d; 24 | --success: #28a745; 25 | --info: #17a2b8; 26 | --warning: #ffc107; 27 | --danger: #dc3545; 28 | --light: #f8f9fa; 29 | --dark: #343a40; 30 | --breakpoint-xs: 0; 31 | --breakpoint-sm: 576px; 32 | --breakpoint-md: 768px; 33 | --breakpoint-lg: 992px; 34 | --breakpoint-xl: 1200px; 35 | --font-family-sans-serif: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"; 36 | --font-family-monospace: SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace; 37 | margin: 0; 38 | font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"; 39 | font-size: 1rem; 40 | font-weight: 400; 41 | line-height: 1.5; 42 | color: #212529; 43 | text-align: left; 44 | background-color: #fff; 45 | } 46 | 47 | html { 48 | font-family: sans-serif; 49 | line-height: 1.15; 50 | -webkit-text-size-adjust: 100%; 51 | -ms-text-size-adjust: 100%; 52 | -ms-overflow-style: scrollbar; 53 | -webkit-tap-highlight-color: transparent; 54 | } 55 | 56 | code { 57 | font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", 58 | monospace; 59 | } 60 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "homepage": "./", 3 | "name": "yswap-finance", 4 | "version": "0.0.1", 5 | "private": true, 6 | "dependencies": { 7 | "@ethersproject/providers": "^5.0.0-beta.153", 8 | "@ethersproject/units": "^5.0.0-beta.132", 9 | "@material-ui/core": "^4.9.4", 10 | "@material-ui/icons": "^3.0.2", 11 | "@material-ui/lab": "^4.0.0-alpha.44", 12 | "@web3-react/authereum-connector": "^6.0.8", 13 | "@web3-react/core": "^6.0.7", 14 | "@web3-react/fortmatic-connector": "^6.0.7", 15 | "@web3-react/frame-connector": "^6.0.7", 16 | "@web3-react/injected-connector": "^6.0.7", 17 | "@web3-react/ledger-connector": "^6.0.7", 18 | "@web3-react/network-connector": "^6.0.7", 19 | "@web3-react/portis-connector": "^6.0.7", 20 | "@web3-react/squarelink-connector": "^6.0.7", 21 | "@web3-react/torus-connector": "^6.0.7", 22 | "@web3-react/trezor-connector": "^6.0.7", 23 | "@web3-react/walletconnect-connector": "^6.0.7", 24 | "@web3-react/walletlink-connector": "^6.0.7", 25 | "async": "^3.2.0", 26 | "flux": "^3.1.3", 27 | "i18next": "^19.3.2", 28 | "i18next-browser-languagedetector": "^4.0.2", 29 | "ipfs-react-router": "^0.2.2", 30 | "moment": "^2.24.0", 31 | "prop-types": "^15.7.2", 32 | "react": "^16.12.0", 33 | "react-dom": "^16.12.0", 34 | "react-i18next": "^9.0.10", 35 | "react-router-dom": "^5.1.2", 36 | "react-scripts": "^3.4.0", 37 | "request-promise": "^4.2.5", 38 | "typeface-roboto": "0.0.54", 39 | "web3": "^1.2.6" 40 | }, 41 | "scripts": { 42 | "start": "react-scripts start", 43 | "build": "react-scripts build", 44 | "test": "react-scripts test", 45 | "eject": "react-scripts eject" 46 | }, 47 | "eslintConfig": { 48 | "extends": "react-app" 49 | }, 50 | "browserslist": { 51 | "production": [ 52 | ">0.2%", 53 | "not dead", 54 | "not op_mini all" 55 | ], 56 | "development": [ 57 | "last 1 chrome version", 58 | "last 1 firefox version", 59 | "last 1 safari version" 60 | ] 61 | }, 62 | "devDependencies": { 63 | "husky": "^4.2.3" 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/components/unlock/hooks.jsx: -------------------------------------------------------------------------------- 1 | import { useState, useEffect } from "react"; 2 | import { useWeb3React } from "@web3-react/core"; 3 | 4 | import { injected } from "../../stores/connectors"; 5 | 6 | export function useEagerConnect() { 7 | const { activate, active } = useWeb3React(); 8 | 9 | const [tried, setTried] = useState(false); 10 | 11 | useEffect(() => { 12 | injected.isAuthorized().then(isAuthorized => { 13 | if (isAuthorized) { 14 | 15 | activate(injected, undefined, true).catch(() => { 16 | setTried(true); 17 | }); 18 | } else { 19 | setTried(true); 20 | } 21 | }); 22 | }, [activate]); // intentionally only running on mount (make sure it's only mounted once :)) 23 | 24 | // if the connection worked, wait until we get confirmation of that to flip the flag 25 | useEffect(() => { 26 | if (!tried && active) { 27 | setTried(true); 28 | } 29 | }, [tried, active]); 30 | 31 | return tried; 32 | } 33 | 34 | export function useInactiveListener(suppress = false) { 35 | const { active, error, activate } = useWeb3React(); 36 | 37 | useEffect(() => { 38 | const { ethereum } = window; 39 | if (ethereum && ethereum.on && !active && !error && !suppress) { 40 | const handleChainChanged = chainId => { 41 | activate(injected); 42 | }; 43 | 44 | const handleAccountsChanged = accounts => { 45 | if (accounts.length > 0) { 46 | activate(injected); 47 | } 48 | }; 49 | 50 | const handleNetworkChanged = networkId => { 51 | activate(injected); 52 | }; 53 | 54 | ethereum.on("chainChanged", handleChainChanged); 55 | ethereum.on("accountsChanged", handleAccountsChanged); 56 | ethereum.on("networkChanged", handleNetworkChanged); 57 | 58 | return () => { 59 | if (ethereum.removeListener) { 60 | ethereum.removeListener("chainChanged", handleChainChanged); 61 | ethereum.removeListener("accountsChanged", handleAccountsChanged); 62 | ethereum.removeListener("networkChanged", handleNetworkChanged); 63 | } 64 | }; 65 | } 66 | 67 | return () => {}; 68 | }, [active, error, suppress, activate]); 69 | } 70 | -------------------------------------------------------------------------------- /src/locales/ja/translation.json: -------------------------------------------------------------------------------- 1 | { 2 | "InvestSimple.Intro": "Earn interest. Simple.", 3 | "InvestSimple.Connect": "Connect wallet", 4 | "InvestSimple.Show": "Show V1", 5 | "InvestSimple.Hide": "Hide V1", 6 | "InvestSimple.InterestRate": "Interest Rate", 7 | "InvestSimple.AvailableBalance": "Available Balance", 8 | 9 | "Asset.InterestRate": "Interest Rate", 10 | "Asset.AvailableBalance": "Available Balance", 11 | "Asset.Disabled": "Disabled", 12 | "Asset.Earn": "Earn", 13 | "Asset.Claim": "Claim", 14 | 15 | "Unlock.Deactivate": "Deactivate", 16 | "Unlock.WalletConnected": "Wallet successfully connected.", 17 | 18 | "APR.HowMuch": "How much do you want to invest?", 19 | 20 | "Snackbar.Error": "Error", 21 | "Snackbar.Warning": "Warning", 22 | "Snackbar.Info": "Info", 23 | "Snackbar.Succecss": "Success", 24 | "Snackbar.Hash": "Hash", 25 | 26 | "Zap.Intro": "Zap In & Out. Simple.", 27 | "Zap.Zap": "Zap", 28 | "Zap.Swap": "Swap", 29 | "Zap.Trade": "Trade", 30 | 31 | "IDai.Intro": "Simple iDAI to DAI.", 32 | "IDai.Swap": "Swap", 33 | 34 | "Footer.Home": "home", 35 | "Footer.About": "about", 36 | "Footer.Docs": "docs", 37 | "Footer.Code": "code", 38 | "Footer.Telegram": "telegram", 39 | "Footer.Yield": "yield", 40 | "Footer.BuiltWith": "builtwith", 41 | "Footer.Zap": "zap", 42 | "Footer.Insure": "insure", 43 | 44 | "Insure.Intro": "Cover. Simple.", 45 | "Insure.Connect": "Connect wallet", 46 | "Insure.Balance": "Current Balance", 47 | "Insure.Insured": "Insured Percent", 48 | "Insure.UninsuredYield": "Uninsured Yield", 49 | "Insure.InsuredYield": "Insured Yield", 50 | "Insure.BuyInsurance": "Purchase Cover", 51 | "Insure.Disabled": "Disabled", 52 | "Insure.ClaimInsurance": "Claim", 53 | "Insure.MintInsurance": "Mint Insurance", 54 | "Insure.TotalCost": "Total Cost", 55 | "Insure.Expiration": "Expiration", 56 | "Insure.Premium": "Premium", 57 | "Insure.ExpectedReturns": "Expected Returns", 58 | "Insure.Unknown": "Unknown", 59 | "Insure.TotalCost": "Total Cost", 60 | "Insure.Balance": "Balance: ", 61 | "Insure.TokensMinted": "Tokens Minted", 62 | "Insure.CostPerToken": "Cost Per Token", 63 | "Insure.CollateralizationRatio": "Collateralization Ratio", 64 | "Insure.MinimumCollateralizationRatio": "Minimum Collateralization Ratio", 65 | 66 | "Home.Earn": "Earn", 67 | "Home.Zap": "Zap", 68 | "Home.Apr": "APR", 69 | "Home.Cover": "Cover", 70 | 71 | "Zap.IWillReceive": "I will receive", 72 | "Zap.IHave": "I have", 73 | "Zap.SendAmount": "Send amount" 74 | } 75 | -------------------------------------------------------------------------------- /src/locales/zh/translation.json: -------------------------------------------------------------------------------- 1 | { 2 | "InvestSimple.Intro": "Earn interest. Simple.", 3 | "InvestSimple.Connect": "Connect wallet", 4 | "InvestSimple.Show": "Show V1", 5 | "InvestSimple.Hide": "Hide V1", 6 | "InvestSimple.InterestRate": "Interest Rate", 7 | "InvestSimple.AvailableBalance": "Available Balance", 8 | 9 | "Asset.InterestRate": "Interest Rate", 10 | "Asset.AvailableBalance": "Available Balance", 11 | "Asset.Disabled": "Disabled", 12 | "Asset.Earn": "Earn", 13 | "Asset.Claim": "Claim", 14 | 15 | "Unlock.Deactivate": "Deactivate", 16 | "Unlock.WalletConnected": "Wallet successfully connected.", 17 | 18 | "APR.HowMuch": "How much do you want to invest?", 19 | 20 | "Snackbar.Error": "Error", 21 | "Snackbar.Warning": "Warning", 22 | "Snackbar.Info": "Info", 23 | "Snackbar.Succecss": "Success", 24 | "Snackbar.Hash": "Hash", 25 | 26 | "Zap.Intro": "Zap In & Out. Simple.", 27 | "Zap.Zap": "Zap", 28 | "Zap.Swap": "Swap", 29 | "Zap.Trade": "Trade", 30 | 31 | "IDai.Intro": "Simple iDAI to DAI.", 32 | "IDai.Swap": "Swap", 33 | 34 | "Footer.Home": "home", 35 | "Footer.About": "about", 36 | "Footer.Docs": "docs", 37 | "Footer.Code": "code", 38 | "Footer.Telegram": "telegram", 39 | "Footer.Yield": "yield", 40 | "Footer.BuiltWith": "builtwith", 41 | "Footer.Zap": "zap", 42 | "Footer.Insure": "insure", 43 | 44 | "Insure.Intro": "Cover. Simple.", 45 | "Insure.Connect": "Connect wallet", 46 | "Insure.Balance": "Current Balance", 47 | "Insure.Insured": "Insured Percent", 48 | "Insure.UninsuredYield": "Uninsured Yield", 49 | "Insure.InsuredYield": "Insured Yield", 50 | "Insure.BuyInsurance": "Purchase Cover", 51 | "Insure.Disabled": "Disabled", 52 | "Insure.ClaimInsurance": "Claim", 53 | "Insure.MintInsurance": "Mint Insurance", 54 | "Insure.TotalCost": "Total Cost", 55 | "Insure.Expiration": "Expiration", 56 | "Insure.Premium": "Premium", 57 | "Insure.ExpectedReturns": "Expected Returns", 58 | "Insure.Unknown": "Unknown", 59 | "Insure.TotalCost": "Total Cost", 60 | "Insure.Balance": "Balance: ", 61 | "Insure.TokensMinted": "Tokens Minted", 62 | "Insure.CostPerToken": "Cost Per Token", 63 | "Insure.CollateralizationRatio": "Collateralization Ratio", 64 | "Insure.MinimumCollateralizationRatio": "Minimum Collateralization Ratio", 65 | 66 | "Home.Earn": "Earn", 67 | "Home.Zap": "Zap", 68 | "Home.Apr": "APR", 69 | "Home.Cover": "Cover", 70 | 71 | "Zap.IWillReceive": "I will receive", 72 | "Zap.IHave": "I have", 73 | "Zap.SendAmount": "Send amount" 74 | } 75 | -------------------------------------------------------------------------------- /src/stores/connectors.jsx: -------------------------------------------------------------------------------- 1 | import { InjectedConnector } from "@web3-react/injected-connector"; 2 | // import { NetworkConnector } from "@web3-react/network-connector"; 3 | import { WalletConnectConnector } from "@web3-react/walletconnect-connector"; 4 | import { WalletLinkConnector } from "@web3-react/walletlink-connector"; 5 | import { LedgerConnector } from "@web3-react/ledger-connector"; 6 | import { TrezorConnector } from "@web3-react/trezor-connector"; 7 | import { FrameConnector } from "@web3-react/frame-connector"; 8 | import { FortmaticConnector } from "@web3-react/fortmatic-connector"; 9 | import { PortisConnector } from "@web3-react/portis-connector"; 10 | import { SquarelinkConnector } from "@web3-react/squarelink-connector"; 11 | import { TorusConnector } from "@web3-react/torus-connector"; 12 | import { AuthereumConnector } from "@web3-react/authereum-connector"; 13 | 14 | const POLLING_INTERVAL = 12000; 15 | const RPC_URLS = { 16 | 1: "https://mainnet.infura.io/v3/bd80ce1ca1f94da48e151bb6868bb150", 17 | 4: "https://rinkeby.infura.io/v3/bd80ce1ca1f94da48e151bb6868bb150" 18 | }; 19 | 20 | export const injected = new InjectedConnector({ 21 | supportedChainIds: [1, 3, 4, 5, 42] 22 | }); 23 | 24 | // export const network = new NetworkConnector({ 25 | // urls: { 1: RPC_URLS[1], 4: RPC_URLS[4] }, 26 | // defaultChainId: 1, 27 | // pollingInterval: POLLING_INTERVAL 28 | // }); 29 | 30 | export const walletconnect = new WalletConnectConnector({ 31 | rpc: { 1: RPC_URLS[1] }, 32 | bridge: "https://bridge.walletconnect.org", 33 | qrcode: true, 34 | pollingInterval: POLLING_INTERVAL 35 | }); 36 | 37 | export const walletlink = new WalletLinkConnector({ 38 | url: RPC_URLS[1], 39 | appName: "yswap.financaae" 40 | }); 41 | 42 | export const ledger = new LedgerConnector({ 43 | chainId: 1, 44 | url: RPC_URLS[1], 45 | pollingInterval: POLLING_INTERVAL 46 | }); 47 | 48 | export const trezor = new TrezorConnector({ 49 | chainId: 1, 50 | url: RPC_URLS[1], 51 | pollingInterval: POLLING_INTERVAL, 52 | manifestEmail: "dummy@abc.xyz", 53 | manifestAppUrl: "https://8rg3h.csb.app/" 54 | }); 55 | 56 | export const frame = new FrameConnector({ supportedChainIds: [1] }); 57 | 58 | export const fortmatic = new FortmaticConnector({ 59 | apiKey: "pk_live_F95FEECB1BE324B5", 60 | chainId: 1 61 | }); 62 | 63 | export const portis = new PortisConnector({ 64 | dAppId: "211b48db-e8cc-4b68-82ad-bf781727ea9e", 65 | networks: [1, 100] 66 | }); 67 | 68 | export const squarelink = new SquarelinkConnector({ 69 | clientId: "5f2a2233db82b06b24f9", 70 | networks: [1, 100] 71 | }); 72 | 73 | export const torus = new TorusConnector({ chainId: 1 }); 74 | 75 | export const authereum = new AuthereumConnector({ chainId: 1 }); 76 | -------------------------------------------------------------------------------- /src/assets/aave.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 29 | 30 | 39 | yswap-finance 40 | 41 | 42 | 43 |
44 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # yswap finance 2 | 3 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 4 | 5 | ## Available Scripts 6 | 7 | In the project directory, you can run: 8 | 9 | ### `npm start` 10 | 11 | Runs the app in the development mode.
12 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser. 13 | 14 | The page will reload if you make edits.
15 | You will also see any lint errors in the console. 16 | 17 | ### `npm test` 18 | 19 | Launches the test runner in the interactive watch mode.
20 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 21 | 22 | ### `npm run build` 23 | 24 | Builds the app for production to the `build` folder.
25 | It correctly bundles React in production mode and optimizes the build for the best performance. 26 | 27 | The build is minified and the filenames include the hashes.
28 | Your app is ready to be deployed! 29 | 30 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 31 | 32 | ### `npm run eject` 33 | 34 | **Note: this is a one-way operation. Once you `eject`, you can’t go back!** 35 | 36 | If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. 37 | 38 | Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. 39 | 40 | You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. 41 | 42 | ## Learn More 43 | 44 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 45 | 46 | To learn React, check out the [React documentation](https://reactjs.org/). 47 | 48 | ### Code Splitting 49 | 50 | This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting 51 | 52 | ### Analyzing the Bundle Size 53 | 54 | This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size 55 | 56 | ### Making a Progressive Web App 57 | 58 | This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app 59 | 60 | ### Advanced Configuration 61 | 62 | This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration 63 | 64 | ### Deployment 65 | 66 | This section has moved here: https://facebook.github.io/create-react-app/docs/deployment 67 | 68 | ### `npm run build` fails to minify 69 | 70 | This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify 71 | -------------------------------------------------------------------------------- /src/assets/lendf.svg: -------------------------------------------------------------------------------- 1 | lendf_logo1 -------------------------------------------------------------------------------- /src/assets/uniswap.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 11 | 17 | 18 | 19 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /src/locales/en/translation.json: -------------------------------------------------------------------------------- 1 | { 2 | "InvestSimple.Intro": "Earn interest. Simple.", 3 | "InvestSimple.Connect": "Connect wallet", 4 | "InvestSimple.Show": "Show V1", 5 | "InvestSimple.Hide": "Hide V1", 6 | "InvestSimple.InterestRate": "Interest Rate", 7 | "InvestSimple.AvailableBalance": "Available Balance", 8 | 9 | "Asset.InterestRate": "Interest Rate", 10 | "Asset.AvailableBalance": "Available Balance", 11 | "Asset.Disabled": "Disabled", 12 | "Asset.Earn": "Earn", 13 | "Asset.Claim": "Claim", 14 | "Asset.Deposit": "Deposit", 15 | "Asset.Withdraw": "Withdraw", 16 | "Asset.ClaimRewards": "Claim Rewards", 17 | 18 | "Unlock.Deactivate": "Deactivate", 19 | "Unlock.WalletConnected": "Wallet successfully connected.", 20 | 21 | "APR.HowMuch": "How much do you want to invest?", 22 | 23 | "Snackbar.Error": "Error", 24 | "Snackbar.Warning": "Warning", 25 | "Snackbar.Info": "Info", 26 | "Snackbar.Succecss": "Success", 27 | "Snackbar.Hash": "Hash", 28 | 29 | "Zap.Intro": "Zap In & Out. Simple.", 30 | "Zap.Zap": "Zap", 31 | "Zap.Swap": "Swap", 32 | "Zap.Trade": "Trade", 33 | 34 | "IDai.Intro": "Simple iDAI to DAI.", 35 | "IDai.Swap": "Swap", 36 | 37 | "Footer.Home": "home", 38 | "Footer.About": "about", 39 | "Footer.Docs": "docs", 40 | "Footer.Code": "code", 41 | "Footer.Telegram": "telegram", 42 | "Footer.Yield": "yield", 43 | "Footer.BuiltWith": "builtwith", 44 | "Footer.Zap": "zap", 45 | "Footer.Insure": "insure", 46 | 47 | "Insure.Intro": "Cover. Simple.", 48 | "Insure.Connect": "Connect wallet", 49 | "Insure.Balance": "Current Balance", 50 | "Insure.Insured": "Insured Percent", 51 | "Insure.UninsuredYield": "Uninsured Yield", 52 | "Insure.InsuredYield": "Insured Yield", 53 | "Insure.BuyInsurance": "Purchase Cover", 54 | "Insure.Disabled": "Disabled", 55 | "Insure.ClaimInsurance": "Claim", 56 | "Insure.MintInsurance": "Mint Insurance", 57 | "Insure.TotalCost": "Total Cost", 58 | "Insure.Expiration": "Expiration", 59 | "Insure.Premium": "Premium", 60 | "Insure.ExpectedReturns": "Expected Returns", 61 | "Insure.Unknown": "Unknown", 62 | "Insure.TotalCost": "Total Cost", 63 | "Insure.Balance": "Balance: ", 64 | "Insure.TokensMinted": "Tokens Minted", 65 | "Insure.CostPerToken": "Cost Per Token", 66 | "Insure.CollateralizationRatio": "Collateralization Ratio", 67 | "Insure.MinimumCollateralizationRatio": "Minimum Collateralization Ratio", 68 | 69 | "Home.Earn": "Earn", 70 | "Home.Zap": "Zap", 71 | "Home.Apr": "APR", 72 | "Home.Cover": "Cover", 73 | "Home.Pool": "Pool", 74 | "Home.Balancer": "Balancer", 75 | 76 | "Zap.IWillReceive": "I will receive", 77 | "Zap.IHave": "I have", 78 | "Zap.SendAmount": "Send amount", 79 | 80 | "PoolDeposit.Intro": "Deposit. Simple.", 81 | "PoolDeposit.Connect": "Connect wallet", 82 | "PoolDeposit.Deposit": "Deposit", 83 | "PoolDeposit.IWillReceive": "I will receive", 84 | "PoolDeposit.Ideal": "Recommended split", 85 | 86 | "PoolWithdraw.Intro": "Withdraw. Simple.", 87 | "PoolWithdraw.Connect": "Connect wallet", 88 | "PoolWithdraw.Withdraw": "Withdraw", 89 | "PoolWithdraw.IWillReceive": "I will receive", 90 | 91 | "PoolExchange.Intro": "Exchange. Simple.", 92 | "PoolExchange.Connect": "Connect wallet", 93 | "PoolExchange.Exchange": "Exchange", 94 | "PoolExchange.From": "From", 95 | "PoolExchange.To": "To", 96 | 97 | "Pool.Intro": "Pooling. Simple.", 98 | "Pool.Connect": "Connect wallet", 99 | 100 | "Balancer.Intro": "Balancer. Simple.", 101 | "Balancer.Connect": "Connect wallet" 102 | 103 | } 104 | -------------------------------------------------------------------------------- /src/App.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import CssBaseline from '@material-ui/core/CssBaseline'; 3 | import { createMuiTheme, MuiThemeProvider } from '@material-ui/core/styles'; 4 | import { 5 | Switch, 6 | Route 7 | } from "react-router-dom"; 8 | import IpfsRouter from 'ipfs-react-router' 9 | 10 | import './i18n'; 11 | import interestTheme from './theme'; 12 | 13 | import Account from './components/account'; 14 | import Footer from './components/footer'; 15 | import Home from './components/home'; 16 | import Pool from './components/pool'; 17 | import Header from './components/header'; 18 | 19 | import { 20 | CONNECTION_CONNECTED, 21 | CONNECTION_DISCONNECTED, 22 | CONFIGURE, 23 | CONFIGURE_RETURNED, 24 | } from './constants' 25 | 26 | import Store from "./stores"; 27 | const emitter = Store.emitter 28 | const dispatcher = Store.dispatcher 29 | const store = Store.store 30 | 31 | class App extends Component { 32 | state = { 33 | account: null, 34 | headerValue: null 35 | }; 36 | 37 | setHeaderValue = (newValue) => { 38 | this.setState({ headerValue: newValue }) 39 | }; 40 | 41 | componentWillMount() { 42 | emitter.on(CONNECTION_CONNECTED, this.connectionConnected); 43 | emitter.on(CONNECTION_DISCONNECTED, this.connectionDisconnected); 44 | emitter.on(CONFIGURE_RETURNED, this.configureReturned); 45 | } 46 | 47 | componentWillUnmount() { 48 | emitter.removeListener(CONNECTION_CONNECTED, this.connectionConnected); 49 | emitter.removeListener(CONNECTION_DISCONNECTED, this.connectionDisconnected); 50 | emitter.removeListener(CONFIGURE_RETURNED, this.configureReturned); 51 | }; 52 | 53 | configureReturned = () => { 54 | console.log('Configure Returned') 55 | } 56 | 57 | connectionConnected = () => { 58 | console.log('setting account') 59 | console.log(store.getStore('account')) 60 | this.setState({ account: store.getStore('account') }) 61 | console.log('configuring') 62 | dispatcher.dispatch({ type: CONFIGURE, content: {} }) 63 | }; 64 | 65 | connectionDisconnected = () => { 66 | this.setState({ account: store.getStore('account') }) 67 | } 68 | 69 | render() { 70 | 71 | const { headerValue, account } = this.state 72 | 73 | return ( 74 | 75 | 76 | 77 | { !account && 78 |
87 | 88 |
89 | } 90 | { account && 91 |
99 | 100 | 101 |
102 | 103 | 104 | 105 |
106 | 107 | 108 | 109 |
110 |
111 | } 112 |
113 |
114 | ); 115 | } 116 | } 117 | 118 | export default App; 119 | -------------------------------------------------------------------------------- /src/assets/metamask.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 50 | 51 | 52 | 54 | 56 | 57 | 58 | 59 | 61 | 62 | -------------------------------------------------------------------------------- /src/components/footer/footer.jsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from "react"; 2 | import { withRouter } from "react-router-dom"; 3 | import { withStyles } from '@material-ui/core/styles'; 4 | import { 5 | Typography, 6 | Select, 7 | MenuItem, 8 | FormControl 9 | } from '@material-ui/core'; 10 | import { 11 | Link 12 | } from "react-router-dom"; 13 | import { withNamespaces } from 'react-i18next'; 14 | import i18n from '../../i18n'; 15 | import { colors } from '../../theme' 16 | 17 | import Store from "../../stores"; 18 | const store = Store.store 19 | 20 | const styles = theme => ({ 21 | footer: { 22 | padding: '24px', 23 | display: 'flex', 24 | flexWrap: 'wrap', 25 | justifyContent: 'flex-end', 26 | width: '100%', 27 | alignItems: 'center', 28 | [theme.breakpoints.up('sm')]: { 29 | flexDirection: 'row', 30 | justifyContent: 'space-between', 31 | width: '100%', 32 | alignItems: 'center', 33 | } 34 | }, 35 | footerLinks: { 36 | display: 'flex', 37 | flexWrap: 'wrap', 38 | flexDirection: 'row', 39 | justifyContent: 'space-between', 40 | width: '100%', 41 | maxWidth: '420px' 42 | }, 43 | footerText: { 44 | cursor: 'pointer' 45 | }, 46 | languageContainer: { 47 | paddingLeft: '12px', 48 | display: 'none' 49 | }, 50 | selectInput: { 51 | fontSize: '14px', 52 | color: colors.pink 53 | }, 54 | link: { 55 | textDecoration: 'none' 56 | } 57 | }); 58 | 59 | 60 | class Footer extends Component { 61 | 62 | constructor(props) { 63 | super() 64 | 65 | this.state = { 66 | languages: store.getStore('languages'), 67 | language: 'en', 68 | modalBuiltWithOpen: false, 69 | } 70 | } 71 | 72 | render() { 73 | const { classes, t, location } = this.props; 74 | const { 75 | modalBuiltWithOpen, 76 | languages, 77 | language 78 | } = this.state 79 | 80 | if(!location.pathname.includes('/earn') && !location.pathname.includes('/zap') && !location.pathname.includes('/cover') && !location.pathname.includes('/apr') && !location.pathname.includes('/pool') && !location.pathname.includes('/balancer') ) { 81 | return null 82 | } 83 | 84 | return ( 85 |
86 |
87 | 88 | { t('Footer.Home') } 89 | 90 | window.open("https://docs.iearn.finance", "_blank")} className={ classes.footerText } variant={ 'h6'}>{ t('Footer.About') } 91 | window.open("https://docs.iearn.finance", "_blank")} className={ classes.footerText } variant={ 'h6'}>{ t('Footer.Docs') } 92 | window.open("https://github.com/iearn-finance", "_blank")} className={ classes.footerText } variant={ 'h6'}>{ t('Footer.Code') } 93 | window.open("https://t.me/iearnfinance", "_blank")} className={ classes.footerText } variant={ 'h6'}>{ t('Footer.Telegram') } 94 |
95 |
96 | 97 | 109 | 110 |
111 |
112 | ) 113 | } 114 | 115 | handleLanguageChange = (event) => { 116 | let val = [] 117 | val.language = event.target.value 118 | this.setState(val) 119 | 120 | i18n.changeLanguage(event.target.value) 121 | } 122 | } 123 | 124 | export default withNamespaces()(withRouter(withStyles(styles)(Footer))); 125 | -------------------------------------------------------------------------------- /src/assets/dydx.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/config/development.config.js: -------------------------------------------------------------------------------- 1 | const config = { 2 | erc20ABI: [ 3 | { 4 | "constant": false, 5 | "inputs": [ 6 | { 7 | "name": "_spender", 8 | "type": "address" 9 | }, 10 | { 11 | "name": "_value", 12 | "type": "uint256" 13 | } 14 | ], 15 | "name": "approve", 16 | "outputs": [ 17 | { 18 | "name": "success", 19 | "type": "bool" 20 | } 21 | ], 22 | "payable": false, 23 | "stateMutability": "nonpayable", 24 | "type": "function" 25 | }, 26 | { 27 | "constant": false, 28 | "inputs": [ 29 | { 30 | "name": "_to", 31 | "type": "address" 32 | }, 33 | { 34 | "name": "_value", 35 | "type": "uint256" 36 | } 37 | ], 38 | "name": "showMeTheMoney", 39 | "outputs": [], 40 | "payable": false, 41 | "stateMutability": "nonpayable", 42 | "type": "function" 43 | }, 44 | { 45 | "constant": false, 46 | "inputs": [ 47 | { 48 | "name": "_to", 49 | "type": "address" 50 | }, 51 | { 52 | "name": "_value", 53 | "type": "uint256" 54 | } 55 | ], 56 | "name": "transfer", 57 | "outputs": [ 58 | { 59 | "name": "success", 60 | "type": "bool" 61 | } 62 | ], 63 | "payable": false, 64 | "stateMutability": "nonpayable", 65 | "type": "function" 66 | }, 67 | { 68 | "constant": false, 69 | "inputs": [ 70 | { 71 | "name": "_from", 72 | "type": "address" 73 | }, 74 | { 75 | "name": "_to", 76 | "type": "address" 77 | }, 78 | { 79 | "name": "_value", 80 | "type": "uint256" 81 | } 82 | ], 83 | "name": "transferFrom", 84 | "outputs": [ 85 | { 86 | "name": "success", 87 | "type": "bool" 88 | } 89 | ], 90 | "payable": false, 91 | "stateMutability": "nonpayable", 92 | "type": "function" 93 | }, 94 | { 95 | "anonymous": false, 96 | "inputs": [ 97 | { 98 | "indexed": true, 99 | "name": "_from", 100 | "type": "address" 101 | }, 102 | { 103 | "indexed": true, 104 | "name": "_to", 105 | "type": "address" 106 | }, 107 | { 108 | "indexed": false, 109 | "name": "_value", 110 | "type": "uint256" 111 | } 112 | ], 113 | "name": "Transfer", 114 | "type": "event" 115 | }, 116 | { 117 | "anonymous": false, 118 | "inputs": [ 119 | { 120 | "indexed": true, 121 | "name": "_owner", 122 | "type": "address" 123 | }, 124 | { 125 | "indexed": true, 126 | "name": "_spender", 127 | "type": "address" 128 | }, 129 | { 130 | "indexed": false, 131 | "name": "_value", 132 | "type": "uint256" 133 | } 134 | ], 135 | "name": "Approval", 136 | "type": "event" 137 | }, 138 | { 139 | "constant": true, 140 | "inputs": [ 141 | { 142 | "name": "_owner", 143 | "type": "address" 144 | }, 145 | { 146 | "name": "_spender", 147 | "type": "address" 148 | } 149 | ], 150 | "name": "allowance", 151 | "outputs": [ 152 | { 153 | "name": "remaining", 154 | "type": "uint256" 155 | } 156 | ], 157 | "payable": false, 158 | "stateMutability": "view", 159 | "type": "function" 160 | }, 161 | { 162 | "constant": true, 163 | "inputs": [ 164 | { 165 | "name": "_owner", 166 | "type": "address" 167 | } 168 | ], 169 | "name": "balanceOf", 170 | "outputs": [ 171 | { 172 | "name": "balance", 173 | "type": "uint256" 174 | } 175 | ], 176 | "payable": false, 177 | "stateMutability": "view", 178 | "type": "function" 179 | }, 180 | { 181 | "constant": true, 182 | "inputs": [], 183 | "name": "decimals", 184 | "outputs": [ 185 | { 186 | "name": "", 187 | "type": "uint256" 188 | } 189 | ], 190 | "payable": false, 191 | "stateMutability": "view", 192 | "type": "function" 193 | }, 194 | { 195 | "constant": true, 196 | "inputs": [], 197 | "name": "name", 198 | "outputs": [ 199 | { 200 | "name": "", 201 | "type": "string" 202 | } 203 | ], 204 | "payable": false, 205 | "stateMutability": "view", 206 | "type": "function" 207 | }, 208 | { 209 | "constant": true, 210 | "inputs": [], 211 | "name": "symbol", 212 | "outputs": [ 213 | { 214 | "name": "", 215 | "type": "string" 216 | } 217 | ], 218 | "payable": false, 219 | "stateMutability": "view", 220 | "type": "function" 221 | }, 222 | { 223 | "constant": true, 224 | "inputs": [], 225 | "name": "totalSupply", 226 | "outputs": [ 227 | { 228 | "name": "", 229 | "type": "uint256" 230 | } 231 | ], 232 | "payable": false, 233 | "stateMutability": "view", 234 | "type": "function" 235 | } 236 | ] 237 | }; 238 | 239 | export default config; 240 | -------------------------------------------------------------------------------- /src/config/production.config.js: -------------------------------------------------------------------------------- 1 | const config = { 2 | erc20ABI: [ 3 | { 4 | "constant": false, 5 | "inputs": [ 6 | { 7 | "name": "_spender", 8 | "type": "address" 9 | }, 10 | { 11 | "name": "_value", 12 | "type": "uint256" 13 | } 14 | ], 15 | "name": "approve", 16 | "outputs": [ 17 | { 18 | "name": "success", 19 | "type": "bool" 20 | } 21 | ], 22 | "payable": false, 23 | "stateMutability": "nonpayable", 24 | "type": "function" 25 | }, 26 | { 27 | "constant": false, 28 | "inputs": [ 29 | { 30 | "name": "_to", 31 | "type": "address" 32 | }, 33 | { 34 | "name": "_value", 35 | "type": "uint256" 36 | } 37 | ], 38 | "name": "showMeTheMoney", 39 | "outputs": [], 40 | "payable": false, 41 | "stateMutability": "nonpayable", 42 | "type": "function" 43 | }, 44 | { 45 | "constant": false, 46 | "inputs": [ 47 | { 48 | "name": "_to", 49 | "type": "address" 50 | }, 51 | { 52 | "name": "_value", 53 | "type": "uint256" 54 | } 55 | ], 56 | "name": "transfer", 57 | "outputs": [ 58 | { 59 | "name": "success", 60 | "type": "bool" 61 | } 62 | ], 63 | "payable": false, 64 | "stateMutability": "nonpayable", 65 | "type": "function" 66 | }, 67 | { 68 | "constant": false, 69 | "inputs": [ 70 | { 71 | "name": "_from", 72 | "type": "address" 73 | }, 74 | { 75 | "name": "_to", 76 | "type": "address" 77 | }, 78 | { 79 | "name": "_value", 80 | "type": "uint256" 81 | } 82 | ], 83 | "name": "transferFrom", 84 | "outputs": [ 85 | { 86 | "name": "success", 87 | "type": "bool" 88 | } 89 | ], 90 | "payable": false, 91 | "stateMutability": "nonpayable", 92 | "type": "function" 93 | }, 94 | { 95 | "anonymous": false, 96 | "inputs": [ 97 | { 98 | "indexed": true, 99 | "name": "_from", 100 | "type": "address" 101 | }, 102 | { 103 | "indexed": true, 104 | "name": "_to", 105 | "type": "address" 106 | }, 107 | { 108 | "indexed": false, 109 | "name": "_value", 110 | "type": "uint256" 111 | } 112 | ], 113 | "name": "Transfer", 114 | "type": "event" 115 | }, 116 | { 117 | "anonymous": false, 118 | "inputs": [ 119 | { 120 | "indexed": true, 121 | "name": "_owner", 122 | "type": "address" 123 | }, 124 | { 125 | "indexed": true, 126 | "name": "_spender", 127 | "type": "address" 128 | }, 129 | { 130 | "indexed": false, 131 | "name": "_value", 132 | "type": "uint256" 133 | } 134 | ], 135 | "name": "Approval", 136 | "type": "event" 137 | }, 138 | { 139 | "constant": true, 140 | "inputs": [ 141 | { 142 | "name": "_owner", 143 | "type": "address" 144 | }, 145 | { 146 | "name": "_spender", 147 | "type": "address" 148 | } 149 | ], 150 | "name": "allowance", 151 | "outputs": [ 152 | { 153 | "name": "remaining", 154 | "type": "uint256" 155 | } 156 | ], 157 | "payable": false, 158 | "stateMutability": "view", 159 | "type": "function" 160 | }, 161 | { 162 | "constant": true, 163 | "inputs": [ 164 | { 165 | "name": "_owner", 166 | "type": "address" 167 | } 168 | ], 169 | "name": "balanceOf", 170 | "outputs": [ 171 | { 172 | "name": "balance", 173 | "type": "uint256" 174 | } 175 | ], 176 | "payable": false, 177 | "stateMutability": "view", 178 | "type": "function" 179 | }, 180 | { 181 | "constant": true, 182 | "inputs": [], 183 | "name": "decimals", 184 | "outputs": [ 185 | { 186 | "name": "", 187 | "type": "uint256" 188 | } 189 | ], 190 | "payable": false, 191 | "stateMutability": "view", 192 | "type": "function" 193 | }, 194 | { 195 | "constant": true, 196 | "inputs": [], 197 | "name": "name", 198 | "outputs": [ 199 | { 200 | "name": "", 201 | "type": "string" 202 | } 203 | ], 204 | "payable": false, 205 | "stateMutability": "view", 206 | "type": "function" 207 | }, 208 | { 209 | "constant": true, 210 | "inputs": [], 211 | "name": "symbol", 212 | "outputs": [ 213 | { 214 | "name": "", 215 | "type": "string" 216 | } 217 | ], 218 | "payable": false, 219 | "stateMutability": "view", 220 | "type": "function" 221 | }, 222 | { 223 | "constant": true, 224 | "inputs": [], 225 | "name": "totalSupply", 226 | "outputs": [ 227 | { 228 | "name": "", 229 | "type": "uint256" 230 | } 231 | ], 232 | "payable": false, 233 | "stateMutability": "view", 234 | "type": "function" 235 | } 236 | ] 237 | }; 238 | 239 | export default config; 240 | -------------------------------------------------------------------------------- /src/components/account/account.jsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from "react"; 2 | import { withRouter } from "react-router-dom"; 3 | import { withStyles } from '@material-ui/core/styles'; 4 | import { 5 | Typography, 6 | Button, 7 | } from '@material-ui/core'; 8 | import { colors } from '../../theme' 9 | 10 | import UnlockModal from '../unlock/unlockModal.jsx' 11 | import RefreshIcon from '@material-ui/icons/Refresh'; 12 | 13 | import { 14 | ERROR, 15 | CONNECTION_CONNECTED, 16 | CONNECTION_DISCONNECTED, 17 | CONFIGURE, 18 | CONFIGURE_RETURNED 19 | } from '../../constants' 20 | 21 | import Store from "../../stores"; 22 | const emitter = Store.emitter 23 | const dispatcher = Store.dispatcher 24 | const store = Store.store 25 | 26 | const styles = theme => ({ 27 | root: { 28 | flex: 1, 29 | display: 'flex', 30 | flexDirection: 'column', 31 | background: colors.blue, 32 | minWidth: '100vw', 33 | padding: '36px 24px' 34 | }, 35 | connectHeading: { 36 | maxWidth: '300px', 37 | textAlign: 'center', 38 | color: colors.white 39 | }, 40 | connectContainer: { 41 | padding: '20px' 42 | }, 43 | actionButton: { 44 | color: colors.white, 45 | borderColor: colors.white 46 | }, 47 | notConnectedRoot: { 48 | flex: 1, 49 | display: 'flex', 50 | flexDirection: 'column', 51 | justifyContent: 'center', 52 | alignItems: 'center', 53 | }, 54 | connectedRoot: { 55 | display: 'flex', 56 | flexDirection: 'column', 57 | justifyContent: 'flex-start', 58 | alignItems: 'flex-start', 59 | width: '100%' 60 | }, 61 | address: { 62 | color: colors.white, 63 | width: '100%', 64 | paddingBottom: '24px', 65 | display: 'flex', 66 | justifyContent: 'space-between' 67 | }, 68 | balances: { 69 | color: colors.white, 70 | width: '100%', 71 | padding: '12px' 72 | }, 73 | balanceContainer: { 74 | display: 'flex', 75 | width: '100%', 76 | justifyContent: 'space-between' 77 | }, 78 | accountHeading: { 79 | paddingBottom: '6px' 80 | }, 81 | icon: { 82 | cursor: 'pointer' 83 | }, 84 | disclaimer: { 85 | padding: '12px', 86 | border: '1px solid '+colors.white, 87 | borderRadius: '0.75rem', 88 | marginBottom: '24px', 89 | fontWeight: 1, 90 | color: colors.white 91 | } 92 | }); 93 | 94 | class Account extends Component { 95 | 96 | constructor(props) { 97 | super() 98 | 99 | const account = store.getStore('account') 100 | 101 | this.state = { 102 | loading: false, 103 | account: account, 104 | assets: store.getStore('assets'), 105 | modalOpen: false, 106 | } 107 | } 108 | componentWillMount() { 109 | emitter.on(ERROR, this.errorReturned); 110 | emitter.on(CONNECTION_CONNECTED, this.connectionConnected); 111 | emitter.on(CONNECTION_DISCONNECTED, this.connectionDisconnected); 112 | emitter.on(CONFIGURE_RETURNED, this.configureReturned); 113 | } 114 | 115 | componentWillUnmount() { 116 | emitter.removeListener(ERROR, this.errorReturned); 117 | emitter.removeListener(CONNECTION_CONNECTED, this.connectionConnected); 118 | emitter.removeListener(CONNECTION_DISCONNECTED, this.connectionDisconnected); 119 | emitter.removeListener(CONFIGURE_RETURNED, this.configureReturned); 120 | }; 121 | 122 | connectionConnected = () => { 123 | // this.setState({ account: store.getStore('account') }) 124 | }; 125 | 126 | configureReturned = () => { 127 | this.props.history.push('/pool') 128 | } 129 | 130 | connectionDisconnected = () => { 131 | this.setState({ account: store.getStore('account'), loading: false }) 132 | } 133 | 134 | errorReturned = (error) => { 135 | //TODO: handle errors 136 | }; 137 | 138 | render() { 139 | const { classes } = this.props; 140 | const { 141 | account, 142 | modalOpen, 143 | } = this.state 144 | 145 | return ( 146 |
147 | { this.renderNotConnected() } 148 | { modalOpen && this.renderModal() } 149 |
150 | ) 151 | }; 152 | 153 | renderNotConnected = () => { 154 | const { classes } = this.props 155 | const { loading } = this.state 156 | 157 | return ( 158 |
159 | This project is in beta. Use at your own risk. 160 |
161 | Connect your wallet to continue 162 |
163 |
164 | 173 |
174 |
175 | ) 176 | } 177 | 178 | renderModal = () => { 179 | return ( 180 | 181 | ) 182 | } 183 | 184 | unlockClicked = () => { 185 | this.setState({ modalOpen: true, loading: true }) 186 | } 187 | 188 | closeModal = () => { 189 | this.setState({ modalOpen: false, loading: false }) 190 | } 191 | } 192 | 193 | export default withRouter(withStyles(styles)(Account)); 194 | -------------------------------------------------------------------------------- /src/serviceWorker.js: -------------------------------------------------------------------------------- 1 | // This optional code is used to register a service worker. 2 | // register() is not called by default. 3 | 4 | // This lets the app load faster on subsequent visits in production, and gives 5 | // it offline capabilities. However, it also means that developers (and users) 6 | // will only see deployed updates on subsequent visits to a page, after all the 7 | // existing tabs open on the page have been closed, since previously cached 8 | // resources are updated in the background. 9 | 10 | // To learn more about the benefits of this model and instructions on how to 11 | // opt-in, read https://bit.ly/CRA-PWA 12 | 13 | const isLocalhost = Boolean( 14 | window.location.hostname === 'localhost' || 15 | // [::1] is the IPv6 localhost address. 16 | window.location.hostname === '[::1]' || 17 | // 127.0.0.1/8 is considered localhost for IPv4. 18 | window.location.hostname.match( 19 | /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ 20 | ) 21 | ); 22 | 23 | export function register(config) { 24 | if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { 25 | // The URL constructor is available in all browsers that support SW. 26 | const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href); 27 | if (publicUrl.origin !== window.location.origin) { 28 | // Our service worker won't work if PUBLIC_URL is on a different origin 29 | // from what our page is served on. This might happen if a CDN is used to 30 | // serve assets; see https://github.com/facebook/create-react-app/issues/2374 31 | return; 32 | } 33 | 34 | window.addEventListener('load', () => { 35 | const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; 36 | 37 | if (isLocalhost) { 38 | // This is running on localhost. Let's check if a service worker still exists or not. 39 | checkValidServiceWorker(swUrl, config); 40 | 41 | // Add some additional logging to localhost, pointing developers to the 42 | // service worker/PWA documentation. 43 | navigator.serviceWorker.ready.then(() => { 44 | console.log( 45 | 'This web app is being served cache-first by a service ' + 46 | 'worker. To learn more, visit https://bit.ly/CRA-PWA' 47 | ); 48 | }); 49 | } else { 50 | // Is not localhost. Just register service worker 51 | registerValidSW(swUrl, config); 52 | } 53 | }); 54 | } 55 | } 56 | 57 | function registerValidSW(swUrl, config) { 58 | navigator.serviceWorker 59 | .register(swUrl) 60 | .then(registration => { 61 | registration.onupdatefound = () => { 62 | const installingWorker = registration.installing; 63 | if (installingWorker == null) { 64 | return; 65 | } 66 | installingWorker.onstatechange = () => { 67 | if (installingWorker.state === 'installed') { 68 | if (navigator.serviceWorker.controller) { 69 | // At this point, the updated precached content has been fetched, 70 | // but the previous service worker will still serve the older 71 | // content until all client tabs are closed. 72 | console.log( 73 | 'New content is available and will be used when all ' + 74 | 'tabs for this page are closed. See https://bit.ly/CRA-PWA.' 75 | ); 76 | 77 | // Execute callback 78 | if (config && config.onUpdate) { 79 | config.onUpdate(registration); 80 | } 81 | } else { 82 | // At this point, everything has been precached. 83 | // It's the perfect time to display a 84 | // "Content is cached for offline use." message. 85 | console.log('Content is cached for offline use.'); 86 | 87 | // Execute callback 88 | if (config && config.onSuccess) { 89 | config.onSuccess(registration); 90 | } 91 | } 92 | } 93 | }; 94 | }; 95 | }) 96 | .catch(error => { 97 | console.error('Error during service worker registration:', error); 98 | }); 99 | } 100 | 101 | function checkValidServiceWorker(swUrl, config) { 102 | // Check if the service worker can be found. If it can't reload the page. 103 | fetch(swUrl) 104 | .then(response => { 105 | // Ensure service worker exists, and that we really are getting a JS file. 106 | const contentType = response.headers.get('content-type'); 107 | if ( 108 | response.status === 404 || 109 | (contentType != null && contentType.indexOf('javascript') === -1) 110 | ) { 111 | // No service worker found. Probably a different app. Reload the page. 112 | navigator.serviceWorker.ready.then(registration => { 113 | registration.unregister().then(() => { 114 | window.location.reload(); 115 | }); 116 | }); 117 | } else { 118 | // Service worker found. Proceed as normal. 119 | registerValidSW(swUrl, config); 120 | } 121 | }) 122 | .catch(() => { 123 | console.log( 124 | 'No internet connection found. App is running in offline mode.' 125 | ); 126 | }); 127 | } 128 | 129 | export function unregister() { 130 | if ('serviceWorker' in navigator) { 131 | navigator.serviceWorker.ready.then(registration => { 132 | registration.unregister(); 133 | }); 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /src/components/snackbar/snackbar.jsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from "react"; 2 | import { 3 | Snackbar, 4 | IconButton, 5 | Button, 6 | Typography, 7 | SvgIcon 8 | } from '@material-ui/core'; 9 | 10 | import { colors } from "../../theme"; 11 | import { withNamespaces } from 'react-i18next'; 12 | 13 | 14 | const iconStyle = { 15 | fontSize: '22px', 16 | marginRight: '10px', 17 | verticalAlign: 'middle' 18 | } 19 | 20 | function CloseIcon(props) { 21 | const { color } = props; 22 | return ( 23 | 24 | 28 | 29 | ); 30 | } 31 | 32 | function SuccessIcon(props) { 33 | const { color } = props; 34 | return ( 35 | 36 | 40 | 41 | ); 42 | } 43 | 44 | function ErrorIcon(props) { 45 | const { color } = props; 46 | return ( 47 | 48 | 52 | 53 | ); 54 | } 55 | 56 | function WarningIcon(props) { 57 | const { color } = props; 58 | return ( 59 | 60 | 64 | 65 | ); 66 | } 67 | 68 | function InfoIcon(props) { 69 | const { color } = props; 70 | return ( 71 | 72 | 76 | 77 | ); 78 | } 79 | 80 | 81 | class MySnackbar extends Component { 82 | state = { 83 | open: this.props.open, 84 | }; 85 | 86 | handleClick = () => { 87 | this.setState({ open: true }); 88 | }; 89 | 90 | handleClose = (event, reason) => { 91 | if (reason === 'clickaway') { 92 | return; 93 | } 94 | 95 | this.setState({ open: false }); 96 | }; 97 | 98 | render() { 99 | 100 | const { type, message, t } = this.props 101 | 102 | let icon = 103 | let color = colors.blue 104 | let messageType = '' 105 | let actions = [ 106 | 111 | 112 | , 113 | ] 114 | 115 | switch (type) { 116 | case 'Error': 117 | icon = 118 | color = colors.red 119 | messageType = t("Snackbar.Error") 120 | break; 121 | case 'Success': 122 | icon = 123 | color = colors.blue 124 | messageType = t("Snackbar.Success") 125 | break; 126 | case 'Warning': 127 | icon = 128 | color = colors.orange 129 | messageType = t("Snackbar.Warning") 130 | break; 131 | case 'Info': 132 | icon = 133 | color = colors.blue 134 | messageType = t("Snackbar.Info") 135 | break; 136 | case 'Hash': 137 | icon = 138 | color = colors.blue 139 | messageType = t("Snackbar.Hash") 140 | 141 | let snackbarMessage = 'https://etherscan.io/tx/'+message; 142 | actions = [, 145 | 150 | 151 | , 152 | ] 153 | break; 154 | default: 155 | icon = 156 | color = colors.blue 157 | messageType = t("Snackbar.Success") 158 | break; 159 | } 160 | 161 | return ( 162 | 172 | {icon} 173 |
174 | { messageType } 175 | { message } 176 |
177 | 178 | } 179 | action={actions} 180 | /> 181 | ); 182 | } 183 | } 184 | 185 | export default withNamespaces()(MySnackbar); 186 | -------------------------------------------------------------------------------- /src/assets/icn-metamask.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/components/home/home.jsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from "react"; 2 | import { withRouter } from "react-router-dom"; 3 | import { withStyles } from '@material-ui/core/styles'; 4 | import { 5 | Card, 6 | Typography, 7 | } from '@material-ui/core'; 8 | import { withNamespaces } from 'react-i18next'; 9 | import { colors } from '../../theme' 10 | import FlashOnIcon from '@material-ui/icons/FlashOn'; 11 | import AttachMoneyIcon from '@material-ui/icons/AttachMoney'; 12 | import SecurityIcon from '@material-ui/icons/Security'; 13 | import BarChartIcon from '@material-ui/icons/BarChart'; 14 | import PieChartIcon from '@material-ui/icons/PieChart'; 15 | import DetailsIcon from '@material-ui/icons/Details'; 16 | 17 | const styles = theme => ({ 18 | root: { 19 | flex: 1, 20 | display: 'flex', 21 | width: '100%', 22 | justifyContent: 'space-around', 23 | alignItems: 'center', 24 | flexDirection: 'column', 25 | [theme.breakpoints.up('sm')]: { 26 | flexDirection: 'row', 27 | } 28 | }, 29 | card: { 30 | flex: '1', 31 | height: '25vh', 32 | width: '100%', 33 | display: 'flex', 34 | justifyContent: 'center', 35 | alignItems: 'center', 36 | flexDirection: 'column', 37 | cursor: 'pointer', 38 | borderRadius: '0px', 39 | transition: 'background-color 0.2s linear', 40 | [theme.breakpoints.up('sm')]: { 41 | height: '100vh', 42 | minWidth: '20%', 43 | minHeight: '50vh', 44 | } 45 | }, 46 | earn: { 47 | backgroundColor: colors.white, 48 | '&:hover': { 49 | backgroundColor: colors.pink, 50 | '& .title': { 51 | color: colors.white 52 | }, 53 | '& .icon': { 54 | color: colors.white 55 | } 56 | }, 57 | '& .title': { 58 | color: colors.pink 59 | }, 60 | '& .icon': { 61 | color: colors.pink 62 | } 63 | }, 64 | zap: { 65 | backgroundColor: colors.white, 66 | '&:hover': { 67 | backgroundColor: colors.blue, 68 | '& .title': { 69 | color: colors.white, 70 | }, 71 | '& .icon': { 72 | color: colors.white 73 | } 74 | }, 75 | '& .title': { 76 | color: colors.blue, 77 | display: 'block' 78 | }, 79 | '& .soon': { 80 | color: colors.blue, 81 | display: 'none' 82 | }, 83 | '& .icon': { 84 | color: colors.blue 85 | }, 86 | }, 87 | apr: { 88 | backgroundColor: colors.white, 89 | '&:hover': { 90 | backgroundColor: colors.lightBlack, 91 | '& .title': { 92 | color: colors.white 93 | }, 94 | '& .icon': { 95 | color: colors.white 96 | } 97 | }, 98 | '& .title': { 99 | color: colors.lightBlack 100 | }, 101 | '& .icon': { 102 | color: colors.lightBlack 103 | }, 104 | }, 105 | cover: { 106 | backgroundColor: colors.white, 107 | '&:hover': { 108 | backgroundColor: colors.compoundGreen, 109 | '& .title': { 110 | color: colors.white, 111 | }, 112 | '& .icon': { 113 | color: colors.white 114 | } 115 | }, 116 | '& .title': { 117 | color: colors.compoundGreen, 118 | }, 119 | '& .icon': { 120 | color: colors.compoundGreen 121 | }, 122 | }, 123 | pool: { 124 | backgroundColor: colors.white, 125 | '&:hover': { 126 | backgroundColor: colors.tomato, 127 | '& .title': { 128 | color: colors.white, 129 | }, 130 | '& .icon': { 131 | color: colors.white 132 | } 133 | }, 134 | '& .title': { 135 | color: colors.tomato, 136 | }, 137 | '& .icon': { 138 | color: colors.tomato 139 | }, 140 | }, 141 | balancer: { 142 | backgroundColor: colors.white, 143 | '&:hover': { 144 | backgroundColor: colors.purple, 145 | '& .title': { 146 | color: colors.white, 147 | }, 148 | '& .icon': { 149 | color: colors.white 150 | } 151 | }, 152 | '& .title': { 153 | color: colors.purple, 154 | }, 155 | '& .icon': { 156 | color: colors.purple 157 | }, 158 | }, 159 | title: { 160 | padding: '24px', 161 | paddingBottom: '0px', 162 | [theme.breakpoints.up('sm')]: { 163 | paddingBottom: '24px' 164 | } 165 | }, 166 | icon: { 167 | fontSize: '60px', 168 | [theme.breakpoints.up('sm')]: { 169 | fontSize: '100px', 170 | } 171 | }, 172 | link: { 173 | textDecoration: 'none' 174 | } 175 | }); 176 | 177 | class Home extends Component { 178 | 179 | constructor(props) { 180 | super() 181 | 182 | this.state = { 183 | } 184 | } 185 | 186 | render() { 187 | const { classes, t, location } = this.props; 188 | 189 | console.log(location) 190 | 191 | return ( 192 |
193 | { this.nav(location.pathname+'earn') } }> 194 | 195 | { t("Home.Earn") } 196 | 197 | { this.nav(location.pathname+'zap') } }> 198 | 199 | { t("Home.Zap") } 200 | 201 | { this.nav(location.pathname+'apr') } }> 202 | 203 | { t("Home.Apr") } 204 | 205 | { this.nav(location.pathname+'cover') }}> 206 | 207 | { t("Home.Cover") } 208 | 209 | { this.nav(location.pathname+'pool') }}> 210 | 211 | { t("Home.Pool") } 212 | 213 | 214 |
215 | ) 216 | }; 217 | 218 | nav = (screen) => { 219 | this.props.history.push(screen) 220 | } 221 | } 222 | 223 | export default withNamespaces()(withRouter(withStyles(styles)(Home))); 224 | -------------------------------------------------------------------------------- /src/components/pool/pool.jsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from "react"; 2 | import { withRouter } from "react-router-dom"; 3 | import { withStyles } from '@material-ui/core/styles'; 4 | import { 5 | Tabs, 6 | Tab, 7 | Typography, 8 | Button, 9 | Card 10 | } from '@material-ui/core'; 11 | import { withNamespaces } from 'react-i18next'; 12 | 13 | import UnlockModal from '../unlock/unlockModal.jsx' 14 | import Deposit from './deposit' 15 | import Withdraw from './withdraw' 16 | import Exchange from './exchange' 17 | import Store from "../../stores"; 18 | 19 | import { 20 | ERROR, 21 | GET_POOL_BALANCES, 22 | CONFIGURE_RETURNED 23 | } from '../../constants' 24 | 25 | const styles = theme => ({ 26 | root: { 27 | flex: 1, 28 | display: 'flex', 29 | flexDirection: 'column', 30 | maxWidth: '1200px', 31 | width: '100%', 32 | justifyContent: 'center', 33 | alignItems: 'center', 34 | marginTop: '40px' 35 | }, 36 | intro: { 37 | width: '100%', 38 | position: 'relative', 39 | display: 'flex', 40 | justifyContent: 'space-between', 41 | alignItems: 'center', 42 | maxWidth: '400px' 43 | }, 44 | introCenter: { 45 | minWidth: '100%', 46 | textAlign: 'center', 47 | padding: '48px 0px' 48 | }, 49 | investedContainer: { 50 | display: 'flex', 51 | flex: 1, 52 | flexDirection: 'column', 53 | alignItems: 'center', 54 | justifyContent: 'center', 55 | padding: '12px', 56 | minWidth: '100%', 57 | [theme.breakpoints.up('md')]: { 58 | minWidth: '800px', 59 | } 60 | }, 61 | connectContainer: { 62 | padding: '12px', 63 | display: 'flex', 64 | justifyContent: 'center', 65 | width: '100%', 66 | maxWidth: '450px', 67 | [theme.breakpoints.up('md')]: { 68 | width: '450', 69 | } 70 | }, 71 | actionButton: { 72 | '&:hover': { 73 | backgroundColor: "#2F80ED", 74 | }, 75 | padding: '12px', 76 | backgroundColor: "#2F80ED", 77 | borderRadius: '1rem', 78 | border: '1px solid #E1E1E1', 79 | fontWeight: 500, 80 | [theme.breakpoints.up('md')]: { 81 | padding: '15px', 82 | } 83 | }, 84 | buttonText: { 85 | fontWeight: '700', 86 | color: 'white', 87 | }, 88 | disaclaimer: { 89 | padding: '12px', 90 | border: '1px solid rgb(174, 174, 174)', 91 | borderRadius: '0.75rem', 92 | marginBottom: '24px', 93 | }, 94 | card: { 95 | width: '100%', 96 | display: 'flex', 97 | flexWrap: 'wrap', 98 | justifyContent: 'center', 99 | paddingBottom: '20px', 100 | flexDirection: 'column', 101 | alignItems: 'center', 102 | }, 103 | }) 104 | 105 | const StyledTabs = withStyles({ 106 | indicator: { 107 | display: 'flex', 108 | justifyContent: 'center', 109 | backgroundColor: 'transparent', 110 | '& > div': { 111 | maxWidth: 40, 112 | width: '100%', 113 | backgroundColor: '#DC6BE5', 114 | }, 115 | }, 116 | })(props => }} />); 117 | 118 | 119 | const StyledTab = withStyles(theme => ({ 120 | root: { 121 | textTransform: 'none', 122 | fontWeight: theme.typography.fontWeightRegular, 123 | fontSize: theme.typography.pxToRem(15), 124 | marginRight: '1px', 125 | '&:focus': { 126 | color: '#DC6BE5', 127 | opacity: 1, 128 | }, 129 | }, 130 | }))(props => ); 131 | 132 | 133 | const emitter = Store.emitter 134 | const dispatcher = Store.dispatcher 135 | const store = Store.store 136 | 137 | class Pool extends Component { 138 | 139 | constructor(props) { 140 | super() 141 | 142 | const account = store.getStore('account') 143 | const assets = store.getStore('assets') 144 | 145 | this.state = { 146 | value: 0, 147 | loading: !(account && assets), 148 | account: account 149 | } 150 | 151 | } 152 | 153 | componentWillMount() { 154 | emitter.on(CONFIGURE_RETURNED, this.configureReturned) 155 | } 156 | 157 | componentWillUnmount() { 158 | emitter.removeListener(CONFIGURE_RETURNED, this.configureReturned) 159 | }; 160 | 161 | configureReturned = () => { 162 | this.setState({ loading: false }) 163 | dispatcher.dispatch({ type: GET_POOL_BALANCES, content: {} }) 164 | } 165 | 166 | render() { 167 | const { classes, t } = this.props; 168 | const { 169 | value, 170 | account, 171 | loading, 172 | modalOpen, 173 | } = this.state 174 | 175 | var address = null; 176 | if (account.address) { 177 | address = account.address.substring(0,6)+'...'+account.address.substring(account.address.length-4,account.address.length) 178 | } 179 | 180 | return ( 181 |
182 | { !account.address && 183 |
184 | This project is in beta. Use at your own risk. 185 |
186 | { t('Pool.Intro') } 187 |
188 |
189 | 198 |
199 |
200 | } 201 | { account.address && 202 |
203 | 204 | 205 | 206 | 207 | 208 |
209 | } 210 | { account.address && value == 0 && } 211 | { account.address && value == 1 && } 212 | { account.address && value == 2 && } 213 | { modalOpen && this.renderModal() } 214 |
215 | ) 216 | } 217 | 218 | renderModal = () => { 219 | return ( 220 | 221 | ) 222 | } 223 | 224 | handleTabChange = (event, newValue) => { 225 | this.setState({value:newValue}) 226 | }; 227 | 228 | overlayClicked = () => { 229 | this.setState({ modalOpen: true }) 230 | } 231 | 232 | closeModal = () => { 233 | this.setState({ modalOpen: false }) 234 | } 235 | 236 | } 237 | 238 | export default withNamespaces()(withRouter(withStyles(styles)(Pool))); 239 | -------------------------------------------------------------------------------- /src/components/header/header.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { withStyles } from '@material-ui/core/styles'; 3 | import { 4 | Tabs, 5 | Tab, 6 | Typography 7 | } from '@material-ui/core'; 8 | import { withRouter } from "react-router-dom"; 9 | import { colors } from '../../theme' 10 | 11 | const styles = theme => ({ 12 | root: { 13 | verticalAlign: 'top', 14 | width: '100%', 15 | display: 'flex', 16 | }, 17 | earn: { 18 | flex: '1', 19 | height: '75px', 20 | width: '100%', 21 | display: 'flex', 22 | justifyContent: 'center', 23 | alignItems: 'center', 24 | cursor: 'pointer', 25 | backgroundColor: colors.pink, 26 | '&:hover': { 27 | backgroundColor: "#f9fafb", 28 | '& .title': { 29 | color: colors.pink 30 | }, 31 | '& .titleActive': { 32 | color: colors.pink, 33 | borderBottom: '4px solid '+colors.pink, 34 | padding: '10px 0px' 35 | }, 36 | '& .icon': { 37 | color: colors.pink 38 | } 39 | }, 40 | '& .title': { 41 | color: colors.white 42 | }, 43 | '& .titleActive': { 44 | color: colors.white, 45 | borderBottom: '4px solid white', 46 | padding: '10px 0px' 47 | }, 48 | '& .icon': { 49 | color: colors.white 50 | }, 51 | }, 52 | zap: { 53 | flex: '1', 54 | height: '75px', 55 | width: '100%', 56 | display: 'flex', 57 | justifyContent: 'center', 58 | alignItems: 'center', 59 | cursor: 'pointer', 60 | backgroundColor: colors.lightBlue, 61 | '&:hover': { 62 | backgroundColor: "#f9fafb", 63 | '& .title': { 64 | color: colors.lightBlue, 65 | }, 66 | '& .titleActive': { 67 | color: colors.lightBlue, 68 | borderBottom: '4px solid '+colors.lightBlue, 69 | padding: '10px 0px' 70 | }, 71 | '& .icon': { 72 | color: colors.lightBlue 73 | } 74 | }, 75 | '& .title': { 76 | color: colors.white 77 | }, 78 | '& .titleActive': { 79 | color: colors.white, 80 | borderBottom: '4px solid white', 81 | padding: '10px 0px' 82 | }, 83 | '& .icon': { 84 | color: colors.white 85 | }, 86 | }, 87 | apr: { 88 | flex: '1', 89 | height: '75px', 90 | width: '100%', 91 | display: 'flex', 92 | justifyContent: 'center', 93 | alignItems: 'center', 94 | cursor: 'pointer', 95 | backgroundColor: colors.lightBlack, 96 | '&:hover': { 97 | backgroundColor: "#f9fafb", 98 | '& .title': { 99 | color: colors.lightBlack 100 | }, 101 | '& .titleActive': { 102 | color: colors.lightBlack, 103 | borderBottom: '4px solid '+colors.lightBlack, 104 | padding: '10px 0px' 105 | }, 106 | '& .icon': { 107 | color: colors.lightBlack 108 | } 109 | }, 110 | '& .title': { 111 | color: colors.white 112 | }, 113 | '& .titleActive': { 114 | color: colors.white, 115 | borderBottom: '4px solid white', 116 | padding: '10px 0px' 117 | }, 118 | '& .icon': { 119 | color: colors.white 120 | } 121 | }, 122 | cover: { 123 | flex: '1', 124 | height: '75px', 125 | width: '100%', 126 | display: 'flex', 127 | justifyContent: 'center', 128 | alignItems: 'center', 129 | cursor: 'pointer', 130 | backgroundColor: colors.compoundGreen, 131 | '&:hover': { 132 | backgroundColor: "#f9fafb", 133 | '& .title': { 134 | color: colors.compoundGreen 135 | }, 136 | '& .titleActive': { 137 | color: colors.compoundGreen, 138 | borderBottom: '4px solid '+colors.compoundGreen, 139 | padding: '10px 0px' 140 | }, 141 | '& .icon': { 142 | color: colors.compoundGreen 143 | } 144 | }, 145 | '& .title': { 146 | color: colors.white 147 | }, 148 | '& .titleActive': { 149 | color: colors.white, 150 | borderBottom: '4px solid white', 151 | padding: '10px 0px' 152 | }, 153 | '& .icon': { 154 | color: colors.white 155 | } 156 | }, 157 | pool: { 158 | flex: '1', 159 | height: '75px', 160 | width: '100%', 161 | display: 'flex', 162 | justifyContent: 'center', 163 | alignItems: 'center', 164 | cursor: 'pointer', 165 | backgroundColor: colors.tomato, 166 | '&:hover': { 167 | backgroundColor: "#f9fafb", 168 | '& .title': { 169 | color: colors.tomato 170 | }, 171 | '& .titleActive': { 172 | color: colors.tomato, 173 | borderBottom: '4px solid '+colors.tomato, 174 | padding: '10px 0px' 175 | }, 176 | '& .icon': { 177 | color: colors.tomato 178 | } 179 | }, 180 | '& .title': { 181 | color: colors.white 182 | }, 183 | '& .titleActive': { 184 | color: colors.white, 185 | borderBottom: '4px solid white', 186 | padding: '10px 0px' 187 | }, 188 | '& .icon': { 189 | color: colors.white 190 | } 191 | }, 192 | }); 193 | 194 | function Header(props) { 195 | const { 196 | classes, 197 | setHeaderValue, 198 | headerValue, 199 | location 200 | } = props; 201 | 202 | const [value, setValue] = React.useState(0); 203 | 204 | const handleChange = (event, newValue) => { 205 | setValue(newValue); 206 | setHeaderValue(newValue) 207 | }; 208 | 209 | const nav = (screen) => { 210 | props.history.push('/'+screen) 211 | } 212 | 213 | return(
) 214 | 215 | return ( 216 |
217 |
{ nav('earn') } }> 218 | Earn 219 |
220 |
{ nav('zap') } }> 221 | Zap 222 |
223 |
{ nav('apr') } }> 224 | APR 225 |
226 |
{ nav('cover') } }> 227 | Cover 228 |
229 |
{ nav('pool') } }> 230 | Pool 231 |
232 |
233 | ) 234 | } 235 | 236 | function a11yProps(index) { 237 | return { 238 | id: `full-width-tab-${index}`, 239 | 'aria-controls': `full-width-tabpanel-${index}`, 240 | }; 241 | } 242 | 243 | export default withRouter(withStyles(styles)(Header)); 244 | -------------------------------------------------------------------------------- /src/theme/theme.jsx: -------------------------------------------------------------------------------- 1 | import createBreakpoints from '@material-ui/core/styles/createBreakpoints' 2 | 3 | import WorkSansTTF from '../assets/fonts/WorkSans-VariableFont_wght.ttf'; 4 | 5 | const WorkSans = { 6 | fontFamily: 'Work Sans Thin', 7 | fontStyle: 'normal', 8 | fontDisplay: 'swap', 9 | fontWeight: 400, 10 | src: ` 11 | local('Work Sans Thin'), 12 | local('Work Sans Thin'), 13 | url(${WorkSansTTF}) format('truetype') 14 | `, 15 | unicodeRange: 16 | 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF', 17 | }; 18 | 19 | export const colors = { 20 | white: "#fff", 21 | black: '#000', 22 | darkBlue: "#2c3b57", 23 | blue: "#2F80ED", 24 | gray: "#e1e1e1", 25 | lightGray: "#737373", 26 | lightBlack: "#6a6a6a", 27 | darkBlack: "#141414", 28 | green: '#1abc9c', 29 | red: '#ed4337', 30 | orange: 'orange', 31 | pink: '#DC6BE5', 32 | compoundGreen: '#00d395', 33 | tomato: '#e56b73', 34 | purple: '#935dff', 35 | 36 | text: "#212529", 37 | lightBlue: "#2F80ED", 38 | topaz: "#0b8f92", 39 | darkGray: "rgba(43,57,84,.5)", 40 | borderBlue: 'rgba(25, 101, 233, 0.5)' 41 | }; 42 | 43 | const breakpoints = createBreakpoints({ 44 | keys: ["xs", "sm", "md", "lg", "xl"], 45 | values: { 46 | xs: 0, 47 | sm: 600, 48 | md: 900, 49 | lg: 1200, 50 | xl: 1800 51 | } 52 | }) 53 | 54 | const iswapTheme = { 55 | typography: { 56 | fontFamily: [ 57 | '"Work Sans Thin"', 58 | 'BlinkMacSystemFont', 59 | '"Segoe UI"', 60 | 'Roboto', 61 | '"Helvetica Neue"', 62 | 'Arial', 63 | 'sans-serif', 64 | '"Apple Color Emoji"', 65 | '"Segoe UI Emoji"', 66 | '"Segoe UI Symbol"', 67 | ].join(','), 68 | h1: { 69 | fontSize: '48px', 70 | fontWeight: '600', 71 | WebkitFontSmoothing: "antialiased", 72 | MozOsxFontSmoothing: "grayscale", 73 | lineHeight: 1.2 74 | }, 75 | h2: { 76 | fontSize: '36px', 77 | fontWeight: '600', 78 | WebkitFontSmoothing: "antialiased", 79 | MozOsxFontSmoothing: "grayscale", 80 | lineHeight: 1.2 81 | }, 82 | h3: { 83 | fontSize: '24px', 84 | fontWeight: '600', 85 | WebkitFontSmoothing: "antialiased", 86 | MozOsxFontSmoothing: "grayscale", 87 | lineHeight: 1.2 88 | }, 89 | h4: { 90 | fontSize: '16px', 91 | fontWeight: '600', 92 | WebkitFontSmoothing: "antialiased", 93 | MozOsxFontSmoothing: "grayscale", 94 | lineHeight: 1.2 95 | }, 96 | h5: { 97 | fontSize: '14px', 98 | fontWeight: '600', 99 | WebkitFontSmoothing: "antialiased", 100 | MozOsxFontSmoothing: "grayscale", 101 | lineHeight: 1.2 102 | }, 103 | body1: { 104 | fontSize: '16px', 105 | fontWeight: '300', 106 | WebkitFontSmoothing: "antialiased", 107 | MozOsxFontSmoothing: "grayscale", 108 | }, 109 | body2: { 110 | fontSize: '16px', 111 | fontWeight: '300', 112 | WebkitFontSmoothing: "antialiased", 113 | MozOsxFontSmoothing: "grayscale", 114 | }, 115 | }, 116 | type: 'light', 117 | overrides: { 118 | MuiCssBaseline: { 119 | '@global': { 120 | '@font-face': [WorkSans], 121 | }, 122 | }, 123 | MuiSelect: { 124 | select: { 125 | padding: '9px' 126 | }, 127 | selectMenu: { 128 | minHeight: '30px', 129 | display: 'flex', 130 | alignItems: 'center' 131 | } 132 | }, 133 | MuiButton: { 134 | root: { 135 | borderRadius: '50px', 136 | padding: '10px 24px' 137 | }, 138 | outlined: { 139 | padding: '10px 24px', 140 | borderWidth: '2px !important' 141 | }, 142 | text: { 143 | padding: '10px 24px' 144 | }, 145 | label: { 146 | textTransform: 'none', 147 | fontSize: '1rem' 148 | } 149 | }, 150 | MuiInputBase: { 151 | input: { 152 | fontSize: '16px', 153 | fontWeight: '600', 154 | WebkitFontSmoothing: "antialiased", 155 | MozOsxFontSmoothing: "grayscale", 156 | lineHeight: 1.2 157 | } 158 | }, 159 | MuiOutlinedInput: { 160 | adornedEnd: { 161 | 162 | }, 163 | input: { 164 | "&::placeholder": { 165 | color: colors.text 166 | }, 167 | color: colors.text, 168 | padding: '14px', 169 | borderRadius: '50px' 170 | }, 171 | root: { 172 | // border: "none !important", 173 | borderRadius: '50px' 174 | }, 175 | notchedOutline: { 176 | // border: "none !important" 177 | } 178 | }, 179 | MuiSnackbar : { 180 | root: { 181 | maxWidth: 'calc(100vw - 24px)' 182 | }, 183 | anchorOriginBottomLeft: { 184 | bottom: '12px', 185 | left: '12px', 186 | '@media (min-width: 960px)': { 187 | bottom: '50px', 188 | left: '80px' 189 | } 190 | } 191 | }, 192 | MuiSnackbarContent: { 193 | root: { 194 | backgroundColor: colors.white, 195 | padding: '0px', 196 | minWidth: 'auto', 197 | '@media (min-width: 960px)': { 198 | minWidth: '500px', 199 | } 200 | }, 201 | message: { 202 | padding: '0px' 203 | }, 204 | action: { 205 | marginRight: '0px' 206 | } 207 | }, 208 | MuiExpansionPanel: { 209 | root: { 210 | border: '1px solid '+colors.borderBlue, 211 | borderRadius: '50px', 212 | margin: '8px 0px', 213 | '&:before': { //underline color when textfield is inactive 214 | backgroundColor: 'none', 215 | height: '0px' 216 | }, 217 | } 218 | }, 219 | MuiInput: { 220 | underline: { 221 | '&:before': { //underline color when textfield is inactive 222 | borderBottom: 'none !important' 223 | }, 224 | '&:after': { //underline color when textfield is inactive 225 | borderBottom: 'none !important' 226 | }, 227 | } 228 | }, 229 | MuiExpansionPanelSummary: { 230 | root: { 231 | padding: '30px 42px' 232 | }, 233 | content: { 234 | margin: '0px !important' 235 | } 236 | }, 237 | MuiExpansionPanelDetails: { 238 | root: { 239 | padding: '0 12px 15px 12px', 240 | '@media (min-width: 960px)': { 241 | padding: '0 24px 30px 24px', 242 | } 243 | } 244 | }, 245 | MuiToggleButton: { 246 | root: { 247 | borderRadius: '50px', 248 | textTransform: 'none', 249 | minWidth: '100px', 250 | border: 'none', 251 | '& > span > h4': { 252 | color: '#555', 253 | }, 254 | '&:hover': { 255 | backgroundColor: "rgba(47,128,237, 0.2)", 256 | }, 257 | "&$selected": { 258 | backgroundColor: '#2f80ed', 259 | '& > span > h4': { 260 | color: '#fff', 261 | }, 262 | '&:hover': { 263 | backgroundColor: "rgba(47,128,237, 0.2)", 264 | '& > span > h4': { 265 | color: '#000', 266 | }, 267 | }, 268 | } 269 | } 270 | }, 271 | MuiPaper: { 272 | elevation1: { 273 | boxShadow: 'none' 274 | } 275 | }, 276 | MuiToggleButtonGroup: { 277 | root: { 278 | border: '1px solid '+colors.borderBlue, 279 | borderRadius: '50px', 280 | }, 281 | groupedSizeSmall: { 282 | padding: '42px 30px' 283 | } 284 | }, 285 | MuiFormControlLabel: { 286 | label: { 287 | color: colors.darkBlack 288 | } 289 | } 290 | }, 291 | palette: { 292 | primary: { 293 | main: colors.blue 294 | }, 295 | secondary: { 296 | main: colors.topaz 297 | }, 298 | text: { 299 | primary: colors.text, 300 | secondary: colors.text 301 | } 302 | }, 303 | breakpoints: breakpoints 304 | }; 305 | 306 | export default iswapTheme; 307 | -------------------------------------------------------------------------------- /src/components/unlock/unlock.jsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from "react"; 2 | import { withRouter } from "react-router-dom"; 3 | import { withStyles } from '@material-ui/core/styles'; 4 | import { 5 | Typography, 6 | Button, 7 | CircularProgress 8 | } from '@material-ui/core'; 9 | import CloseIcon from '@material-ui/icons/Close'; 10 | import { withNamespaces } from 'react-i18next'; 11 | 12 | import { 13 | Web3ReactProvider, 14 | useWeb3React, 15 | } from "@web3-react/core"; 16 | import { Web3Provider } from "@ethersproject/providers"; 17 | import { useEagerConnect, useInactiveListener } from "./hooks"; 18 | 19 | import { 20 | ERROR, 21 | CONNECTION_DISCONNECTED, 22 | CONNECTION_CONNECTED 23 | } from '../../constants' 24 | 25 | import Store from "../../stores"; 26 | const emitter = Store.emitter 27 | const store = Store.store 28 | 29 | const styles = theme => ({ 30 | root: { 31 | flex: 1, 32 | height: 'auto', 33 | display: 'flex', 34 | position: 'relative' 35 | }, 36 | contentContainer: { 37 | margin: 'auto', 38 | textAlign: 'center', 39 | padding: '12px', 40 | display: 'flex', 41 | flexWrap: 'wrap' 42 | }, 43 | cardContainer: { 44 | marginTop: '60px', 45 | minHeight: '260px', 46 | display: 'flex', 47 | flexDirection: 'column', 48 | justifyContent: 'space-around', 49 | alignItems: 'center' 50 | }, 51 | unlockCard: { 52 | padding: '24px' 53 | }, 54 | buttonText: { 55 | marginLeft: '12px', 56 | fontWeight: '700', 57 | }, 58 | instruction: { 59 | maxWidth: '400px', 60 | marginBottom: '32px', 61 | marginTop: '32px' 62 | }, 63 | actionButton: { 64 | padding: '12px', 65 | backgroundColor: 'white', 66 | borderRadius: '3rem', 67 | border: '1px solid #E1E1E1', 68 | fontWeight: 500, 69 | [theme.breakpoints.up('md')]: { 70 | padding: '15px', 71 | } 72 | }, 73 | connect: { 74 | width: '100%' 75 | }, 76 | closeIcon: { 77 | position: 'fixed', 78 | right: '12px', 79 | top: '12px', 80 | cursor: 'pointer' 81 | } 82 | }); 83 | 84 | class Unlock extends Component { 85 | 86 | constructor(props) { 87 | super() 88 | 89 | this.state = { 90 | error: null, 91 | metamaskLoading: false, 92 | ledgerLoading: false 93 | } 94 | } 95 | 96 | componentWillMount() { 97 | emitter.on(CONNECTION_CONNECTED, this.connectionConnected); 98 | emitter.on(CONNECTION_DISCONNECTED, this.connectionDisconnected); 99 | emitter.on(ERROR, this.error); 100 | }; 101 | 102 | componentWillUnmount() { 103 | emitter.removeListener(CONNECTION_CONNECTED, this.connectionConnected); 104 | emitter.removeListener(CONNECTION_DISCONNECTED, this.connectionDisconnected); 105 | emitter.removeListener(ERROR, this.error); 106 | }; 107 | 108 | error = (err) => { 109 | this.setState({ loading: false, error: err, metamaskLoading: false, ledgerLoading: false }) 110 | }; 111 | 112 | connectionConnected = () => { 113 | if(this.props.closeModal != null) { 114 | this.props.closeModal() 115 | } 116 | } 117 | 118 | connectionDisconnected = () => { 119 | if(this.props.closeModal != null) { 120 | this.props.closeModal() 121 | } 122 | } 123 | 124 | metamaskUnlocked = () => { 125 | this.setState({ metamaskLoading: false }) 126 | if(this.props.closeModal != null) { 127 | this.props.closeModal() 128 | } 129 | } 130 | 131 | ledgerUnlocked = () => { 132 | this.setState({ ledgerLoading: false }) 133 | if(this.props.closeModal != null) { 134 | this.props.closeModal() 135 | } 136 | } 137 | 138 | cancelLedger = () => { 139 | this.setState({ ledgerLoading: false }) 140 | } 141 | 142 | cancelMetamask = () => { 143 | this.setState({ metamaskLoading: false }) 144 | } 145 | 146 | render() { 147 | const { classes, closeModal, t } = this.props; 148 | 149 | return ( 150 |
151 |
152 |
153 | 154 | 155 | 156 |
157 |
158 | ) 159 | }; 160 | } 161 | 162 | function getLibrary(provider) { 163 | 164 | const library = new Web3Provider(provider); 165 | library.pollingInterval = 8000; 166 | return library; 167 | } 168 | 169 | function onConnectionClicked(currentConnector, name, setActivatingConnector, activate) { 170 | const connectorsByName = store.getStore('connectorsByName') 171 | setActivatingConnector(currentConnector); 172 | activate(connectorsByName[name]); 173 | } 174 | 175 | function onDeactivateClicked(deactivate, connector) { 176 | if(deactivate) { 177 | deactivate() 178 | } 179 | if(connector && connector.close) { 180 | connector.close() 181 | } 182 | store.setStore({ account: { }, web3context: null }) 183 | emitter.emit(CONNECTION_DISCONNECTED) 184 | } 185 | 186 | function MyComponent(props) { 187 | 188 | const context = useWeb3React(); 189 | const localContext = store.getStore('web3context'); 190 | var localConnector = null; 191 | if (localContext) { 192 | localConnector = localContext.connector 193 | } 194 | const { 195 | connector, 196 | library, 197 | account, 198 | activate, 199 | deactivate, 200 | active, 201 | error 202 | } = context; 203 | var connectorsByName = store.getStore('connectorsByName') 204 | 205 | const { closeModal, t } = props 206 | 207 | const [activatingConnector, setActivatingConnector] = React.useState(); 208 | React.useEffect(() => { 209 | if (activatingConnector && activatingConnector === connector) { 210 | setActivatingConnector(undefined); 211 | } 212 | }, [activatingConnector, connector]); 213 | 214 | React.useEffect(() => { 215 | if (account && active && library) { 216 | store.setStore({ account: { address: account }, web3context: context }) 217 | emitter.emit(CONNECTION_CONNECTED) 218 | } 219 | }, [account, active, closeModal, context, library]); 220 | 221 | // React.useEffect(() => { 222 | // if (storeContext && storeContext.active && !active) { 223 | // console.log("we are deactive: "+storeContext.account) 224 | // store.setStore({ account: {}, web3context: null }) 225 | // } 226 | // }, [active, storeContext]); 227 | 228 | // handle logic to eagerly connect to the injected ethereum provider, if it exists and has granted access already 229 | const triedEager = useEagerConnect(); 230 | 231 | // handle logic to connect in reaction to certain events on the injected ethereum provider, if it exists 232 | useInactiveListener(!triedEager || !!activatingConnector); 233 | const width = window.innerWidth 234 | 235 | return ( 236 |
650 ? 'space-between' : 'center'), alignItems: 'center' }}> 237 | {Object.keys(connectorsByName).map(name => { 238 | const currentConnector = connectorsByName[name]; 239 | const activating = currentConnector === activatingConnector; 240 | const connected = (currentConnector === connector||currentConnector === localConnector); 241 | const disabled = 242 | !triedEager || !!activatingConnector || !!error; 243 | 244 | var url; 245 | var display = name; 246 | if (name === 'MetaMask') { 247 | url = require('../../assets/icn-metamask.svg') 248 | } else if (name === 'WalletConnect') { 249 | url = require('../../assets/walletConnectIcon.svg') 250 | } else if (name === 'TrustWallet') { 251 | url = require('../../assets/trustWallet.png') 252 | } else if (name === 'Portis') { 253 | url = require('../../assets/portisIcon.png') 254 | } else if (name === 'Fortmatic') { 255 | url = require('../../assets/fortmaticIcon.png') 256 | } else if (name === 'Ledger') { 257 | url = require('../../assets/icn-ledger.svg') 258 | } else if (name === 'Squarelink') { 259 | url = require('../../assets/squarelink.png') 260 | } else if (name === 'Trezor') { 261 | url = require('../../assets/trezor.png') 262 | } else if (name === 'Torus') { 263 | url = require('../../assets/torus.jpg') 264 | } else if (name === 'Authereum') { 265 | url = require('../../assets/icn-aethereum.svg') 266 | } else if (name === 'WalletLink') { 267 | display = 'Coinbase Wallet' 268 | url = require('../../assets/coinbaseWalletIcon.svg') 269 | } else if (name === 'Frame') { 270 | return '' 271 | } 272 | 273 | return ( 274 |
275 | 313 |
314 | ) 315 | }) } 316 | 317 |
318 | 339 |
340 |
341 | ) 342 | 343 | } 344 | 345 | export default withNamespaces()(withRouter(withStyles(styles)(Unlock))); 346 | -------------------------------------------------------------------------------- /src/assets/walletConnectIcon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/components/pool/deposit/deposit.jsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from "react"; 2 | import { withRouter } from "react-router-dom"; 3 | import { withStyles } from '@material-ui/core/styles'; 4 | import { 5 | Card, 6 | Typography, 7 | Button, 8 | InputAdornment, 9 | TextField 10 | } from '@material-ui/core'; 11 | 12 | import Loader from '../../loader' 13 | import Snackbar from '../../snackbar' 14 | 15 | import { colors } from '../../../theme' 16 | 17 | import { 18 | ERROR, 19 | GET_POOL_BALANCES, 20 | POOL_BALANCES_RETURNED, 21 | DEPOSIT_POOL, 22 | DEPOSIT_POOL_RETURNED, 23 | GET_DEPOSIT_PRICE, 24 | DEPOSIT_PRICE_RETURNED, 25 | GET_WITHDRAW_PRICE, 26 | WITHDRAW_PRICE_RETURNED, 27 | } from '../../../constants' 28 | 29 | import { withNamespaces } from 'react-i18next'; 30 | import Store from "../../../stores"; 31 | const emitter = Store.emitter 32 | const dispatcher = Store.dispatcher 33 | const store = Store.store 34 | 35 | const styles = theme => ({ 36 | root: { 37 | flex: 1, 38 | display: 'flex', 39 | flexDirection: 'column', 40 | maxWidth: '1200px', 41 | width: '100%', 42 | justifyContent: 'flex-start', 43 | alignItems: 'center' 44 | }, 45 | introText: { 46 | flex: 1 47 | }, 48 | intro: { 49 | width: '100%', 50 | position: 'relative', 51 | display: 'flex', 52 | justifyContent: 'center', 53 | alignItems: 'center', 54 | }, 55 | introCenter: { 56 | minWidth: '100%', 57 | textAlign: 'center', 58 | padding: '48px 0px' 59 | }, 60 | investedContainer: { 61 | display: 'flex', 62 | flex: 1, 63 | flexDirection: 'column', 64 | alignItems: 'center', 65 | justifyContent: 'center', 66 | padding: '12px', 67 | minWidth: '100%', 68 | [theme.breakpoints.up('md')]: { 69 | minWidth: '800px', 70 | } 71 | }, 72 | connectContainer: { 73 | padding: '12px', 74 | display: 'flex', 75 | justifyContent: 'center', 76 | width: '100%', 77 | maxWidth: '450px', 78 | [theme.breakpoints.up('md')]: { 79 | width: '450', 80 | } 81 | }, 82 | actionButton: { 83 | '&:hover': { 84 | backgroundColor: "#2F80ED", 85 | }, 86 | padding: '12px', 87 | backgroundColor: "#2F80ED", 88 | borderRadius: '1rem', 89 | border: '1px solid #E1E1E1', 90 | fontWeight: 500, 91 | [theme.breakpoints.up('md')]: { 92 | padding: '15px', 93 | } 94 | }, 95 | buttonText: { 96 | fontWeight: '700', 97 | color: 'white', 98 | }, 99 | disaclaimer: { 100 | padding: '12px', 101 | border: '1px solid rgb(174, 174, 174)', 102 | borderRadius: '0.75rem', 103 | marginBottom: '24px', 104 | }, 105 | aUSDCard: { 106 | display: 'flex', 107 | justifyContent: 'space-between', 108 | overflow: 'hidden', 109 | flex: 1, 110 | whiteSpace: 'nowrap', 111 | fontSize: '0.83rem', 112 | padding: '28px 30px', 113 | borderRadius: '50px', 114 | border: '1px solid '+colors.borderBlue, 115 | alignItems: 'center', 116 | maxWidth: '500px', 117 | marginTop: '40px', 118 | background: colors.white, 119 | [theme.breakpoints.up('md')]: { 120 | width: '100%' 121 | } 122 | }, 123 | aUSDBalance: { 124 | display: 'flex', 125 | alignItems: 'center' 126 | }, 127 | addressContainer: { 128 | display: 'flex', 129 | justifyContent: 'space-between', 130 | overflow: 'hidden', 131 | flex: 1, 132 | whiteSpace: 'nowrap', 133 | fontSize: '0.83rem', 134 | textOverflow:'ellipsis', 135 | cursor: 'pointer', 136 | padding: '28px 30px', 137 | borderRadius: '50px', 138 | border: '1px solid '+colors.borderBlue, 139 | alignItems: 'center', 140 | maxWidth: '500px', 141 | [theme.breakpoints.up('md')]: { 142 | width: '100%' 143 | } 144 | }, 145 | card: { 146 | width: '100%', 147 | display: 'flex', 148 | flexWrap: 'wrap', 149 | maxWidth: '800px', 150 | justifyContent: 'center', 151 | flexDirection: 'column', 152 | alignItems: 'center', 153 | }, 154 | inputContainer: { 155 | flex: 1, 156 | display: 'flex', 157 | flexWrap: 'wrap', 158 | padding: '42px 30px', 159 | borderRadius: '50px', 160 | flexDirection: 'column', 161 | justifyContent: 'flex-start', 162 | alignItems: 'center', 163 | margin: '40px 0px', 164 | border: '1px solid '+colors.borderBlue, 165 | minWidth: '500px', 166 | }, 167 | actionInput: { 168 | padding: '0px 0px 12px 0px', 169 | fontSize: '0.5rem' 170 | }, 171 | inputAdornment: { 172 | fontWeight: '600', 173 | fontSize: '1.5rem' 174 | }, 175 | assetIcon: { 176 | display: 'inline-block', 177 | verticalAlign: 'middle', 178 | borderRadius: '25px', 179 | background: '#dedede', 180 | height: '30px', 181 | width: '30px', 182 | textAlign: 'center', 183 | marginRight: '16px' 184 | }, 185 | balances: { 186 | width: '100%', 187 | textAlign: 'right', 188 | paddingRight: '20px', 189 | cursor: 'pointer' 190 | }, 191 | title: { 192 | paddingRight: '24px' 193 | }, 194 | value: { 195 | cursor: 'pointer' 196 | }, 197 | valContainer: { 198 | display: 'flex', 199 | flexDirection: 'column', 200 | width: '100%' 201 | }, 202 | inputCardHeading: { 203 | width: '100%', 204 | color: colors.darkGray 205 | }, 206 | placceholder: { 207 | marginBottom: '12px' 208 | }, 209 | ratios: { 210 | marginBottom: '12px' 211 | }, 212 | idealHolder: { 213 | display: 'flex' 214 | }, 215 | disabledAdornment: { 216 | color: 'rgb(170, 170, 170)' 217 | }, 218 | walletAddress: { 219 | padding: '0px 12px' 220 | }, 221 | walletTitle: { 222 | flex: 1, 223 | color: colors.darkGray 224 | }, 225 | }); 226 | 227 | class Deposit extends Component { 228 | 229 | constructor() { 230 | super() 231 | 232 | const account = store.getStore('account') 233 | const assets = store.getStore('assets') 234 | 235 | this.state = { 236 | loading: !assets, 237 | account: account, 238 | assets: assets ? assets.filter((asset) => { return asset.balance > 0 }) : null, 239 | } 240 | } 241 | 242 | componentWillMount() { 243 | emitter.on(ERROR, this.errorReturned); 244 | emitter.on(POOL_BALANCES_RETURNED, this.balancesReturned); 245 | emitter.on(DEPOSIT_POOL_RETURNED, this.depositPoolReturned); 246 | } 247 | 248 | componentWillUnmount() { 249 | emitter.removeListener(ERROR, this.errorReturned); 250 | emitter.removeListener(POOL_BALANCES_RETURNED, this.balancesReturned); 251 | emitter.removeListener(DEPOSIT_POOL_RETURNED, this.depositPoolReturned); 252 | }; 253 | 254 | depositPoolReturned = (txHash) => { 255 | this.setState({ snackbarMessage: null, snackbarType: null, loading: false }) 256 | const that = this 257 | setTimeout(() => { 258 | const snackbarObj = { snackbarMessage: txHash, snackbarType: 'Hash' } 259 | that.setState(snackbarObj) 260 | }) 261 | }; 262 | 263 | balancesReturned = (balances) => { 264 | const assets = store.getStore('assets') 265 | this.setState({ 266 | loading: false, 267 | assets: assets ? assets.filter((asset) => { return asset.balance > 0 }) : null 268 | }) 269 | }; 270 | 271 | errorReturned = (error) => { 272 | const snackbarObj = { snackbarMessage: null, snackbarType: null } 273 | this.setState(snackbarObj) 274 | this.setState({ loading: false }) 275 | const that = this 276 | setTimeout(() => { 277 | const snackbarObj = { snackbarMessage: error.toString(), snackbarType: 'Error' } 278 | that.setState(snackbarObj) 279 | }) 280 | }; 281 | 282 | render() { 283 | const { classes, t } = this.props; 284 | const { 285 | account, 286 | assets, 287 | loading, 288 | snackbarMessage 289 | } = this.state 290 | 291 | var address = null; 292 | if (account && account.address) { 293 | address = account.address.substring(0,6)+'...'+account.address.substring(account.address.length-4,account.address.length) 294 | } 295 | 296 | return ( 297 |
298 |
299 | This project is in beta. Use at your own risk. 300 |
301 | 302 | Wallet 303 | { address } 304 |
305 |
306 |
307 | {/*
308 |
309 | 314 |
315 | { aUSD.name } 316 |
317 | { aUSD.balance } 318 | { aUSD.symbol } 319 |
320 |
*/} 321 |
322 | 323 | { !assets && 324 | Loading assets ... 325 | } 326 | { assets && 327 | 328 | { t("PoolDeposit.Deposit") } 329 | { this.renderDepositAssets() } 330 | 340 | 341 | } 342 | 343 |
344 |
345 | { snackbarMessage && this.renderSnackbar() } 346 | { loading && } 347 |
348 | ) 349 | }; 350 | 351 | renderDepositAssets = () => { 352 | const assets = this.state.assets 353 | 354 | return assets.map((asset) => { 355 | return this.renderAssetInput(asset, 'deposit') 356 | }) 357 | } 358 | 359 | renderAssetInput = (asset, type) => { 360 | const { 361 | classes 362 | } = this.props 363 | 364 | const { 365 | loading 366 | } = this.state 367 | 368 | const amount = this.state[asset.id + '_' + type] 369 | const amountError = this.state[asset.id + '_' + type + '_error'] 370 | 371 | return ( 372 |
373 |
374 | { this.setAmount(asset.id, type, (asset ? asset.balance : 0)) } } className={ classes.value } noWrap>{ 'Balance: '+ ( asset && asset.balance ? (Math.floor(asset.balance*10000)/10000).toFixed(4) : '0.0000') } { asset ? asset.symbol : '' } 375 |
376 |
377 | { asset.symbol }, 389 | startAdornment: 390 |
391 | 396 |
397 |
, 398 | }} 399 | /> 400 |
401 |
402 | ) 403 | } 404 | 405 | onDeposit = () => { 406 | this.setState({ amountError: false }) 407 | let state = this.state 408 | 409 | const sendAssets = state.assets.map((asset) => { 410 | asset.amount = state[asset.id + '_deposit'] 411 | if(asset.amount == null || asset.amount === '') { 412 | asset.amount = 0 413 | } 414 | return asset 415 | }).filter((asset) => { 416 | return asset.amount > 0 417 | }) 418 | 419 | if(sendAssets.length > 0) { 420 | this.setState({ loading: true }) 421 | dispatcher.dispatch({ type: DEPOSIT_POOL, content: { assets: sendAssets } }) 422 | } 423 | } 424 | 425 | renderSnackbar = () => { 426 | var { 427 | snackbarType, 428 | snackbarMessage 429 | } = this.state 430 | return 431 | }; 432 | 433 | onChange = (event) => { 434 | let val = [] 435 | val[event.target.id] = event.target.value 436 | this.setState(val) 437 | } 438 | 439 | setAmount = (id, type, balance) => { 440 | const bal = (Math.floor((balance === '' ? '0' : balance)*10000)/10000).toFixed(4) 441 | let val = [] 442 | val[id + '_' + type] = bal 443 | this.setState(val) 444 | } 445 | } 446 | 447 | export default withNamespaces()(withRouter(withStyles(styles)(Deposit))); 448 | -------------------------------------------------------------------------------- /src/components/pool/withdraw/withdraw.jsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from "react"; 2 | import { withRouter } from "react-router-dom"; 3 | import { withStyles } from '@material-ui/core/styles'; 4 | import { 5 | Card, 6 | Typography, 7 | Button, 8 | InputAdornment, 9 | TextField 10 | } from '@material-ui/core'; 11 | 12 | import Loader from '../../loader' 13 | import UnlockModal from '../../unlock/unlockModal.jsx' 14 | import Snackbar from '../../snackbar' 15 | import { colors } from '../../../theme' 16 | 17 | import { 18 | ERROR, 19 | GET_POOL_BALANCES, 20 | POOL_BALANCES_RETURNED, 21 | CONNECTION_CONNECTED, 22 | CONNECTION_DISCONNECTED, 23 | WITHDRAW_POOL, 24 | WITHDRAW_POOL_RETURNED, 25 | GET_WITHDRAW_PRICE, 26 | WITHDRAW_PRICE_RETURNED, 27 | } from '../../../constants' 28 | 29 | import { withNamespaces } from 'react-i18next'; 30 | import Store from "../../../stores"; 31 | const emitter = Store.emitter 32 | const dispatcher = Store.dispatcher 33 | const store = Store.store 34 | 35 | const styles = theme => ({ 36 | root: { 37 | flex: 1, 38 | display: 'flex', 39 | flexDirection: 'column', 40 | maxWidth: '1200px', 41 | width: '100%', 42 | justifyContent: 'flex-start', 43 | alignItems: 'center' 44 | }, 45 | introText: { 46 | flex: 1 47 | }, 48 | intro: { 49 | width: '100%', 50 | position: 'relative', 51 | display: 'flex', 52 | justifyContent: 'center', 53 | alignItems: 'center', 54 | }, 55 | introCenter: { 56 | minWidth: '100%', 57 | textAlign: 'center', 58 | padding: '48px 0px' 59 | }, 60 | investedContainer: { 61 | display: 'flex', 62 | flex: 1, 63 | flexDirection: 'column', 64 | alignItems: 'center', 65 | justifyContent: 'center', 66 | padding: '12px', 67 | minWidth: '100%', 68 | [theme.breakpoints.up('md')]: { 69 | minWidth: '800px', 70 | } 71 | }, 72 | connectContainer: { 73 | padding: '12px', 74 | display: 'flex', 75 | justifyContent: 'center', 76 | width: '100%', 77 | maxWidth: '450px', 78 | [theme.breakpoints.up('md')]: { 79 | width: '450', 80 | } 81 | }, 82 | actionButton: { 83 | '&:hover': { 84 | backgroundColor: "#2F80ED", 85 | }, 86 | padding: '12px', 87 | backgroundColor: "#2F80ED", 88 | borderRadius: '1rem', 89 | border: '1px solid #E1E1E1', 90 | fontWeight: 500, 91 | [theme.breakpoints.up('md')]: { 92 | padding: '15px', 93 | } 94 | }, 95 | buttonText: { 96 | fontWeight: '700', 97 | color: 'white', 98 | }, 99 | disaclaimer: { 100 | padding: '12px', 101 | border: '1px solid rgb(174, 174, 174)', 102 | borderRadius: '0.75rem', 103 | marginBottom: '24px', 104 | }, 105 | addressContainer: { 106 | display: 'flex', 107 | justifyContent: 'space-between', 108 | overflow: 'hidden', 109 | flex: 1, 110 | whiteSpace: 'nowrap', 111 | fontSize: '0.83rem', 112 | textOverflow:'ellipsis', 113 | cursor: 'pointer', 114 | padding: '28px 30px', 115 | borderRadius: '50px', 116 | border: '1px solid '+colors.borderBlue, 117 | alignItems: 'center', 118 | maxWidth: '500px', 119 | [theme.breakpoints.up('md')]: { 120 | width: '100%' 121 | } 122 | }, 123 | card: { 124 | width: '100%', 125 | display: 'flex', 126 | flexWrap: 'wrap', 127 | maxWidth: '800px', 128 | justifyContent: 'center', 129 | flexDirection: 'column', 130 | alignItems: 'center', 131 | }, 132 | inputContainer: { 133 | flex: 1, 134 | display: 'flex', 135 | flexWrap: 'wrap', 136 | padding: '42px 30px', 137 | borderRadius: '50px', 138 | flexDirection: 'column', 139 | justifyContent: 'flex-start', 140 | alignItems: 'center', 141 | margin: '40px 0px', 142 | border: '1px solid '+colors.borderBlue, 143 | minWidth: '500px', 144 | }, 145 | actionInput: { 146 | padding: '0px 0px 12px 0px', 147 | fontSize: '0.5rem' 148 | }, 149 | inputAdornment: { 150 | fontWeight: '600', 151 | fontSize: '1.5rem' 152 | }, 153 | assetIcon: { 154 | display: 'inline-block', 155 | verticalAlign: 'middle', 156 | borderRadius: '25px', 157 | background: '#dedede', 158 | height: '30px', 159 | width: '30px', 160 | textAlign: 'center', 161 | marginRight: '16px' 162 | }, 163 | balances: { 164 | width: '100%', 165 | textAlign: 'right', 166 | paddingRight: '20px', 167 | cursor: 'pointer' 168 | }, 169 | title: { 170 | paddingRight: '24px' 171 | }, 172 | value: { 173 | cursor: 'pointer' 174 | }, 175 | valContainer: { 176 | display: 'flex', 177 | flexDirection: 'column', 178 | width: '100%' 179 | }, 180 | inputCardHeading: { 181 | width: '100%', 182 | color: colors.darkGray 183 | }, 184 | placceholder: { 185 | marginBottom: '12px' 186 | }, 187 | ratios: { 188 | marginBottom: '12px' 189 | }, 190 | idealHolder: { 191 | display: 'flex' 192 | }, 193 | disabledAdornment: { 194 | color: 'rgb(170, 170, 170)' 195 | }, 196 | walletAddress: { 197 | padding: '0px 12px' 198 | }, 199 | walletTitle: { 200 | flex: 1, 201 | color: colors.darkGray 202 | }, 203 | aUSDCard: { 204 | display: 'flex', 205 | justifyContent: 'space-between', 206 | overflow: 'hidden', 207 | flex: 1, 208 | whiteSpace: 'nowrap', 209 | fontSize: '0.83rem', 210 | padding: '28px 30px', 211 | borderRadius: '50px', 212 | border: '1px solid '+colors.borderBlue, 213 | alignItems: 'center', 214 | maxWidth: '500px', 215 | marginTop: '40px', 216 | background: colors.white, 217 | [theme.breakpoints.up('md')]: { 218 | width: '100%' 219 | } 220 | }, 221 | aUSDBalance: { 222 | display: 'flex', 223 | alignItems: 'center' 224 | }, 225 | }); 226 | 227 | class Withdraw extends Component { 228 | 229 | constructor() { 230 | super() 231 | 232 | const account = store.getStore('account') 233 | const assets = store.getStore('assets') 234 | 235 | this.state = { 236 | loading: !assets, 237 | account: account, 238 | assets: assets.filter((asset) => { return asset.uniBalance > 0 }) 239 | } 240 | } 241 | 242 | componentWillMount() { 243 | emitter.on(ERROR, this.errorReturned); 244 | emitter.on(POOL_BALANCES_RETURNED, this.balancesReturned); 245 | emitter.on(WITHDRAW_POOL_RETURNED, this.withdrawPoolReturned); 246 | } 247 | 248 | componentWillUnmount() { 249 | emitter.removeListener(ERROR, this.errorReturned); 250 | emitter.removeListener(POOL_BALANCES_RETURNED, this.balancesReturned); 251 | emitter.removeListener(WITHDRAW_POOL_RETURNED, this.withdrawPoolReturned); 252 | }; 253 | 254 | withdrawPoolReturned = (txHash) => { 255 | this.setState({ snackbarMessage: null, snackbarType: null, loading: false }) 256 | const that = this 257 | setTimeout(() => { 258 | const snackbarObj = { snackbarMessage: txHash, snackbarType: 'Hash' } 259 | that.setState(snackbarObj) 260 | }) 261 | }; 262 | 263 | balancesReturned = (balances) => { 264 | this.setState({ 265 | assets: store.getStore('assets').filter((asset) => { return asset.uniBalance > 0 }), 266 | loading: false 267 | }) 268 | }; 269 | 270 | errorReturned = (error) => { 271 | const snackbarObj = { snackbarMessage: null, snackbarType: null } 272 | this.setState(snackbarObj) 273 | this.setState({ loading: false }) 274 | const that = this 275 | setTimeout(() => { 276 | const snackbarObj = { snackbarMessage: error.toString(), snackbarType: 'Error' } 277 | that.setState(snackbarObj) 278 | }) 279 | }; 280 | 281 | render() { 282 | const { classes, t } = this.props; 283 | const { 284 | account, 285 | loading, 286 | modalOpen, 287 | snackbarMessage, 288 | amount, 289 | assets, 290 | } = this.state 291 | 292 | var address = null; 293 | if (account.address) { 294 | address = account.address.substring(0,6)+'...'+account.address.substring(account.address.length-4,account.address.length) 295 | } 296 | 297 | return ( 298 |
299 |
300 | This project is in beta. Use at your own risk. 301 |
302 | 303 | Wallet 304 | { address } 305 |
306 |
307 |
308 | {/*
309 |
310 | 315 |
316 | { aUSD.name } 317 |
318 | { aUSD.balance } 319 | { aUSD.symbol } 320 |
321 |
*/} 322 | 323 | { !assets && 324 | Loading assets ... 325 | } 326 | { assets && 327 | 328 | { t("PoolWithdraw.Withdraw") } 329 | { this.renderWithdrawAssets() } 330 | 340 | 341 | } 342 | 343 |
344 | { modalOpen && this.renderModal() } 345 | { snackbarMessage && this.renderSnackbar() } 346 | { loading && } 347 |
348 | ) 349 | }; 350 | 351 | onWithdraw = () => { 352 | this.setState({ amountError: false }) 353 | let state = this.state 354 | 355 | const sendAssets = state.assets.map((asset) => { 356 | asset.amount = state[asset.id + '_withdraw'] 357 | if(asset.amount == null || asset.amount === '') { 358 | asset.amount = 0 359 | } 360 | return asset 361 | }).filter((asset) => { 362 | return asset.amount > 0 363 | }) 364 | 365 | if(sendAssets.length > 0) { 366 | this.setState({ loading: true }) 367 | dispatcher.dispatch({ type: WITHDRAW_POOL, content: { assets: sendAssets } }) 368 | } 369 | } 370 | 371 | renderModal = () => { 372 | return ( 373 | 374 | ) 375 | } 376 | 377 | renderSnackbar = () => { 378 | var { 379 | snackbarType, 380 | snackbarMessage 381 | } = this.state 382 | return 383 | }; 384 | 385 | overlayClicked = () => { 386 | this.setState({ modalOpen: true }) 387 | } 388 | 389 | closeModal = () => { 390 | this.setState({ modalOpen: false }) 391 | } 392 | 393 | onChange = (event) => { 394 | let val = [] 395 | val[event.target.id] = event.target.value 396 | this.setState(val) 397 | }; 398 | 399 | renderWithdrawAssets = () => { 400 | const assets = this.state.assets 401 | 402 | return assets.map((asset) => { 403 | return this.renderAssetInput(asset, 'withdraw') 404 | }) 405 | } 406 | 407 | renderAssetInput = (asset, type) => { 408 | const { 409 | classes 410 | } = this.props 411 | 412 | const { 413 | loading 414 | } = this.state 415 | 416 | const amount = this.state[asset.id + '_' + type] 417 | const amountError = this.state[asset.id + '_' + type + '_error'] 418 | 419 | return ( 420 |
421 |
422 | { this.setAmount(asset.id, type, (asset ? asset.uniBalance : 0)) } } className={ classes.value } noWrap>{ 'Balance: '+ ( asset && asset.uniBalance ? (Math.floor(asset.uniBalance*10000)/10000).toFixed(4) : '0.0000') } { asset ? (asset.symbol+'UNI') : '' } 423 |
424 |
425 | { (asset.symbol+'UNI') }, 437 | startAdornment: 438 |
439 | 444 |
445 |
, 446 | }} 447 | /> 448 |
449 |
450 | ) 451 | } 452 | 453 | setAmount = (id, type, balance) => { 454 | const bal = (Math.floor((balance === '' ? '0' : balance)*10000)/10000).toFixed(4) 455 | let val = [] 456 | val[id + '_' + type] = bal 457 | this.setState(val) 458 | } 459 | 460 | } 461 | 462 | export default withNamespaces()(withRouter(withStyles(styles)(Withdraw))); 463 | --------------------------------------------------------------------------------