mirror of https://github.com/dap-ps/discover.git
Update to Embark v5 (#62)
* chore: update to Embark v5 * fix: fix tests for Embark 5 * update Embark version and remove Geth client * change contracts to deploy and add cross-env for Windows support * feat: upgrade to Embark 5.1.nightly2 Fixes the problem of not exiting on build end * update to Embark 5.1 Fixes issue where artifacts are not built
This commit is contained in:
parent
20970ee8e5
commit
863d9ea8e3
|
@ -1,149 +1,30 @@
|
||||||
if (process.env.WALLET_PASSWORD == undefined) {
|
if (!process.env.WALLET_MNEMONIC) {
|
||||||
throw Error('Env variable WALLET_PASSWORD not defined!')
|
throw Error('Env variable WALLET_MNEMONIC not defined!')
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// applies to all environments
|
|
||||||
default: {
|
default: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
rpcHost: 'localhost', // HTTP-RPC server listening interface (default: "localhost")
|
accounts: [
|
||||||
rpcPort: 8545, // HTTP-RPC server listening port (default: 8545)
|
{
|
||||||
rpcCorsDomain: {
|
mnemonic: process.env.WALLET_MNEMONIC,
|
||||||
// Domains from which to accept cross origin requests (browser enforced). This can also be a comma separated list
|
hdpath: process.env.HD_PATH, // If undefined, it will default to the default hd path
|
||||||
auto: true, // When "auto" is true, Embark will automatically set the cors to the address of the webserver
|
balance: '1534983463450 ether',
|
||||||
additionalCors: [], // Additional CORS domains to add to the list. If "auto" is false, only those will be added
|
},
|
||||||
},
|
],
|
||||||
wsRPC: true, // Enable the WS-RPC server
|
|
||||||
wsOrigins: {
|
|
||||||
// Same thing as "rpcCorsDomain", but for WS origins
|
|
||||||
auto: true,
|
|
||||||
additionalCors: [],
|
|
||||||
},
|
|
||||||
wsHost: 'localhost', // WS-RPC server listening interface (default: "localhost")
|
|
||||||
wsPort: 8546, // WS-RPC server listening port (default: 8546)
|
|
||||||
|
|
||||||
// Accounts to use as node accounts
|
|
||||||
// The order here corresponds to the order of `web3.eth.getAccounts`, so the first one is the `defaultAccount`
|
|
||||||
// accounts: [
|
|
||||||
// {
|
|
||||||
// nodeAccounts: true, // Accounts use for the node
|
|
||||||
// numAddresses: '1', // Number of addresses/accounts (defaults to 1)
|
|
||||||
// password: 'config/development/password', // Password file for the accounts
|
|
||||||
// },
|
|
||||||
// Below are additional accounts that will count as `nodeAccounts` in the `deployment` section of your contract config
|
|
||||||
// Those will not be unlocked in the node itself
|
|
||||||
// {
|
|
||||||
// privateKeyFile: 'path/to/file', // Either a keystore or a list of keys, separated by , or ;
|
|
||||||
// password: 'passwordForTheKeystore', // Needed to decrypt the keystore file
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// mnemonic: '12 word mnemonic',
|
|
||||||
// addressIndex: '0', // Optional. The index to start getting the address
|
|
||||||
// numAddresses: '1', // Optional. The number of addresses to get
|
|
||||||
// hdpath: "m/44'/60'/0'/0/", // Optional. HD derivation path
|
|
||||||
// },
|
|
||||||
// ],
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// default environment, merges with the settings in default
|
|
||||||
// assumed to be the intended environment by `embark run` and `embark blockchain`
|
|
||||||
development: {
|
development: {
|
||||||
networkType: 'testnet',
|
networkType: 'testnet',
|
||||||
syncMode: 'light',
|
endpoint: `https://ropsten.infura.io/v3/8675214b97b44e96b70d05326c61fd6a`,
|
||||||
accounts: [
|
|
||||||
{
|
|
||||||
nodeAccounts: true,
|
|
||||||
password: process.env.WALLET_PASSWORD,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// merges with the settings in default
|
|
||||||
// used with "embark run privatenet" and/or "embark blockchain privatenet"
|
|
||||||
privatenet: {
|
|
||||||
networkType: 'custom',
|
|
||||||
networkId: 1337,
|
|
||||||
isDev: false,
|
|
||||||
datadir: '.embark/privatenet/datadir',
|
|
||||||
// -- mineWhenNeeded --
|
|
||||||
// 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
|
|
||||||
// in the `account > password` setting below.
|
|
||||||
// NOTE: once `mineWhenNeeded` is enabled, you must run an `embark reset` on your dApp before running
|
|
||||||
// `embark blockchain` or `embark run` for the first time.
|
|
||||||
mineWhenNeeded: true,
|
|
||||||
// -- 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
|
|
||||||
// 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,
|
|
||||||
accounts: [
|
|
||||||
{
|
|
||||||
nodeAccounts: true,
|
|
||||||
password: 'config/privatenet/password', // Password to unlock the account
|
|
||||||
},
|
|
||||||
],
|
|
||||||
targetGasLimit: 8000000,
|
|
||||||
simulatorBlocktime: 0,
|
|
||||||
},
|
|
||||||
|
|
||||||
privateparitynet: {
|
|
||||||
ethereumClientName: 'parity',
|
|
||||||
networkType: 'custom',
|
|
||||||
networkId: 1337,
|
|
||||||
isDev: false,
|
|
||||||
genesisBlock: 'config/privatenet/genesis-parity.json', // Genesis block to initiate on first creation of a development node
|
|
||||||
datadir: '.embark/privatenet/datadir',
|
|
||||||
mineWhenNeeded: false,
|
|
||||||
nodiscover: true,
|
|
||||||
maxpeers: 0,
|
|
||||||
proxy: true,
|
|
||||||
accounts: [
|
|
||||||
{
|
|
||||||
nodeAccounts: true,
|
|
||||||
password: 'config/privatenet/password',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
targetGasLimit: 8000000,
|
|
||||||
simulatorBlocktime: 0,
|
|
||||||
},
|
|
||||||
|
|
||||||
// merges with the settings in default
|
|
||||||
// used with "embark run testnet" and/or "embark blockchain testnet"
|
|
||||||
testnet: {
|
testnet: {
|
||||||
networkType: 'testnet',
|
networkType: 'testnet',
|
||||||
syncMode: 'light',
|
endpoint: `https://ropsten.infura.io/v3/8675214b97b44e96b70d05326c61fd6a`,
|
||||||
accounts: [
|
|
||||||
{
|
|
||||||
nodeAccounts: true,
|
|
||||||
password: process.env.WALLET_PASSWORD,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// merges with the settings in default
|
|
||||||
// used with "embark run livenet" and/or "embark blockchain livenet"
|
|
||||||
livenet: {
|
livenet: {
|
||||||
networkType: 'livenet',
|
endpoint: `https://mainnet.infura.io/v3/8675214b97b44e96b70d05326c61fd6a`,
|
||||||
syncMode: 'light',
|
|
||||||
rpcCorsDomain: 'http://localhost:8000',
|
|
||||||
wsOrigins: 'http://localhost:8000',
|
|
||||||
accounts: [
|
|
||||||
{
|
|
||||||
nodeAccounts: true,
|
|
||||||
password: process.env.WALLET_PASSWORD,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// you can name an environment with specific settings and then specify with
|
|
||||||
// "embark run custom_name" or "embark blockchain custom_name"
|
|
||||||
// custom_name: {
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,46 +1,15 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// default applies to all environments
|
|
||||||
default: {
|
default: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
provider: "whisper", // Communication provider. Currently, Embark only supports whisper
|
provider: "whisper", // Communication provider. Currently, Embark only supports whisper
|
||||||
available_providers: ["whisper"], // Array of available providers
|
available_providers: ["whisper"], // Array of available providers
|
||||||
},
|
},
|
||||||
|
|
||||||
// default environment, merges with the settings in default
|
|
||||||
// assumed to be the intended environment by `embark run`
|
|
||||||
development: {
|
development: {
|
||||||
connection: {
|
connection: {
|
||||||
host: "localhost", // Host of the blockchain node
|
host: "localhost", // Host of the blockchain node
|
||||||
port: 8546, // Port of the blockchain node
|
port: 8547, // Port of the blockchain node
|
||||||
type: "ws" // Type of connection (ws or rpc)
|
type: "ws" // Type of connection (ws or rpc)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// merges with the settings in default
|
|
||||||
// used with "embark run privatenet"
|
|
||||||
privatenet: {
|
|
||||||
},
|
|
||||||
|
|
||||||
// merges with the settings in default
|
|
||||||
// used with "embark run testnet"
|
|
||||||
testnet: {
|
|
||||||
},
|
|
||||||
|
|
||||||
// merges with the settings in default
|
|
||||||
// used with "embark run livenet"
|
|
||||||
livenet: {
|
|
||||||
},
|
|
||||||
|
|
||||||
// you can name an environment with specific settings and then specify with
|
|
||||||
// "embark run custom_name"
|
|
||||||
//custom_name: {
|
|
||||||
//}
|
|
||||||
// Use this section when you need a specific symmetric or private keys in whisper
|
|
||||||
/*
|
|
||||||
,keys: {
|
|
||||||
symmetricKey: "your_symmetric_key",// Symmetric key for message decryption
|
|
||||||
privateKey: "your_private_key" // Private Key to be used as a signing key and for message decryption
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
//}
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,103 +1,25 @@
|
||||||
if (process.env.WALLET_MNEMONIC == undefined) {
|
|
||||||
throw Error('Env variable WALLET_MNEMONIC not defined!')
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// default applies to all environments
|
|
||||||
default: {
|
default: {
|
||||||
// Blockchain node to deploy the contracts
|
|
||||||
deployment: {
|
|
||||||
host: 'localhost', // Host of the blockchain node
|
|
||||||
port: 8546, // Port of the blockchain node
|
|
||||||
type: 'ws', // Type of connection (ws or rpc),
|
|
||||||
// Accounts to use instead of the default account to populate your wallet
|
|
||||||
// The order here corresponds to the order of `web3.eth.getAccounts`, so the first one is the `defaultAccount`
|
|
||||||
/* ,accounts: [
|
|
||||||
{
|
|
||||||
privateKey: "your_private_key",
|
|
||||||
balance: "5 ether" // You can set the balance of the account in the dev environment
|
|
||||||
// Balances are in Wei, but you can specify the unit with its name
|
|
||||||
},
|
|
||||||
{
|
|
||||||
privateKeyFile: "path/to/file", // Either a keystore or a list of keys, separated by , or ;
|
|
||||||
password: "passwordForTheKeystore" // Needed to decrypt the keystore file
|
|
||||||
},
|
|
||||||
{
|
|
||||||
mnemonic: "12 word mnemonic",
|
|
||||||
addressIndex: "0", // Optional. The index to start getting the address
|
|
||||||
numAddresses: "1", // Optional. The number of addresses to get
|
|
||||||
hdpath: "m/44'/60'/0'/0/" // Optional. HD derivation path
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"nodeAccounts": true // Uses the Ethereum node's accounts
|
|
||||||
}
|
|
||||||
] */
|
|
||||||
|
|
||||||
accounts: [
|
|
||||||
{
|
|
||||||
mnemonic: process.env.WALLET_MNEMONIC,
|
|
||||||
balance: '1534983463450 ether',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
// order of connections the dapp should connect to
|
|
||||||
dappConnection: [
|
|
||||||
'$WEB3', // uses pre existing web3 object if available (e.g in Mist)
|
|
||||||
'ws://localhost:8546',
|
|
||||||
'http://localhost:8545',
|
|
||||||
],
|
|
||||||
|
|
||||||
// Automatically call `ethereum.enable` if true.
|
|
||||||
// If false, the following code must run before sending any transaction: `await EmbarkJS.enableEthereum();`
|
|
||||||
// Default value is true.
|
|
||||||
dappAutoEnable: false,
|
dappAutoEnable: false,
|
||||||
|
|
||||||
gas: 'auto',
|
gas: 'auto',
|
||||||
|
gasPrice: '10000000000', // 10gwei. TODO: Set a proper gas price for deployment. See ethgasstation.info
|
||||||
|
|
||||||
// Strategy for the deployment of the contracts:
|
|
||||||
// - implicit will try to deploy all the contracts located inside the contracts directory
|
|
||||||
// or the directory configured for the location of the contracts. This is default one
|
|
||||||
// when not specified
|
|
||||||
// - explicit will only attempt to deploy the contracts that are explicitly specified inside the
|
|
||||||
// contracts section.
|
|
||||||
strategy: 'explicit',
|
strategy: 'explicit',
|
||||||
|
|
||||||
// contracts: {
|
deploy: {
|
||||||
// Discover: {
|
|
||||||
// args: { _SNT: '0x744d70fdbe2ba4cf95131626614a1763df805b9e' },
|
|
||||||
// },
|
|
||||||
// MiniMeToken: { deploy: false },
|
|
||||||
// TestBancorFormula: { deploy: false },
|
|
||||||
// },
|
|
||||||
|
|
||||||
contracts: {
|
|
||||||
Discover: {
|
Discover: {
|
||||||
args: ['$MiniMeToken'],
|
args: ['$MiniMeToken'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
// default environment, merges with the settings in default
|
|
||||||
// assumed to be the intended environment by `embark run`
|
|
||||||
development: {
|
development: {
|
||||||
deployment: {
|
|
||||||
accounts: [
|
|
||||||
{
|
|
||||||
mnemonic: process.env.WALLET_MNEMONIC,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
host: `ropsten.infura.io/v3/8675214b97b44e96b70d05326c61fd6a`,
|
|
||||||
port: false,
|
|
||||||
type: 'rpc',
|
|
||||||
protocol: 'https',
|
|
||||||
},
|
|
||||||
dappConnection: [
|
dappConnection: [
|
||||||
'$WEB3',
|
'$WEB3',
|
||||||
'https://ropsten.infura.io/v3/8675214b97b44e96b70d05326c61fd6a',
|
'https://ropsten.infura.io/v3/8675214b97b44e96b70d05326c61fd6a',
|
||||||
],
|
],
|
||||||
dappAutoEnable: false,
|
deploy: {
|
||||||
gasPrice: "10000000000",
|
|
||||||
contracts: {
|
|
||||||
MiniMeToken: {
|
MiniMeToken: {
|
||||||
address: '0xc55cf4b03948d7ebc8b9e8bad92643703811d162',
|
address: '0xc55cf4b03948d7ebc8b9e8bad92643703811d162',
|
||||||
},
|
},
|
||||||
|
@ -105,31 +27,12 @@ module.exports = {
|
||||||
tracking: 'shared.development.chains.json',
|
tracking: 'shared.development.chains.json',
|
||||||
},
|
},
|
||||||
|
|
||||||
// merges with the settings in default
|
|
||||||
// used with "embark run privatenet"
|
|
||||||
privatenet: {},
|
|
||||||
|
|
||||||
// merges with the settings in default
|
|
||||||
// used with "embark run testnet"
|
|
||||||
testnet: {
|
testnet: {
|
||||||
deployment: {
|
|
||||||
accounts: [
|
|
||||||
{
|
|
||||||
mnemonic: process.env.WALLET_MNEMONIC,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
host: `ropsten.infura.io/v3/8675214b97b44e96b70d05326c61fd6a`,
|
|
||||||
port: false,
|
|
||||||
type: 'rpc',
|
|
||||||
protocol: 'https',
|
|
||||||
},
|
|
||||||
dappConnection: [
|
dappConnection: [
|
||||||
'$WEB3',
|
'$WEB3',
|
||||||
'https://ropsten.infura.io/v3/8675214b97b44e96b70d05326c61fd6a',
|
'https://ropsten.infura.io/v3/8675214b97b44e96b70d05326c61fd6a',
|
||||||
],
|
],
|
||||||
dappAutoEnable: false,
|
deploy: {
|
||||||
gasPrice: "10000000000",
|
|
||||||
contracts: {
|
|
||||||
MiniMeTokenFactory: {
|
MiniMeTokenFactory: {
|
||||||
deploy: false,
|
deploy: false,
|
||||||
},
|
},
|
||||||
|
@ -143,27 +46,12 @@ module.exports = {
|
||||||
tracking: 'shared.testnet.chains.json',
|
tracking: 'shared.testnet.chains.json',
|
||||||
},
|
},
|
||||||
|
|
||||||
// merges with the settings in default
|
|
||||||
// used with "embark run livenet"
|
|
||||||
livenet: {
|
livenet: {
|
||||||
deployment: {
|
|
||||||
accounts: [
|
|
||||||
{
|
|
||||||
mnemonic: process.env.WALLET_MNEMONIC,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
host: `mainnet.infura.io/v3/8675214b97b44e96b70d05326c61fd6a`,
|
|
||||||
port: false,
|
|
||||||
type: 'rpc',
|
|
||||||
protocol: 'https',
|
|
||||||
},
|
|
||||||
dappConnection: [
|
dappConnection: [
|
||||||
'$WEB3',
|
'$WEB3',
|
||||||
'https://mainnet.infura.io/v3/8675214b97b44e96b70d05326c61fd6a',
|
'https://mainnet.infura.io/v3/8675214b97b44e96b70d05326c61fd6a',
|
||||||
],
|
],
|
||||||
dappAutoEnable: false,
|
deploy: {
|
||||||
gasPrice: "10000000000", // 10gwei. TODO: Set a proper gas price for deployment. See ethgasstation.info
|
|
||||||
contracts: {
|
|
||||||
MiniMeTokenFactory: {
|
MiniMeTokenFactory: {
|
||||||
deploy: false,
|
deploy: false,
|
||||||
},
|
},
|
||||||
|
@ -176,9 +64,4 @@ module.exports = {
|
||||||
},
|
},
|
||||||
tracking: 'shared.mainnet.chains.json',
|
tracking: 'shared.mainnet.chains.json',
|
||||||
},
|
},
|
||||||
|
|
||||||
// you can name an environment with specific settings and then specify with
|
|
||||||
// "embark run custom_name" or "embark blockchain custom_name"
|
|
||||||
// custom_name: {
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,13 +5,10 @@
|
||||||
"buildDir": "dist/",
|
"buildDir": "dist/",
|
||||||
"config": "config/",
|
"config": "config/",
|
||||||
"versions": {
|
"versions": {
|
||||||
"web3": "1.2.4",
|
"solc": "0.5.2"
|
||||||
"solc": "0.5.2",
|
|
||||||
"ipfs-api": "17.2.4"
|
|
||||||
},
|
},
|
||||||
"plugins": {
|
"plugins": {
|
||||||
"embark-solium": {},
|
"embark-solium": {},
|
||||||
"embarkjs-connector-web3": {},
|
|
||||||
"embark-etherscan-verifier": {},
|
"embark-etherscan-verifier": {},
|
||||||
"@trailofbits/embark-contract-info": {
|
"@trailofbits/embark-contract-info": {
|
||||||
"flags": ""
|
"flags": ""
|
||||||
|
|
18
package.json
18
package.json
|
@ -13,9 +13,16 @@
|
||||||
"connected-react-router": "^6.3.2",
|
"connected-react-router": "^6.3.2",
|
||||||
"debounce": "^1.2.0",
|
"debounce": "^1.2.0",
|
||||||
"decimal.js": "^10.0.2",
|
"decimal.js": "^10.0.2",
|
||||||
"embark": "4.2.0",
|
"embark": "5.1.0",
|
||||||
"embark-etherscan-verifier": "^4.0.0",
|
"embark-etherscan-verifier": "^4.0.0",
|
||||||
"embark-solium": "0.0.1",
|
"embark-solc": "5.1.0",
|
||||||
|
"embark-solium": "0.1.0",
|
||||||
|
"embarkjs": "5.1.0",
|
||||||
|
"embarkjs-ens": "5.1.0",
|
||||||
|
"embarkjs-ipfs": "5.1.0",
|
||||||
|
"embarkjs-swarm": "5.1.0",
|
||||||
|
"embarkjs-web3": "5.1.0",
|
||||||
|
"embarkjs-whisper": "5.1.0",
|
||||||
"history": "^4.7.2",
|
"history": "^4.7.2",
|
||||||
"idb": "4.0.3",
|
"idb": "4.0.3",
|
||||||
"moment": "^2.24.0",
|
"moment": "^2.24.0",
|
||||||
|
@ -31,9 +38,9 @@
|
||||||
"web3-utils": "^1.0.0-beta.35"
|
"web3-utils": "^1.0.0-beta.35"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build:localhost": "NODE_ENV=localhost make all",
|
"build:localhost": "cross-env NODE_ENV=localhost make all",
|
||||||
"build:dev": "NODE_ENV=development make all",
|
"build:dev": "cross-env NODE_ENV=development make all",
|
||||||
"build:prod": "NODE_ENV=production make all",
|
"build:prod": "cross-env NODE_ENV=production make all",
|
||||||
"start": "./node_modules/.bin/react-scripts start",
|
"start": "./node_modules/.bin/react-scripts start",
|
||||||
"server-start": "node ./full-build/server.js",
|
"server-start": "node ./full-build/server.js",
|
||||||
"build": "./node_modules/.bin/react-scripts build",
|
"build": "./node_modules/.bin/react-scripts build",
|
||||||
|
@ -63,6 +70,7 @@
|
||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"bignumber.js": "^8.1.1",
|
"bignumber.js": "^8.1.1",
|
||||||
|
"cross-env": "^6.0.3",
|
||||||
"eslint-config-airbnb": "^17.1.0",
|
"eslint-config-airbnb": "^17.1.0",
|
||||||
"eslint-config-prettier": "^4.1.0",
|
"eslint-config-prettier": "^4.1.0",
|
||||||
"eslint-plugin-prettier": "^3.0.1",
|
"eslint-plugin-prettier": "^3.0.1",
|
||||||
|
|
|
@ -2,24 +2,26 @@
|
||||||
const BigNumber = require('bignumber.js');
|
const BigNumber = require('bignumber.js');
|
||||||
const constants = require('../utils/FormulaConstants.js');
|
const constants = require('../utils/FormulaConstants.js');
|
||||||
const catchRevert = require("../utils/Utils").catchRevert;
|
const catchRevert = require("../utils/Utils").catchRevert;
|
||||||
const TestBancorFormula = embark.require('Embark/contracts/TestBancorFormula');
|
const TestBancorFormula = require('Embark/contracts/TestBancorFormula');
|
||||||
|
|
||||||
config({
|
config({
|
||||||
deployment: {
|
blockchain: {
|
||||||
accounts: [
|
accounts: [
|
||||||
{
|
{
|
||||||
mnemonic: "foster gesture flock merge beach plate dish view friend leave drink valley shield list enemy",
|
mnemonic: 'foster gesture flock merge beach plate dish view friend leave drink valley shield list enemy',
|
||||||
balance: "5 ether",
|
balance: '5 ether',
|
||||||
numAddresses: "10"
|
numAddresses: '10',
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
|
},
|
||||||
|
contracts: {
|
||||||
|
deploy: {
|
||||||
|
'TestBancorFormula': {},
|
||||||
},
|
},
|
||||||
contracts: {
|
},
|
||||||
"TestBancorFormula": { }
|
}, (_err, web3_accounts) => {
|
||||||
}
|
accounts = web3_accounts
|
||||||
}, (_err, web3_accounts) => {
|
})
|
||||||
accounts = web3_accounts
|
|
||||||
});
|
|
||||||
|
|
||||||
contract('TestBancorFormula', function () {
|
contract('TestBancorFormula', function () {
|
||||||
let ILLEGAL_VAL = new BigNumber(2).exponentiatedBy(256);
|
let ILLEGAL_VAL = new BigNumber(2).exponentiatedBy(256);
|
||||||
|
@ -255,4 +257,4 @@ contract('TestBancorFormula', function () {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,39 +1,40 @@
|
||||||
const TestUtils = require("../utils/testUtils");
|
const TestUtils = require("../utils/testUtils");
|
||||||
const BN = require('bn.js');
|
const BN = require('bn.js');
|
||||||
const Discover = require('Embark/contracts/Discover');
|
const Discover = require('Embark/contracts/Discover');
|
||||||
const SNT = embark.require('Embark/contracts/SNT');
|
const SNT = require('Embark/contracts/SNT');
|
||||||
|
|
||||||
|
|
||||||
config({
|
config({
|
||||||
deployment: {
|
blockchain: {
|
||||||
accounts: [
|
accounts: [
|
||||||
{
|
{
|
||||||
mnemonic: "foster gesture flock merge beach plate dish view friend leave drink valley shield list enemy",
|
mnemonic: 'foster gesture flock merge beach plate dish view friend leave drink valley shield list enemy',
|
||||||
balance: "5 ether",
|
balance: '5 ether',
|
||||||
numAddresses: "10"
|
numAddresses: '10',
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
contracts: {
|
contracts: {
|
||||||
"MiniMeToken": { "deploy": false },
|
deploy: {
|
||||||
"MiniMeTokenFactory": {},
|
'MiniMeToken': { 'deploy': false },
|
||||||
"SNT": {
|
'MiniMeTokenFactory': {},
|
||||||
"instanceOf": "MiniMeToken",
|
'SNT': {
|
||||||
"args": [
|
'instanceOf': 'MiniMeToken',
|
||||||
"$MiniMeTokenFactory",
|
'args': [
|
||||||
"0x0000000000000000000000000000000000000000",
|
'$MiniMeTokenFactory',
|
||||||
0,
|
'0x0000000000000000000000000000000000000000',
|
||||||
"TestMiniMeToken",
|
0,
|
||||||
18,
|
'TestMiniMeToken',
|
||||||
"SNT",
|
18,
|
||||||
true
|
'SNT',
|
||||||
]
|
true,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
'Discover': {
|
||||||
|
args: ['$SNT'],
|
||||||
|
},
|
||||||
|
'TestBancorFormula': {},
|
||||||
},
|
},
|
||||||
"Discover": {
|
},
|
||||||
args: ["$SNT"]
|
|
||||||
},
|
|
||||||
"TestBancorFormula": {}
|
|
||||||
}
|
|
||||||
}, (_err, web3_accounts) => {
|
}, (_err, web3_accounts) => {
|
||||||
accounts = web3_accounts
|
accounts = web3_accounts
|
||||||
});
|
});
|
||||||
|
@ -673,7 +674,7 @@ contract("Discover", function () {
|
||||||
assert.ok(returned <= votes_minted);
|
assert.ok(returned <= votes_minted);
|
||||||
})
|
})
|
||||||
|
|
||||||
// Comment out line 263 in the contract to run this test properly and see
|
// Comment out line 263 in the contract to run this test properly and see
|
||||||
// the BancorFormula fail to find a suitable position in the maxExponentArray
|
// the BancorFormula fail to find a suitable position in the maxExponentArray
|
||||||
it("should prove we have the highest safeMax allowed for by Bancor's power approximation", async function () {
|
it("should prove we have the highest safeMax allowed for by Bancor's power approximation", async function () {
|
||||||
let id = "0x0000000000000000000000000000000000000000000000000000000000000002";
|
let id = "0x0000000000000000000000000000000000000000000000000000000000000002";
|
||||||
|
|
|
@ -9,7 +9,7 @@ function ensureException(error) {
|
||||||
assert(isException(error), error.toString());
|
assert(isException(error), error.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
const PREFIX = "VM Exception while processing transaction: ";
|
const PREFIX = "Returned error: VM Exception while processing transaction: ";
|
||||||
|
|
||||||
async function tryCatch(promise, message) {
|
async function tryCatch(promise, message) {
|
||||||
try {
|
try {
|
||||||
|
@ -33,4 +33,4 @@ module.exports = {
|
||||||
catchStackOverflow : async function(promise) {await tryCatch(promise, "stack overflow" );},
|
catchStackOverflow : async function(promise) {await tryCatch(promise, "stack overflow" );},
|
||||||
catchStackUnderflow : async function(promise) {await tryCatch(promise, "stack underflow" );},
|
catchStackUnderflow : async function(promise) {await tryCatch(promise, "stack underflow" );},
|
||||||
catchStaticStateChange : async function(promise) {await tryCatch(promise, "static state change");},
|
catchStaticStateChange : async function(promise) {await tryCatch(promise, "static state change");},
|
||||||
};
|
};
|
||||||
|
|
|
@ -81,7 +81,7 @@ exports.expectThrow = async promise => {
|
||||||
|
|
||||||
exports.assertJump = error => {
|
exports.assertJump = error => {
|
||||||
assert(
|
assert(
|
||||||
error.message.search('VM Exception while processing transaction: revert') >
|
error.message.search('Returned error: VM Exception while processing transaction: revert') >
|
||||||
-1,
|
-1,
|
||||||
'Revert should happen',
|
'Revert should happen',
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue