diff --git a/.eslintrc.js b/.eslintrc.js index 7685bc4..a01630d 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -69,7 +69,7 @@ module.exports = { "property" ], "dot-notation": "off", - "eol-last": "error", + "eol-last": 1, "eqeqeq": "error", "for-direction": "error", "func-call-spacing": "error", @@ -93,10 +93,7 @@ module.exports = { "jsx-quotes": "error", "key-spacing": "off", "keyword-spacing": "off", - "linebreak-style": [ - "error", - "unix" - ], + "linebreak-style": 0, "line-comment-position": "off", "lines-around-comment": "error", "lines-around-directive": "error", @@ -186,7 +183,7 @@ module.exports = { "no-restricted-properties": "error", "no-restricted-syntax": "error", "no-return-assign": "error", - "no-return-await": "error", + "no-return-await": 1, "no-script-url": "error", "no-self-compare": "error", "no-sequences": "error", @@ -244,19 +241,12 @@ module.exports = { "prefer-rest-params": "off", "prefer-spread": "off", "prefer-template": "off", - "quotes": [ - "error", - "single" - ], + "quotes": 0, "quote-props": "off", "radix": "error", "require-await": "off", "require-jsdoc": "off", "rest-spread-spacing": "error", - "semi": [ - "error", - "never" - ], "semi-spacing": [ "error", { @@ -310,6 +300,7 @@ module.exports = { "react/jsx-uses-vars": 1, "react/react-in-jsx-scope": 1, "react/prefer-es6-class": 1, - "react/jsx-no-bind": 1 + "react/jsx-no-bind": 1, + "react/prop-types": 1, } }; diff --git a/.gitignore b/.gitignore index ac2c155..15fee29 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,27 @@ __pycache__ .idea *.iml + + +.embark +chains.json +config/production/password +config/livenet/password +config/development/devpassword +config/development/password +config/privatenet/password +config/testnet/password +coverage +dist +build/ +lib/ +node_modules/ +.DS_Store +embarkArtifacts + +.mypy_cache +__pycache__ + +.idea +*.iml + diff --git a/README.md b/README.md index f2dd59e..1638cab 100644 --- a/README.md +++ b/README.md @@ -16,10 +16,15 @@ Welcome to the code for the liquid-funding dapp which uses the liquidpledging co ### Install 1) `npm install` -2) `npm -g install embark@4.0.0-alpha.2` +2) `npm -g install embark` 3) For development `embark run` or `embark run {network}` + * There is an issue with the dev environment because of the contract size + * Using `embark run rinkeby` works + * You will need to either have a synced Geth node with Rinkeby (automatically started by Embark) + * Add a `deployment` section to the contract config in `embarkConfig/contracts.js` ([example using Infura](https://embark.status.im/docs/contracts_deployment.html#Deploying-to-Infura)) +4) To start the CRA pipeline `npm run start` ### Requirements [NodeJS](https://nodejs.org/) (v8.4.0 or higher) [npm](https://www.npmjs.com/) (5.4.1 or higher) -[Embark](https://embark.status.im/) (v4.0.0-alpha 2) +[Embark](https://embark.status.im/) (v4.0.0 or higher) diff --git a/app/components/MainCointainer.jsx b/app/components/MainCointainer.jsx deleted file mode 100644 index 8ccdd79..0000000 --- a/app/components/MainCointainer.jsx +++ /dev/null @@ -1,227 +0,0 @@ -import React, { useContext, useState } from 'react'; -import { HashRouter as Router, Route, Link, Switch } from 'react-router-dom' -import PropTypes from 'prop-types'; -import classNames from 'classnames'; -import { withStyles } from '@material-ui/core/styles' -import Drawer from '@material-ui/core/Drawer' -import Button from '@material-ui/core/Button' -import CssBaseline from '@material-ui/core/CssBaseline' -import AppBar from '@material-ui/core/AppBar' -import Toolbar from '@material-ui/core/Toolbar' -import List from '@material-ui/core/List' -import Typography from '@material-ui/core/Typography' -import Divider from '@material-ui/core/Divider' -import IconButton from '@material-ui/core/IconButton' -import MenuIcon from '@material-ui/icons/Menu' -import ChevronLeftIcon from '@material-ui/icons/ChevronLeft' -import ChevronRightIcon from '@material-ui/icons/ChevronRight' -import ListItem from '@material-ui/core/ListItem' -import ListItemIcon from '@material-ui/core/ListItemIcon' -import ListItemText from '@material-ui/core/ListItemText' -import InboxIcon from '@material-ui/icons/MoveToInbox' -import { ScaleLoader } from 'react-spinners' -import FundsManagement from './FundsManagement' -import ContractAdmin from './ContractAdmin' -import TransferGraph from './TransfersGraph' -import Dashboard from './Dashboard' -import Project from './projects/Project' -import BackProject from './projects/BackProject' -import CreateProject from './projects/CreateProject' -import { FundingContext } from '../context' - -const drawerWidth = 240 - -const styles = theme => ({ - root: { - display: 'flex', - }, - appBar: { - transition: theme.transitions.create(['margin', 'width'], { - easing: theme.transitions.easing.sharp, - duration: theme.transitions.duration.leavingScreen, - }), - }, - appBarShift: { - width: `calc(100% - ${drawerWidth}px)`, - marginLeft: drawerWidth, - transition: theme.transitions.create(['margin', 'width'], { - easing: theme.transitions.easing.easeOut, - duration: theme.transitions.duration.enteringScreen, - }), - }, - appBarBg: { - backgroundColor: '#111735' - }, - menuButton: { - marginLeft: 12, - marginRight: 20, - }, - hide: { - display: 'none', - }, - drawer: { - width: drawerWidth, - flexShrink: 0, - }, - drawerPaper: { - width: drawerWidth, - }, - drawerHeader: { - display: 'flex', - alignItems: 'center', - padding: '0 8px', - ...theme.mixins.toolbar, - justifyContent: 'flex-end', - }, - content: { - flexGrow: 1, - padding: theme.spacing.unit * 3, - transition: theme.transitions.create('margin', { - easing: theme.transitions.easing.sharp, - duration: theme.transitions.duration.leavingScreen, - }), - marginLeft: -drawerWidth, - }, - contentShift: { - transition: theme.transitions.create('margin', { - easing: theme.transitions.easing.easeOut, - duration: theme.transitions.duration.enteringScreen, - }), - marginLeft: 0, - }, - link: { - textDecoration: 'none' - }, - networkButton: { - color: '#ffeb3b' - } -}) - -function PersistentDrawerLeft({ classes, children, theme, loading }) { - const [open, setOpen] = useState(false) - const context = useContext(FundingContext) - const { network, environment } = context - const correctNetwork = network === environment - - const handleDrawerOpen = () => { - setOpen(true) - } - - const handleDrawerClose = () => { - setOpen(false) - } - - return ( -
- - - - - {loading - ? - : } - - - Liquid Funding - - - - - -
- - {theme.direction === 'ltr' ? : } - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
- - - - } /> - - - } /> - - - {children} -
-
-
- ); -} - -PersistentDrawerLeft.propTypes = { - classes: PropTypes.object.isRequired, - children: PropTypes.object.isRequired, - theme: PropTypes.object.isRequired, - loading: PropTypes.bool.isRequired -}; - -export default withStyles(styles, { withTheme: true })(PersistentDrawerLeft) diff --git a/app/components/dashboard/FundingSummary.jsx b/app/components/dashboard/FundingSummary.jsx deleted file mode 100644 index 9e4e0b4..0000000 --- a/app/components/dashboard/FundingSummary.jsx +++ /dev/null @@ -1,131 +0,0 @@ -import React from 'react' -import PropTypes from 'prop-types' -import withObservables from '@nozbe/with-observables' -import { Q } from '@nozbe/watermelondb' -import { withDatabase } from '@nozbe/watermelondb/DatabaseProvider' -import { withStyles } from '@material-ui/core/styles' -import Card from '@material-ui/core/Card' -import CardContent from '@material-ui/core/CardContent' -import Typography from '@material-ui/core/Typography' -import LinearProgress from '@material-ui/core/LinearProgress' -import { getDepositWithdrawTotals, getPledgesWaitingCommit } from '../../selectors/pledging' -import { getTokenAddress } from '../../utils/currencies' - -const styles = { - card: { - minWidth: 275, - }, - cardTitle: { - paddingBottom: '1rem' - }, - fundingSummaries: { - display: 'flex', - flexDirection: 'column', - alignItems: 'center' - }, - bullet: { - display: 'inline-block', - margin: '0 2px', - transform: 'scale(0.8)', - }, - title: { - fontSize: 14, - }, - pos: { - marginBottom: 12, - }, - linearColorPrimary: { - backgroundColor: '#b2dfdb', - }, - linearBarColorPrimary: { - backgroundColor: '#00695c', - }, - titleText: { - textAlign: 'center', - paddingTop: '2rem' - } -} - -const getNet = (deposits, withdraws) => Number(deposits) - Number(withdraws) -const getValue = (deposits, withdraws) => (getNet(deposits, withdraws) / Number(deposits)) * 100 -function SimpleCard(props) { - const { classes, title, transfers, pledges, vaultEvents } = props - - return ( - - - - {title} - - {!!transfers && !!pledges.length && - Object.entries(getDepositWithdrawTotals({ transfers, pledges, vaultEvents })) - .map(token => { - const [name, amounts] = token - const { deposits, withdraws } = amounts - const address = getTokenAddress(name) - const pledgesForCommit = getPledgesWaitingCommit({ pledges }).filter(p => p.token == address) - return ( - - - {name} - - - - {Number(deposits) - Number(withdraws || 0)} - - - Remaining In Pledges - - - {deposits} - - - Funded - - - {withdraws || 0} - - - Withdrawn - - - {pledgesForCommit.length} - - - Pledges that can be vetoed / approved - - - - - ) - })} - - - ) -} - -SimpleCard.propTypes = { - classes: PropTypes.object.isRequired, - title: PropTypes.string, - pledges: PropTypes.array.isRequired, - transfers: PropTypes.array.isRequired, - vaultEvents: PropTypes.array.isRequired -} - -const styledCard = withStyles(styles)(SimpleCard) -export default withDatabase(withObservables([], ({ database }) => ({ - transfers: database.collections.get('lp_events').query( - Q.where('event', 'Transfer') - ).observe(), - vaultEvents : database.collections.get('vault_events').query().observe() -}))(styledCard)) - diff --git a/app/components/image/ImageViewer.jsx b/app/components/image/ImageViewer.jsx deleted file mode 100644 index f033a56..0000000 --- a/app/components/image/ImageViewer.jsx +++ /dev/null @@ -1,21 +0,0 @@ -import React from 'react' - -const docType = doc => { - const suffix = doc.name.split('.') - return suffix.slice(-1)[0] -} - -export default ({ status }) => { - return ( -
- {status && status.profileImg && -
- {['jpg', 'gif', 'png'].includes(docType(status.profileImg)) && - ipfs} - {docType(status.profileImg) === 'pdf' && -