Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Commit

Permalink
Merge pull request #39 from gnosis/development
Browse files Browse the repository at this point in the history
WA-234 & WA-235 - Threshold modifications & Add owners
  • Loading branch information
apanizo authored Jun 8, 2018
2 parents 594751b + f2421e5 commit 90920b6
Show file tree
Hide file tree
Showing 63 changed files with 1,090 additions and 237 deletions.
2 changes: 1 addition & 1 deletion config/jest/jest.setup.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// @flow
jest.setTimeout(30000)
jest.setTimeout(45000)
8 changes: 7 additions & 1 deletion safe-contracts/build/contracts/CreateAndAddModules.json
Original file line number Diff line number Diff line change
Expand Up @@ -1276,8 +1276,14 @@
"links": {},
"address": "0x5fd674bc2873513f8e5a19d69637d0211e476380",
"transactionHash": "0x288775644c087eed5e41b96fecebdb23be4e6d40bef5b6fb9a2876c2a3145157"
},
"1528296677763": {
"events": {},
"links": {},
"address": "0x194371bd036c34314ded31a7ffe7e66f5461a62d",
"transactionHash": "0x288775644c087eed5e41b96fecebdb23be4e6d40bef5b6fb9a2876c2a3145157"
}
},
"schemaVersion": "2.0.0",
"updatedAt": "2018-06-04T10:56:37.138Z"
"updatedAt": "2018-06-06T14:51:43.695Z"
}
8 changes: 7 additions & 1 deletion safe-contracts/build/contracts/DailyLimitModule.json
Original file line number Diff line number Diff line change
Expand Up @@ -6699,8 +6699,14 @@
"links": {},
"address": "0x3bdceb07fddd50d259a059ca9a75ecda561d4afc",
"transactionHash": "0xf501438a4ec967e2928d922e4af568a2a5365002f8b3f9e32117bbacfaa49331"
},
"1528296677763": {
"events": {},
"links": {},
"address": "0x0fb244fb862c95c66250c6c72e7e91a3d41a47d5",
"transactionHash": "0xf501438a4ec967e2928d922e4af568a2a5365002f8b3f9e32117bbacfaa49331"
}
},
"schemaVersion": "2.0.0",
"updatedAt": "2018-06-04T10:56:37.129Z"
"updatedAt": "2018-06-06T14:51:43.688Z"
}
Original file line number Diff line number Diff line change
Expand Up @@ -9864,8 +9864,14 @@
"links": {},
"address": "0x8c55b458a53e8c6e9efa7f54e7be9ca76b43dd9b",
"transactionHash": "0x67117c1452ee2f4b904621b6f30790ff998d1f1a72f11c6b71ef47e3dd254724"
},
"1528296677763": {
"events": {},
"links": {},
"address": "0xc3d42147f9b51c9749d3362e8b9ee6cb94861778",
"transactionHash": "0x67117c1452ee2f4b904621b6f30790ff998d1f1a72f11c6b71ef47e3dd254724"
}
},
"schemaVersion": "2.0.0",
"updatedAt": "2018-06-04T10:56:37.124Z"
"updatedAt": "2018-06-06T14:51:43.672Z"
}
8 changes: 7 additions & 1 deletion safe-contracts/build/contracts/GnosisSafeTeamEdition.json
Original file line number Diff line number Diff line change
Expand Up @@ -6876,8 +6876,14 @@
"links": {},
"address": "0xd4edae2f2d5718d1798deb48c062b939d6e9d4f4",
"transactionHash": "0xa71d3b0b3752acc18733fa881f70c256d63562f28ccca9af910fad3beee9181a"
},
"1528296677763": {
"events": {},
"links": {},
"address": "0xf2bc99498b610a01d76358d8e2fe251c9783a216",
"transactionHash": "0xa71d3b0b3752acc18733fa881f70c256d63562f28ccca9af910fad3beee9181a"
}
},
"schemaVersion": "2.0.0",
"updatedAt": "2018-06-04T10:56:37.114Z"
"updatedAt": "2018-06-06T14:51:43.677Z"
}
8 changes: 7 additions & 1 deletion safe-contracts/build/contracts/Migrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -1398,8 +1398,14 @@
"links": {},
"address": "0x2ebea54cbbd4f5491deba7a37605f8f0be3e3c9b",
"transactionHash": "0xb6a19a7a679a1474c09c651e4151421f210afa3f47effed019d4c0206144ee5f"
},
"1528296677763": {
"events": {},
"links": {},
"address": "0x4aa39923aa66871debec9b8aa9008a3b220eb1df",
"transactionHash": "0xb6a19a7a679a1474c09c651e4151421f210afa3f47effed019d4c0206144ee5f"
}
},
"schemaVersion": "2.0.0",
"updatedAt": "2018-06-04T10:56:37.139Z"
"updatedAt": "2018-06-06T14:51:43.697Z"
}
8 changes: 7 additions & 1 deletion safe-contracts/build/contracts/MultiSend.json
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,14 @@
"links": {},
"address": "0x3946fcaaa0ba21aaffc5e06a3cc45debc9e07f7f",
"transactionHash": "0xd044f1662e339061a8cabf2b06ac94a9f86fcccf3f5d80ebd1bea2a7542d4021"
},
"1528296677763": {
"events": {},
"links": {},
"address": "0xef9e7829f057e4d640bf66e17e06b3ab5cae508d",
"transactionHash": "0xd044f1662e339061a8cabf2b06ac94a9f86fcccf3f5d80ebd1bea2a7542d4021"
}
},
"schemaVersion": "2.0.0",
"updatedAt": "2018-06-04T10:56:37.139Z"
"updatedAt": "2018-06-06T14:51:43.696Z"
}
8 changes: 7 additions & 1 deletion safe-contracts/build/contracts/ProxyFactory.json
Original file line number Diff line number Diff line change
Expand Up @@ -1011,8 +1011,14 @@
"links": {},
"address": "0xbefd9f4a40b1bec8ec730969a3508d1739fb2742",
"transactionHash": "0x75ad1066b44cd801ac66a316dbe4c09e72636d72b70fd62eb647295a0fc5e285"
},
"1528296677763": {
"events": {},
"links": {},
"address": "0xaa973df8ec251cf67ec387d5627d42dbb738605f",
"transactionHash": "0x75ad1066b44cd801ac66a316dbe4c09e72636d72b70fd62eb647295a0fc5e285"
}
},
"schemaVersion": "2.0.0",
"updatedAt": "2018-06-04T10:56:37.112Z"
"updatedAt": "2018-06-06T14:51:43.668Z"
}
8 changes: 7 additions & 1 deletion safe-contracts/build/contracts/SocialRecoveryModule.json
Original file line number Diff line number Diff line change
Expand Up @@ -7310,8 +7310,14 @@
"links": {},
"address": "0xfb1771240bb7edf209c70bd520a5d5424d23b084",
"transactionHash": "0xf0cd95843453bdac02ad8018ef507479ea62989e56d69ad0ac1aad9d3a8515d2"
},
"1528296677763": {
"events": {},
"links": {},
"address": "0x9be4b89520d1dd6f2d115192587689c6c9bd1a99",
"transactionHash": "0xf0cd95843453bdac02ad8018ef507479ea62989e56d69ad0ac1aad9d3a8515d2"
}
},
"schemaVersion": "2.0.0",
"updatedAt": "2018-06-04T10:56:37.135Z"
"updatedAt": "2018-06-06T14:51:43.692Z"
}
8 changes: 7 additions & 1 deletion safe-contracts/build/contracts/StateChannelModule.json
Original file line number Diff line number Diff line change
Expand Up @@ -5881,8 +5881,14 @@
"links": {},
"address": "0x589fd9eea7cca488a80e17a5105befff9616f11d",
"transactionHash": "0x0396e1c9da4fa7bd313286e6033446dbb6e491f267956f8cf13202ce534fd0e6"
},
"1528296677763": {
"events": {},
"links": {},
"address": "0xe8abcdb37db8e7c563de32c5d207433ce44d1445",
"transactionHash": "0x0396e1c9da4fa7bd313286e6033446dbb6e491f267956f8cf13202ce534fd0e6"
}
},
"schemaVersion": "2.0.0",
"updatedAt": "2018-06-04T10:56:37.118Z"
"updatedAt": "2018-06-06T14:51:43.684Z"
}
8 changes: 7 additions & 1 deletion safe-contracts/build/contracts/WhitelistModule.json
Original file line number Diff line number Diff line change
Expand Up @@ -4354,8 +4354,14 @@
"links": {},
"address": "0xca574a31a4cf1eeabeecaffc555bdc7f91c5caf9",
"transactionHash": "0x463374c2fbc7eaff5b87e65c6a8fdc1177ef82c66084df6e7b88b506f99b193c"
},
"1528296677763": {
"events": {},
"links": {},
"address": "0x66c535e20f0c90530431ebab626da0ebdd55ec2d",
"transactionHash": "0x463374c2fbc7eaff5b87e65c6a8fdc1177ef82c66084df6e7b88b506f99b193c"
}
},
"schemaVersion": "2.0.0",
"updatedAt": "2018-06-04T10:56:37.132Z"
"updatedAt": "2018-06-06T14:51:43.700Z"
}
27 changes: 27 additions & 0 deletions src/components/forms/Checkbox/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// @flow
import React from 'react'
import Checkbox, { type CheckoxProps } from 'material-ui/Checkbox'

class GnoCheckbox extends React.PureComponent<CheckoxProps> {
render() {
const {
input: {
checked, name, onChange, ...restInput
},
meta,
...rest
} = this.props

return (
<Checkbox
{...rest}
name={name}
inputProps={restInput}
onChange={onChange}
checked={!!checked}
/>
)
}
}

export default GnoCheckbox
2 changes: 1 addition & 1 deletion src/components/forms/GnoForm/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const GnoForm = ({
render={({ handleSubmit, ...rest }) => (
<form onSubmit={handleSubmit} style={stylesBasedOn(padding)}>
{render(rest)}
{children(rest.submitting)}
{children(rest.submitting, rest.submitSucceeded)}
</form>
)}
/>
Expand Down
4 changes: 4 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ import PageFrame from '~/components/layout/PageFrame'
import { history, store } from '~/store'
import theme from '~/theme/mui'
import AppRoutes from '~/routes'
import fetchSafes from '~/routes/safe/store/actions/fetchSafes'

import './index.scss'

store.dispatch(fetchSafes())

const Root = () => (
<Provider store={store}>
<MuiThemeProvider theme={theme}>
Expand Down
71 changes: 71 additions & 0 deletions src/routes/safe/component/AddOwner/AddOwnerForm/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// @flow
import * as React from 'react'
import Field from '~/components/forms/Field'
import TextField from '~/components/forms/TextField'
import Checkbox from '~/components/forms/Checkbox'
import { composeValidators, required, mustBeEthereumAddress, uniqueAddress } from '~/components/forms/validator'
import Block from '~/components/layout/Block'
import Heading from '~/components/layout/Heading'

export const CONFIRMATIONS_ERROR = 'Number of confirmations can not be higher than the number of owners'

export const NAME_PARAM = 'name'
export const OWNER_ADDRESS_PARAM = 'ownerAddress'
export const INCREASE_PARAM = 'increase'

export const safeFieldsValidation = (values: Object) => {
const errors = {}

if (Number.parseInt(values.owners, 10) < Number.parseInt(values.confirmations, 10)) {
errors.confirmations = CONFIRMATIONS_ERROR
}

return errors
}

type Props = {
numOwners: number,
threshold: number,
addresses: string[]
}

const AddOwnerForm = ({ addresses, numOwners, threshold }: Props) => () => (
<Block margin="md">
<Heading tag="h2" margin="lg">
Add Owner
</Heading>
<Heading tag="h4" margin="lg">
{`Actual number of owners: ${numOwners}, with threshold: ${threshold}`}
</Heading>
<Block margin="md">
<Field
name={NAME_PARAM}
component={TextField}
type="text"
validate={required}
placeholder="Owner Name*"
text="Owner Name*"
/>
</Block>
<Block margin="md">
<Field
name={OWNER_ADDRESS_PARAM}
component={TextField}
type="text"
validate={composeValidators(required, mustBeEthereumAddress, uniqueAddress(addresses))}
placeholder="Owner address*"
text="Owner address*"
/>
</Block>
<Block margin="md">
<Field
name={INCREASE_PARAM}
component={Checkbox}
type="checkbox"
/>
<Block>Increase owner?</Block>
</Block>
</Block>
)

export default AddOwnerForm
43 changes: 43 additions & 0 deletions src/routes/safe/component/AddOwner/Review/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// @flow
import * as React from 'react'
import { CircularProgress } from 'material-ui/Progress'
import Block from '~/components/layout/Block'
import Bold from '~/components/layout/Bold'
import Heading from '~/components/layout/Heading'
import Paragraph from '~/components/layout/Paragraph'
import { NAME_PARAM, OWNER_ADDRESS_PARAM, INCREASE_PARAM } from '~/routes/safe/component/AddOwner/AddOwnerForm'

type FormProps = {
values: Object,
submitting: boolean,
}

const spinnerStyle = {
minHeight: '50px',
}

const Review = () => ({ values, submitting }: FormProps) => {
const text = values[INCREASE_PARAM]
? 'This operation will increase the threshold of the safe'
: 'This operation will not modify the threshold of the safe'

return (
<Block>
<Heading tag="h2">Review the Add Owner operation</Heading>
<Paragraph align="left">
<Bold>Owner Name: </Bold> {values[NAME_PARAM]}
</Paragraph>
<Paragraph align="left">
<Bold>Owner Address: </Bold> {values[OWNER_ADDRESS_PARAM]}
</Paragraph>
<Paragraph align="left">
<Bold>{text}</Bold>
</Paragraph>
<Block style={spinnerStyle}>
{ submitting && <CircularProgress size={50} /> }
</Block>
</Block>
)
}

export default Review
12 changes: 12 additions & 0 deletions src/routes/safe/component/AddOwner/actions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// @flow
import fetchTransactions from '~/routes/safe/store/actions/fetchTransactions'

type FetchTransactions = typeof fetchTransactions

export type Actions = {
fetchTransactions: FetchTransactions,
}

export default {
fetchTransactions,
}
Loading

0 comments on commit 90920b6

Please sign in to comment.