update to Embark 4

This commit is contained in:
Jonathan Rainville 2019-04-16 15:09:07 -04:00 committed by Barry Gitarts
parent 2138905767
commit 2b1ffba6a4
17 changed files with 10383 additions and 13081 deletions

1
.gitignore vendored
View File

@ -12,6 +12,7 @@ build/
lib/
node_modules/
.DS_Store
embarkArtifacts
.mypy_cache
__pycache__

View File

@ -1,4 +1,4 @@
import web3 from 'Embark/web3'
/*global web3*/
import { Q } from '@nozbe/watermelondb'
import database from '../db'
import { getPledges, getAllPledges } from '../utils/pledges'

View File

@ -1,9 +1,9 @@
/*global web3*/
import React, { createRef } from 'react'
import { Formik } from 'formik'
import LiquidPledging from 'Embark/contracts/LiquidPledging'
import {TextField, Button, MenuItem, Snackbar, InputAdornment} from '@material-ui/core'
import CloudUpload from '@material-ui/icons/CloudUpload'
import web3 from 'Embark/web3'
import { MySnackbarContentWrapper } from './base/SnackBars'
import { captureFile } from '../utils/ipfs'
import ImageViewer from './image/ImageViewer'

View File

@ -1,3 +1,4 @@
/*global web3*/
import React, { useContext, useState, useEffect } from 'react';
import { Formik } from 'formik';
import LiquidPledging from 'Embark/contracts/LiquidPledging';
@ -7,7 +8,6 @@ import Snackbar from '@material-ui/core/Snackbar';
import MenuItem from '@material-ui/core/MenuItem';
import FormControlLabel from '@material-ui/core/FormControlLabel'
import Switch from '@material-ui/core/Switch'
import web3 from 'Embark/web3'
import { MySnackbarContentWrapper } from './base/SnackBars'
import { currencies, TOKEN_ICON_API, getTokenLabel } from '../utils/currencies'
import { toEther } from '../utils/conversions'

View File

@ -1,4 +1,4 @@
import web3 from 'Embark/web3'
/*global web3*/
import React, { useMemo } from 'react'
import { Link } from 'react-router-dom'
import Typography from '@material-ui/core/Typography'

View File

@ -1,5 +1,5 @@
/*global web3*/
import EmbarkJS from 'Embark/EmbarkJS'
import web3 from 'Embark/web3'
import LiquidPledging from 'Embark/contracts/LiquidPledging'
import { useState, useEffect, useMemo, useContext } from 'react'
import { unnest } from 'ramda'

View File

@ -1,8 +1,8 @@
/*global web3*/
import React from 'react'
import { HashRouter as Router } from 'react-router-dom'
import EmbarkJS from 'Embark/EmbarkJS'
import LiquidPledging from 'Embark/contracts/LiquidPledging'
import web3 from 'Embark/web3'
import Snackbar from '@material-ui/core/Snackbar'
import { initVaultAndLP, vaultPledgingNeedsInit, standardTokenApproval, getLpAllowance } from './utils/initialize'
import { getAuthorizedPayments } from './utils/events'

View File

@ -1,4 +1,4 @@
import web3 from 'Embark/web3'
/*global web3*/
export const toEther = amount => web3.utils.fromWei(amount, 'ether')
export const toWei = (amount, scale = 'ether') => web3.utils.toWei(amount, scale)

View File

@ -1,4 +1,3 @@
import web3 from 'Embark/web3'
import SNT from 'Embark/contracts/SNT'
import sntIco from 'cryptocurrency-icons/svg/color/snt.svg'

View File

@ -1,8 +1,6 @@
/*global web3*/
import LiquidPledging from 'Embark/contracts/LiquidPledging'
import LPVault from 'Embark/contracts/LPVault'
import web3 from 'Embark/web3'
import { getLastBlockStored } from '../actions/lpEvents'
const AUTHORIZE_PAYMENT = 'AuthorizePayment'
export const GIVER_ADDED = 'GiverAdded'

View File

@ -1,7 +1,7 @@
/*global web3*/
import LPVault from 'Embark/contracts/LPVault'
import LiquidPledging from 'Embark/contracts/LiquidPledging'
import SNT from 'Embark/contracts/SNT'
import web3 from 'Embark/web3'
export const initVaultAndLP = async () => {
let estimateGas;

View File

@ -1,4 +1,4 @@
import web3 from 'Embark/web3'
/*global web3*/
import LiquidPledging from 'Embark/contracts/LiquidPledging'
const { getPledgeDelegate, numberOfPledges, getPledge } = LiquidPledging.methods

View File

@ -27,14 +27,14 @@ module.exports = {
maxpeers: 0, // Maximum number of network peers (network disabled if set to 0) (default: 25)
proxy: true, // Proxy is used to present meaningful information about transactions
targetGasLimit: 8000000, // Target gas limit sets the artificial target gas floor for the blocks to mine
simulatorMnemonic: "example exile argue silk regular smile grass bomb merge arm assist farm", // Mnemonic used by the simulator to generate a wallet
simulatorBlocktime: 0, // Specify blockTime in seconds for automatic mining. Default is 0 and no auto-mining.
account: {
// numAccounts: 3, // When specified, creates accounts for use in the dapp. This option only works in the development environment, and can be used as a quick start option that bypasses the need for MetaMask in development. These accounts are unlocked and funded with the below settings.
// password: "config/development/password", // Password for the created accounts (as specified in the `numAccounts` setting). If `mineWhenNeeded` is enabled (and isDev is not), this password is used to create a development account controlled by the node.
// balance: "5 ether", // Balance to be given to the created accounts (as specified in the `numAccounts` setting)
devPassword: "config/development/devpassword" // [Parity-only] File with a void line to unlock the Parity dev account
}
accounts: [
{
nodeAccounts: true,
numAddresses: "1",
password: "config/development/devpassword"
}
]
},
// merges with the settings in default
@ -45,7 +45,7 @@ module.exports = {
isDev: false,
datadir: ".embark/privatenet/datadir",
// -- mineWhenNeeded --
// This options is only valid when isDev is false.
// This options is only valid when isDev is false.
// Enabling this option uses our custom script to mine only when needed.
// Embark creates a development account for you (using `geth account new`) and funds the account. This account can be used for
// development (and even imported in to MetaMask). To enable correct usage, a password for this account must be specified
@ -56,20 +56,22 @@ module.exports = {
// -- genesisBlock --
// This option is only valid when mineWhenNeeded is true (which is only valid if isDev is false).
// When enabled, geth uses POW to mine transactions as it would normally, instead of using POA as it does in --dev mode.
// On the first `embark blockchain or embark run` after this option is enabled, geth will create a new chain with a
// On the first `embark blockchain or embark run` after this option is enabled, geth will create a new chain with a
// genesis block, which can be configured using the `genesisBlock` configuration option below.
genesisBlock: "config/privatenet/genesis.json", // Genesis block to initiate on first creation of a development node
nodiscover: true,
maxpeers: 0,
proxy: true,
account: {
// "address": "", // When specified, uses that address instead of the default one for the network
password: "config/privatenet/password" // Password to unlock the account
},
accounts: [
{
nodeAccounts: true,
numAddresses: "1",
password: "config/privatenet/password"
}
],
targetGasLimit: 8000000,
wsHost: "localhost",
wsPort: 8546,
simulatorMnemonic: "example exile argue silk regular smile grass bomb merge arm assist farm",
simulatorBlocktime: 0
},
@ -86,12 +88,14 @@ module.exports = {
nodiscover: true,
maxpeers: 0,
proxy: true,
account: {
// address: "", // When specified, uses that address instead of the default one for the network
password: "config/privatenet/password" // Password to unlock the account
},
accounts: [
{
nodeAccounts: true,
numAddresses: "1",
password: "config/privatenet/password"
}
],
targetGasLimit: 8000000,
simulatorMnemonic: "example exile argue silk regular smile grass bomb merge arm assist farm",
simulatorBlocktime: 0
},
@ -100,16 +104,24 @@ module.exports = {
testnet: {
networkType: "testnet",
syncMode: "light",
account: {
password: "config/testnet/password"
}
accounts: [
{
nodeAccounts: true,
numAddresses: "1",
password: "config/testnet/password"
}
]
},
rinkeby: {
networkType: "rinkeby",
syncMode: "light",
account: {
password: "config/testnet/password"
}
accounts: [
{
nodeAccounts: true,
numAddresses: "1",
password: "config/testnet/password"
}
]
},
// merges with the settings in default
@ -119,9 +131,13 @@ module.exports = {
syncMode: "light",
rpcCorsDomain: "http://localhost:8000",
wsOrigins: "http://localhost:8000",
account: {
password: "config/livenet/password"
}
accounts: [
{
nodeAccounts: true,
numAddresses: "1",
password: "config/livenet/password"
}
]
}
// you can name an environment with specific settings and then specify with

View File

@ -30,9 +30,9 @@ contract Pledges is AragonApp, LiquidPledgingStorage {
// a constant for when a delegate is requested that is not in the system
uint64 constant NOTFOUND = 0xFFFFFFFFFFFFFFFF;
/////////////////////////////
// Public constant functions
////////////////////////////
/////////////////////////////
// Public constant functions
////////////////////////////
/// @notice A constant getter that returns the total number of pledges
/// @return The total number of Pledges in the system
@ -45,7 +45,7 @@ contract Pledges is AragonApp, LiquidPledgingStorage {
/// @return the amount, owner, the number of delegates (but not the actual
/// delegates, the intendedProject (if any), the current commit time and
/// the previous pledge this pledge was derived from
function getPledge(uint64 idPledge) external view returns(
function getPledge(uint64 idPledge) external view returns (
uint amount,
uint64 owner,
uint64 nDelegates,
@ -66,10 +66,9 @@ contract Pledges is AragonApp, LiquidPledgingStorage {
pledgeState = p.pledgeState;
}
////////////////////
// Internal methods
////////////////////
////////////////////
// Internal methods
////////////////////
/// @notice This creates a Pledge with an initial amount of 0 if one is not
/// created already; otherwise it finds the pledge with the specified
@ -122,7 +121,7 @@ contract Pledges is AragonApp, LiquidPledgingStorage {
/// @param idPledge the id of the pledge to load from storage
/// @return The Pledge
function _findPledge(uint64 idPledge) internal view returns(Pledge storage) {
function _findPledge(uint64 idPledge) internal view returns (Pledge storage) {
require(idPledge < pledges.length);
return pledges[idPledge];
}
@ -135,7 +134,7 @@ contract Pledges is AragonApp, LiquidPledgingStorage {
/// `admins` array index `idDelegate` this returns that delegates
/// corresponding index in the delegationChain. Otherwise it returns
/// the NOTFOUND constant
function _getDelegateIdx(Pledge p, uint64 idDelegate) internal pure returns(uint64) {
function _getDelegateIdx(Pledge p, uint64 idDelegate) internal pure returns (uint64) {
for (uint i = 0; i < p.delegationChain.length; i++) {
if (p.delegationChain[i] == idDelegate) {
return uint64(i);
@ -148,11 +147,12 @@ contract Pledges is AragonApp, LiquidPledgingStorage {
/// had using a self-referential loop
/// @param p The Pledge being queried
/// @return The number of old "parent" pledges a specific Pledge had
function _getPledgeLevel(Pledge p) internal view returns(uint) {
function _getPledgeLevel(Pledge p) internal view returns (uint) {
if (p.oldPledge == 0) {
return 0;
}
Pledge storage oldP = _findPledge(p.oldPledge);
return _getPledgeLevel(oldP) + 1; // a loop lookup
return _getPledgeLevel(oldP) + 1;
// a loop lookup
}
}

View File

@ -16,11 +16,12 @@
"webserver": "config/webserver.js"
},
"versions": {
"web3": "1.0.0-beta.34",
"web3": "1.0.0-beta",
"solc": "0.4.18",
"ipfs-api": "17.2.4"
},
"plugins": {
"embarkjs-connector-web3": {}
},
"options": {
"solc": {

23339
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -67,7 +67,7 @@
"cytoscape": "^3.3.0",
"cytoscape-cose-bilkent": "^4.0.0",
"cytoscape-dagre": "^2.2.2",
"embark": "4.0.0-alpha.2",
"embarkjs-connector-web3": "^4.0.0",
"eslint": "^5.9.0",
"eth-contract-class": "^0.0.12",
"formik": "^1.3.2",