mirror of
https://github.com/status-im/liquid-funding.git
synced 2025-02-23 16:48:19 +00:00
update to Embark 4
This commit is contained in:
parent
2138905767
commit
2b1ffba6a4
1
.gitignore
vendored
1
.gitignore
vendored
@ -12,6 +12,7 @@ build/
|
|||||||
lib/
|
lib/
|
||||||
node_modules/
|
node_modules/
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
embarkArtifacts
|
||||||
|
|
||||||
.mypy_cache
|
.mypy_cache
|
||||||
__pycache__
|
__pycache__
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import web3 from 'Embark/web3'
|
/*global web3*/
|
||||||
import { Q } from '@nozbe/watermelondb'
|
import { Q } from '@nozbe/watermelondb'
|
||||||
import database from '../db'
|
import database from '../db'
|
||||||
import { getPledges, getAllPledges } from '../utils/pledges'
|
import { getPledges, getAllPledges } from '../utils/pledges'
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
|
/*global web3*/
|
||||||
import React, { createRef } from 'react'
|
import React, { createRef } from 'react'
|
||||||
import { Formik } from 'formik'
|
import { Formik } from 'formik'
|
||||||
import LiquidPledging from 'Embark/contracts/LiquidPledging'
|
import LiquidPledging from 'Embark/contracts/LiquidPledging'
|
||||||
import {TextField, Button, MenuItem, Snackbar, InputAdornment} from '@material-ui/core'
|
import {TextField, Button, MenuItem, Snackbar, InputAdornment} from '@material-ui/core'
|
||||||
import CloudUpload from '@material-ui/icons/CloudUpload'
|
import CloudUpload from '@material-ui/icons/CloudUpload'
|
||||||
import web3 from 'Embark/web3'
|
|
||||||
import { MySnackbarContentWrapper } from './base/SnackBars'
|
import { MySnackbarContentWrapper } from './base/SnackBars'
|
||||||
import { captureFile } from '../utils/ipfs'
|
import { captureFile } from '../utils/ipfs'
|
||||||
import ImageViewer from './image/ImageViewer'
|
import ImageViewer from './image/ImageViewer'
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/*global web3*/
|
||||||
import React, { useContext, useState, useEffect } from 'react';
|
import React, { useContext, useState, useEffect } from 'react';
|
||||||
import { Formik } from 'formik';
|
import { Formik } from 'formik';
|
||||||
import LiquidPledging from 'Embark/contracts/LiquidPledging';
|
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 MenuItem from '@material-ui/core/MenuItem';
|
||||||
import FormControlLabel from '@material-ui/core/FormControlLabel'
|
import FormControlLabel from '@material-ui/core/FormControlLabel'
|
||||||
import Switch from '@material-ui/core/Switch'
|
import Switch from '@material-ui/core/Switch'
|
||||||
import web3 from 'Embark/web3'
|
|
||||||
import { MySnackbarContentWrapper } from './base/SnackBars'
|
import { MySnackbarContentWrapper } from './base/SnackBars'
|
||||||
import { currencies, TOKEN_ICON_API, getTokenLabel } from '../utils/currencies'
|
import { currencies, TOKEN_ICON_API, getTokenLabel } from '../utils/currencies'
|
||||||
import { toEther } from '../utils/conversions'
|
import { toEther } from '../utils/conversions'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import web3 from 'Embark/web3'
|
/*global web3*/
|
||||||
import React, { useMemo } from 'react'
|
import React, { useMemo } from 'react'
|
||||||
import { Link } from 'react-router-dom'
|
import { Link } from 'react-router-dom'
|
||||||
import Typography from '@material-ui/core/Typography'
|
import Typography from '@material-ui/core/Typography'
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
/*global web3*/
|
||||||
import EmbarkJS from 'Embark/EmbarkJS'
|
import EmbarkJS from 'Embark/EmbarkJS'
|
||||||
import web3 from 'Embark/web3'
|
|
||||||
import LiquidPledging from 'Embark/contracts/LiquidPledging'
|
import LiquidPledging from 'Embark/contracts/LiquidPledging'
|
||||||
import { useState, useEffect, useMemo, useContext } from 'react'
|
import { useState, useEffect, useMemo, useContext } from 'react'
|
||||||
import { unnest } from 'ramda'
|
import { unnest } from 'ramda'
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
|
/*global web3*/
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { HashRouter as Router } from 'react-router-dom'
|
import { HashRouter as Router } from 'react-router-dom'
|
||||||
import EmbarkJS from 'Embark/EmbarkJS'
|
import EmbarkJS from 'Embark/EmbarkJS'
|
||||||
import LiquidPledging from 'Embark/contracts/LiquidPledging'
|
import LiquidPledging from 'Embark/contracts/LiquidPledging'
|
||||||
import web3 from 'Embark/web3'
|
|
||||||
import Snackbar from '@material-ui/core/Snackbar'
|
import Snackbar from '@material-ui/core/Snackbar'
|
||||||
import { initVaultAndLP, vaultPledgingNeedsInit, standardTokenApproval, getLpAllowance } from './utils/initialize'
|
import { initVaultAndLP, vaultPledgingNeedsInit, standardTokenApproval, getLpAllowance } from './utils/initialize'
|
||||||
import { getAuthorizedPayments } from './utils/events'
|
import { getAuthorizedPayments } from './utils/events'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import web3 from 'Embark/web3'
|
/*global web3*/
|
||||||
|
|
||||||
export const toEther = amount => web3.utils.fromWei(amount, 'ether')
|
export const toEther = amount => web3.utils.fromWei(amount, 'ether')
|
||||||
export const toWei = (amount, scale = 'ether') => web3.utils.toWei(amount, scale)
|
export const toWei = (amount, scale = 'ether') => web3.utils.toWei(amount, scale)
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import web3 from 'Embark/web3'
|
|
||||||
import SNT from 'Embark/contracts/SNT'
|
import SNT from 'Embark/contracts/SNT'
|
||||||
import sntIco from 'cryptocurrency-icons/svg/color/snt.svg'
|
import sntIco from 'cryptocurrency-icons/svg/color/snt.svg'
|
||||||
|
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
|
/*global web3*/
|
||||||
import LiquidPledging from 'Embark/contracts/LiquidPledging'
|
import LiquidPledging from 'Embark/contracts/LiquidPledging'
|
||||||
import LPVault from 'Embark/contracts/LPVault'
|
import LPVault from 'Embark/contracts/LPVault'
|
||||||
import web3 from 'Embark/web3'
|
|
||||||
import { getLastBlockStored } from '../actions/lpEvents'
|
|
||||||
|
|
||||||
|
|
||||||
const AUTHORIZE_PAYMENT = 'AuthorizePayment'
|
const AUTHORIZE_PAYMENT = 'AuthorizePayment'
|
||||||
export const GIVER_ADDED = 'GiverAdded'
|
export const GIVER_ADDED = 'GiverAdded'
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
/*global web3*/
|
||||||
import LPVault from 'Embark/contracts/LPVault'
|
import LPVault from 'Embark/contracts/LPVault'
|
||||||
import LiquidPledging from 'Embark/contracts/LiquidPledging'
|
import LiquidPledging from 'Embark/contracts/LiquidPledging'
|
||||||
import SNT from 'Embark/contracts/SNT'
|
import SNT from 'Embark/contracts/SNT'
|
||||||
import web3 from 'Embark/web3'
|
|
||||||
|
|
||||||
export const initVaultAndLP = async () => {
|
export const initVaultAndLP = async () => {
|
||||||
let estimateGas;
|
let estimateGas;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import web3 from 'Embark/web3'
|
/*global web3*/
|
||||||
import LiquidPledging from 'Embark/contracts/LiquidPledging'
|
import LiquidPledging from 'Embark/contracts/LiquidPledging'
|
||||||
|
|
||||||
const { getPledgeDelegate, numberOfPledges, getPledge } = LiquidPledging.methods
|
const { getPledgeDelegate, numberOfPledges, getPledge } = LiquidPledging.methods
|
||||||
|
@ -27,14 +27,14 @@ module.exports = {
|
|||||||
maxpeers: 0, // Maximum number of network peers (network disabled if set to 0) (default: 25)
|
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
|
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
|
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.
|
simulatorBlocktime: 0, // Specify blockTime in seconds for automatic mining. Default is 0 and no auto-mining.
|
||||||
account: {
|
accounts: [
|
||||||
// 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.
|
nodeAccounts: true,
|
||||||
// balance: "5 ether", // Balance to be given to the created accounts (as specified in the `numAccounts` setting)
|
numAddresses: "1",
|
||||||
devPassword: "config/development/devpassword" // [Parity-only] File with a void line to unlock the Parity dev account
|
password: "config/development/devpassword"
|
||||||
}
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
// merges with the settings in default
|
// merges with the settings in default
|
||||||
@ -45,7 +45,7 @@ module.exports = {
|
|||||||
isDev: false,
|
isDev: false,
|
||||||
datadir: ".embark/privatenet/datadir",
|
datadir: ".embark/privatenet/datadir",
|
||||||
// -- mineWhenNeeded --
|
// -- 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.
|
// 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
|
// 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
|
// 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 --
|
// -- genesisBlock --
|
||||||
// This option is only valid when mineWhenNeeded is true (which is only valid if isDev is false).
|
// 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.
|
// 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.
|
// 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
|
genesisBlock: "config/privatenet/genesis.json", // Genesis block to initiate on first creation of a development node
|
||||||
nodiscover: true,
|
nodiscover: true,
|
||||||
maxpeers: 0,
|
maxpeers: 0,
|
||||||
proxy: true,
|
proxy: true,
|
||||||
account: {
|
accounts: [
|
||||||
// "address": "", // When specified, uses that address instead of the default one for the network
|
{
|
||||||
password: "config/privatenet/password" // Password to unlock the account
|
nodeAccounts: true,
|
||||||
},
|
numAddresses: "1",
|
||||||
|
password: "config/privatenet/password"
|
||||||
|
}
|
||||||
|
],
|
||||||
targetGasLimit: 8000000,
|
targetGasLimit: 8000000,
|
||||||
wsHost: "localhost",
|
wsHost: "localhost",
|
||||||
wsPort: 8546,
|
wsPort: 8546,
|
||||||
simulatorMnemonic: "example exile argue silk regular smile grass bomb merge arm assist farm",
|
|
||||||
simulatorBlocktime: 0
|
simulatorBlocktime: 0
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -86,12 +88,14 @@ module.exports = {
|
|||||||
nodiscover: true,
|
nodiscover: true,
|
||||||
maxpeers: 0,
|
maxpeers: 0,
|
||||||
proxy: true,
|
proxy: true,
|
||||||
account: {
|
accounts: [
|
||||||
// address: "", // When specified, uses that address instead of the default one for the network
|
{
|
||||||
password: "config/privatenet/password" // Password to unlock the account
|
nodeAccounts: true,
|
||||||
},
|
numAddresses: "1",
|
||||||
|
password: "config/privatenet/password"
|
||||||
|
}
|
||||||
|
],
|
||||||
targetGasLimit: 8000000,
|
targetGasLimit: 8000000,
|
||||||
simulatorMnemonic: "example exile argue silk regular smile grass bomb merge arm assist farm",
|
|
||||||
simulatorBlocktime: 0
|
simulatorBlocktime: 0
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -100,16 +104,24 @@ module.exports = {
|
|||||||
testnet: {
|
testnet: {
|
||||||
networkType: "testnet",
|
networkType: "testnet",
|
||||||
syncMode: "light",
|
syncMode: "light",
|
||||||
account: {
|
accounts: [
|
||||||
password: "config/testnet/password"
|
{
|
||||||
}
|
nodeAccounts: true,
|
||||||
|
numAddresses: "1",
|
||||||
|
password: "config/testnet/password"
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
rinkeby: {
|
rinkeby: {
|
||||||
networkType: "rinkeby",
|
networkType: "rinkeby",
|
||||||
syncMode: "light",
|
syncMode: "light",
|
||||||
account: {
|
accounts: [
|
||||||
password: "config/testnet/password"
|
{
|
||||||
}
|
nodeAccounts: true,
|
||||||
|
numAddresses: "1",
|
||||||
|
password: "config/testnet/password"
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
// merges with the settings in default
|
// merges with the settings in default
|
||||||
@ -119,9 +131,13 @@ module.exports = {
|
|||||||
syncMode: "light",
|
syncMode: "light",
|
||||||
rpcCorsDomain: "http://localhost:8000",
|
rpcCorsDomain: "http://localhost:8000",
|
||||||
wsOrigins: "http://localhost:8000",
|
wsOrigins: "http://localhost:8000",
|
||||||
account: {
|
accounts: [
|
||||||
password: "config/livenet/password"
|
{
|
||||||
}
|
nodeAccounts: true,
|
||||||
|
numAddresses: "1",
|
||||||
|
password: "config/livenet/password"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
// you can name an environment with specific settings and then specify with
|
// you can name an environment with specific settings and then specify with
|
||||||
|
@ -30,9 +30,9 @@ contract Pledges is AragonApp, LiquidPledgingStorage {
|
|||||||
// a constant for when a delegate is requested that is not in the system
|
// a constant for when a delegate is requested that is not in the system
|
||||||
uint64 constant NOTFOUND = 0xFFFFFFFFFFFFFFFF;
|
uint64 constant NOTFOUND = 0xFFFFFFFFFFFFFFFF;
|
||||||
|
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
// Public constant functions
|
// Public constant functions
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
|
|
||||||
/// @notice A constant getter that returns the total number of pledges
|
/// @notice A constant getter that returns the total number of pledges
|
||||||
/// @return The total number of Pledges in the system
|
/// @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
|
/// @return the amount, owner, the number of delegates (but not the actual
|
||||||
/// delegates, the intendedProject (if any), the current commit time and
|
/// delegates, the intendedProject (if any), the current commit time and
|
||||||
/// the previous pledge this pledge was derived from
|
/// the previous pledge this pledge was derived from
|
||||||
function getPledge(uint64 idPledge) external view returns(
|
function getPledge(uint64 idPledge) external view returns (
|
||||||
uint amount,
|
uint amount,
|
||||||
uint64 owner,
|
uint64 owner,
|
||||||
uint64 nDelegates,
|
uint64 nDelegates,
|
||||||
@ -66,10 +66,9 @@ contract Pledges is AragonApp, LiquidPledgingStorage {
|
|||||||
pledgeState = p.pledgeState;
|
pledgeState = p.pledgeState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////
|
||||||
////////////////////
|
// Internal methods
|
||||||
// Internal methods
|
////////////////////
|
||||||
////////////////////
|
|
||||||
|
|
||||||
/// @notice This creates a Pledge with an initial amount of 0 if one is not
|
/// @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
|
/// 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
|
/// @param idPledge the id of the pledge to load from storage
|
||||||
/// @return The Pledge
|
/// @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);
|
require(idPledge < pledges.length);
|
||||||
return pledges[idPledge];
|
return pledges[idPledge];
|
||||||
}
|
}
|
||||||
@ -135,7 +134,7 @@ contract Pledges is AragonApp, LiquidPledgingStorage {
|
|||||||
/// `admins` array index `idDelegate` this returns that delegates
|
/// `admins` array index `idDelegate` this returns that delegates
|
||||||
/// corresponding index in the delegationChain. Otherwise it returns
|
/// corresponding index in the delegationChain. Otherwise it returns
|
||||||
/// the NOTFOUND constant
|
/// 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++) {
|
for (uint i = 0; i < p.delegationChain.length; i++) {
|
||||||
if (p.delegationChain[i] == idDelegate) {
|
if (p.delegationChain[i] == idDelegate) {
|
||||||
return uint64(i);
|
return uint64(i);
|
||||||
@ -148,11 +147,12 @@ contract Pledges is AragonApp, LiquidPledgingStorage {
|
|||||||
/// had using a self-referential loop
|
/// had using a self-referential loop
|
||||||
/// @param p The Pledge being queried
|
/// @param p The Pledge being queried
|
||||||
/// @return The number of old "parent" pledges a specific Pledge had
|
/// @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) {
|
if (p.oldPledge == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
Pledge storage oldP = _findPledge(p.oldPledge);
|
Pledge storage oldP = _findPledge(p.oldPledge);
|
||||||
return _getPledgeLevel(oldP) + 1; // a loop lookup
|
return _getPledgeLevel(oldP) + 1;
|
||||||
|
// a loop lookup
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,11 +16,12 @@
|
|||||||
"webserver": "config/webserver.js"
|
"webserver": "config/webserver.js"
|
||||||
},
|
},
|
||||||
"versions": {
|
"versions": {
|
||||||
"web3": "1.0.0-beta.34",
|
"web3": "1.0.0-beta",
|
||||||
"solc": "0.4.18",
|
"solc": "0.4.18",
|
||||||
"ipfs-api": "17.2.4"
|
"ipfs-api": "17.2.4"
|
||||||
},
|
},
|
||||||
"plugins": {
|
"plugins": {
|
||||||
|
"embarkjs-connector-web3": {}
|
||||||
},
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"solc": {
|
"solc": {
|
||||||
|
23339
package-lock.json
generated
23339
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -67,7 +67,7 @@
|
|||||||
"cytoscape": "^3.3.0",
|
"cytoscape": "^3.3.0",
|
||||||
"cytoscape-cose-bilkent": "^4.0.0",
|
"cytoscape-cose-bilkent": "^4.0.0",
|
||||||
"cytoscape-dagre": "^2.2.2",
|
"cytoscape-dagre": "^2.2.2",
|
||||||
"embark": "4.0.0-alpha.2",
|
"embarkjs-connector-web3": "^4.0.0",
|
||||||
"eslint": "^5.9.0",
|
"eslint": "^5.9.0",
|
||||||
"eth-contract-class": "^0.0.12",
|
"eth-contract-class": "^0.0.12",
|
||||||
"formik": "^1.3.2",
|
"formik": "^1.3.2",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user