- On this step we provide you artifacts about your token and crowdsale contracts. They are useful to verify contracts source code on Etherscan
+ On this step we provide you artifacts about your token and crowdsale contracts. They are useful to verify contracts source code on Etherscan
- Select a strategy for your crowdsale contract.
+ Select a strategy for your crowdsale contract.
- this.handleInputBlur('crowdsale', 'tier', 0)}
onChange={(e) => this.changeState(e, 'crowdsale', 0, 'tier')}
description={`Name of a tier, e.g. PrePreIco, PreICO, ICO with bonus A, ICO with bonus B, etc. We simplified that and will increment a number after each tier.`}
/>
- this.handleInputBlur('crowdsale', 'walletAddress', 0)}
onChange={(e) => this.changeState(e, 'crowdsale', 0, 'walletAddress')}
description={`Where the money goes after investors transactions. Immediately after each transaction. We recommend to setup a multisig wallet with hardware based signers.`}
/>
- this.handleInputBlur('crowdsale', 'startTime', 0)}
onChange={(e) => this.changeState(e, 'crowdsale', 0, 'startTime')}
description={`Date and time when the tier starts. Can't be in the past from the current moment.`}
/>
- this.handleInputBlur('crowdsale', 'endTime', 0)}
onChange={(e) => this.changeState(e, 'crowdsale', 0, 'endTime')}
description={`Date and time when the tier ends. Can be only in the future.`}
/>
- this.handleInputBlur('pricingStrategy', 'rate', 0)}
onChange={(e) => this.changeState(e, 'pricingStrategy', 0, 'rate')}
description={`Exchange rate Ethereum to Tokens. If it's 100, then for 1 Ether you can buy 100 tokens`}
/>
- this.handleInputBlur('crowdsale', 'supply', 0)}
onChange={(e) => this.changeState(e, 'crowdsale', 0, 'supply')}
description={`How many tokens will be sold on this tier. Cap of crowdsale equals to sum of supply of all tiers`}
/>
-
this.changeState(e, 'crowdsale', 0, 'updatable')}
description={`Pandora box feature. If it's enabled, a creator of the crowdsale can modify Start time, End time, Rate, Limit after publishing.`}
/>
-
)
}
-}
\ No newline at end of file
+}
diff --git a/src/components/stepThree/utils.js b/src/components/stepThree/utils.js
index f2b72d84f..9ecdc44ee 100644
--- a/src/components/stepThree/utils.js
+++ b/src/components/stepThree/utils.js
@@ -1,11 +1,8 @@
export function defaultCompanyStartDate() {
let curDate = new Date();
- /*curDate = curDate.setDate(curDate.getDate() + 1);
- curDate = new Date(curDate).setUTCHours(0);
- curDate = new Date(curDate).setMinutes(0);*/
curDate = new Date(curDate).setUTCHours(new Date().getHours());
curDate = new Date(curDate).setMinutes(new Date(curDate).getMinutes() + 5);
let curDateISO = new Date(curDate).toISOString();
let targetDate = curDateISO.split(".")[0].substring(0, curDateISO.lastIndexOf(":"))
return targetDate;
-}
\ No newline at end of file
+}
diff --git a/src/components/stepTwo/index.js b/src/components/stepTwo/index.js
index 29113e8fe..deb2ac43e 100644
--- a/src/components/stepTwo/index.js
+++ b/src/components/stepTwo/index.js
@@ -24,18 +24,6 @@ export class stepTwo extends React.Component {
componentDidMount() {
checkWeb3(this.state.web3);
-
- //emergency alert
- /*setTimeout(() => {
- getWeb3((web3) => {
- getNetworkVersion(web3, (_networkID) => {
- console.log(_networkID);
- if (_networkID == 1) {
- return noDeploymentOnMainnetAlert();
- }
- })
- })
- }, 500);*/
}
getNewParent (property, parent, value) {
@@ -55,7 +43,7 @@ export class stepTwo extends React.Component {
console.log(newState);
if (property === "startTime" || property === "endTime") {
let targetTime = new Date(value);
- let targetTimeTemp = targetTime.setHours(targetTime.getHours() - targetTime.getTimezoneOffset()/60);//.setUTCHours(new Date(targetTime).getHours());
+ let targetTimeTemp = targetTime.setHours(targetTime.getHours() - targetTime.getTimezoneOffset()/60);
if (property === "startTime") {
console.log("property == startTime");
if (targetTimeTemp)
@@ -65,7 +53,7 @@ export class stepTwo extends React.Component {
} else if (property === "endTime") {
if (targetTimeTemp)
newState.crowdsale[key].endTime = new Date(targetTimeTemp).toISOString().split(".")[0];
- else
+ else
newState.crowdsale[key].endTime = null
if (newState.crowdsale[key + 1]) {
newState.crowdsale[key + 1].startTime = newState.crowdsale[key].endTime;
@@ -83,9 +71,9 @@ export class stepTwo extends React.Component {
newState.token[`reservedTokensInput`][prop] = value
} else {
if( Object.prototype.toString.call( newState[parent] ) === '[object Array]' ) {
- newState[parent][key][property] = value;//this.getNewParent(property, parent, key, value)
+ newState[parent][key][property] = value;
} else {
- newState[parent][property] = value;//this.getNewParent(property, parent, key, value)
+ newState[parent][property] = value;
}
}
if (property.indexOf("whitelist") === -1 && property.indexOf("reservedtokens") === -1) {
@@ -95,15 +83,12 @@ export class stepTwo extends React.Component {
} else {
newState[`validations`][property] = validateValue(value, property, newState)
}
- //console.log('property', property)
- //console.log('newState[`validations`][property]', newState[`validations`], validateValue(value, property, newState), 'newState', newState)
}
console.log('newState', newState)
this.setState(newState)
}
handleInputBlur (parent, property, key) {
- //console.log(parent, property, key);
let newState = { ...this.state }
let value
if (property === 'rate') {
@@ -127,11 +112,9 @@ export class stepTwo extends React.Component {
renderLink () {
return Continue
}
-
+
validateAllFields (parent ) {
let newState = { ...this.state }
- //let properties = Object.keys(newState[parent])
- //let values = Object.values(newState[parent])
let properties = []
let values = []
@@ -151,9 +134,6 @@ export class stepTwo extends React.Component {
values = Object.values(newState[parent])
}
- //console.log(properties);
- //console.log(values);
-
properties.forEach((property, index) => {
if ( Object.prototype.toString.call( newState[`validations`] ) === '[object Array]' ) {
newState[`validations`][inds[index]][property] = validateValue(values[index], property)
@@ -165,7 +145,6 @@ export class stepTwo extends React.Component {
}
renderLinkComponent () {
- // console.log(`stepsAreValid(this.state.validations) || allFieldsAreValid('token', this.state)`, stepsAreValid(this.state.validations), allFieldsAreValid('token', this.state))
if(stepsAreValid(this.state.validations) || allFieldsAreValid('token', this.state)){
return this.renderLink()
}
@@ -183,35 +162,35 @@ export class stepTwo extends React.Component {
Token setup
- Configure properties of your token. Created token contract will be ERC-20 compatible.
+ Configure properties of your token. Created token contract will be ERC-20 compatible.
- this.handleInputBlur('token', 'name')}
onChange={(e) => this.changeState(e, 'token', 0, 'name')}
description={`The name of your token. Will be used by Etherscan and other token browsers. Be afraid of trademarks.`}
/>
- this.handleInputBlur('token', 'ticker')}
onChange={(e) => this.changeState(e, 'token', 0, 'ticker')}
description={`The three letter ticker for your token. There are 17,576 combinations for 26 english letters. Be hurry. `}
/>
- this.handleInputBlur('token', 'decimals')}
onChange={(e) => this.changeState(e, 'token', 0, 'decimals')}
description={`Refers to how divisible a token can be, from 0 (not at all divisible) to 18 (pretty much continuous).`}
@@ -230,4 +209,4 @@ export class stepTwo extends React.Component {
)}
-}
\ No newline at end of file
+}
diff --git a/src/utils/blockchainHelpers.js b/src/utils/blockchainHelpers.js
index df7f3ec56..43f8b90de 100644
--- a/src/utils/blockchainHelpers.js
+++ b/src/utils/blockchainHelpers.js
@@ -49,9 +49,7 @@ export function getWeb3(cb) {
// web3, just wrap it in your Web3.
var myWeb3 = new Web3(web3.currentProvider);
- //checkNetworkVersion(myWeb3, function(isOraclesNetwork) {
cb(myWeb3, false);
- //});
}
return myWeb3;
}
@@ -146,7 +144,7 @@ export function deployContract(i, web3, abi, bin, params, state, cb) {
let binFull = bin + ABIencoded.substr(2);
web3.eth.getAccounts().then(function(accounts) {
web3.eth.estimateGas({
- from: accounts[0],
+ from: accounts[0],
data: binFull
}, function(err, estimatedGas) {
if (err) console.log('errrrrrrrrrrrrrrrrr', err);
@@ -172,12 +170,11 @@ export function deployContract(i, web3, abi, bin, params, state, cb) {
let isMined = false;
contractInstance.deploy(deployOpts).send(sendOpts)
- //contractInstance.new(...totalParams)
- .on('error', function(error) {
+ .on('error', function(error) {
console.log(error);
- return cb(error, null);
+ return cb(error, null);
})
- .on('transactionHash', function(transactionHash){
+ .on('transactionHash', function(transactionHash){
console.log("contract deployment transaction: " + transactionHash);
checkTxMined(web3, transactionHash, function txMinedCallback(receipt) {
@@ -203,20 +200,7 @@ export function deployContract(i, web3, abi, bin, params, state, cb) {
}
})
})
- /*.on('receipt', function(receipt){
- if (errorArised) {
- console.log(receipt.contractAddress) // contains the new contract address
- cb(null, receipt.contractAddress);
- }
- })*/
- .on('confirmation', function(confirmationNumber, receipt){
- //console.log(confirmationNumber, receipt);
- /*if (errorArised) {
- console.log(receipt.contractAddress) // contains the new contract address
- cb(null, receipt.contractAddress);
- }*/
-
- })
+ .on('confirmation', function(confirmationNumber, receipt) { })
.then(function(newContractInstance){
if (!isMined) {
console.log("Contract deployment is mined from Promise");
@@ -233,12 +217,11 @@ export function deployContract(i, web3, abi, bin, params, state, cb) {
export function sendTXToContract(web3, method, cb) {
let isMined = false;
method
- //contractInstance.new(...totalParams)
- .on('error', function(error) {
+ .on('error', function(error) {
console.log(error);
- return cb(error);
+ return cb(error);
})
- .on('transactionHash', function(transactionHash){
+ .on('transactionHash', function(transactionHash){
console.log("contract method transaction: " + transactionHash);
checkTxMined(web3, transactionHash, function txMinedCallback(receipt) {
@@ -264,9 +247,7 @@ export function sendTXToContract(web3, method, cb) {
}
})
})
- /*.on('receipt', function(receipt){
- })*/
- .on('confirmation', function(confirmationNumber, receipt){
+ .on('confirmation', function(confirmationNumber, receipt){
})
.then(function(result){
if (!isMined) {
@@ -290,14 +271,11 @@ export function attachToContract(web3, abi, addr, cb) {
web3.eth.getAccounts().then((accounts) => {
web3.eth.defaultAccount = accounts[0];
console.log("web3.eth.defaultAccount:" + web3.eth.defaultAccount);
-
+
let contractInstance = new web3.eth.Contract(abi, addr, {
from: web3.eth.defaultAccount
});
- //console.log(contractInstance);
- //console.log(contractInstance.options);
-
if (cb) cb(null, contractInstance);
});
}
diff --git a/src/utils/microservices.js b/src/utils/microservices.js
index cf007dd04..7bdf043ea 100644
--- a/src/utils/microservices.js
+++ b/src/utils/microservices.js
@@ -1,7 +1,6 @@
import { findConstructor, getconstructorParams, toFixed } from '../utils/utils'
export function getEncodedABIClientSide(web3, abi, state, vals, crowdsaleNum, cb) {
- //console.log(web3, abi, state, vals, crowdsaleNum);
const abiConstructor = findConstructor(abi, state)
let params = getconstructorParams(abiConstructor, state, vals, crowdsaleNum);
@@ -31,4 +30,4 @@ function getABIencoded(web3, types, vals, cb) {
let ABIencodedRaw = encoded.toString("hex")
let ABIencoded = ABIencodedRaw.indexOf("0x") > -1 ? ABIencodedRaw.substr(2) : ABIencodedRaw
cb(ABIencoded);
-}
\ No newline at end of file
+}
diff --git a/src/utils/utils.js b/src/utils/utils.js
index 55e308b60..09915b9d2 100644
--- a/src/utils/utils.js
+++ b/src/utils/utils.js
@@ -33,7 +33,7 @@ export function getURLParam(key,target){
}
if (!values.length) {
- return null;
+ return null;
} else {
return values.length == 1 ? values[0] : values;
}
@@ -106,40 +106,6 @@ export function getWhiteListWithCapCrowdsaleAssets(state, cb) {
cb(state);
}
});
- /*const tokenTransferProxyContractName = "TokenTransferProxy";
- setFlatFileContentToState("./contracts/" + tokenTransferProxyContractName + "_flat.bin", function(_bin) {
- derivativesIterator++;
- state.contracts.tokenTransferProxy.bin = _bin;
-
- if (derivativesIterator === derivativesLength) {
- cb(state);
- }
- });
- setFlatFileContentToState("./contracts/" + tokenTransferProxyContractName + "_flat.abi", function(_abi) {
- derivativesIterator++;
- state.contracts.tokenTransferProxy.abi = JSON.parse(_abi);
-
- if (derivativesIterator === derivativesLength) {
- cb(state);
- }
- });
- const multisigContractName = "MultiSig";
- setFlatFileContentToState("./contracts/" + multisigContractName + "_flat.bin", function(_bin) {
- derivativesIterator++;
- state.contracts.multisig.bin = _bin;
-
- if (derivativesIterator === derivativesLength) {
- cb(state);
- }
- });
- setFlatFileContentToState("./contracts/" + multisigContractName + "_flat.abi", function(_abi) {
- derivativesIterator++;
- state.contracts.multisig.abi = JSON.parse(_abi);
-
- if (derivativesIterator === derivativesLength) {
- cb(state);
- }
- });*/
const finalizeAgentContractName = "FinalizeAgent";
setFlatFileContentToState("./contracts/" + finalizeAgentContractName + "_flat.bin", function(_bin) {
derivativesIterator++;
@@ -206,7 +172,6 @@ export const findConstructor = (abi) => {
}
export const getconstructorParams = (abiConstructor, state, vals, crowdsaleNum) => {
- //console.log(abiConstructor, state, vals, crowdsaleNum);
let params = {"types": [], "vals": []};
if (!abiConstructor) return params;
for (let j = 0; j < abiConstructor.length; j++) {
@@ -279,9 +244,6 @@ export const getconstructorParams = (abiConstructor, state, vals, crowdsaleNum)
params.vals.push(1)
} break;
case "_oneTokenInWei": {
- //params.vals.push(state.pricingStrategy[crowdsaleNum].rate);
- //params.vals.push(state.web3.toWei(1/state.pricingStrategy[crowdsaleNum].rate/10**state.token.decimals, "ether"));
-
let oneTokenInETHRaw = toFixed(1/state.pricingStrategy[crowdsaleNum].rate).toString()
let oneTokenInETH = floorToDecimals(TRUNC_TO_DECIMALS.DECIMALS18, oneTokenInETHRaw)
params.vals.push(state.web3.utils.toWei(oneTokenInETH, "ether"));
@@ -341,7 +303,7 @@ const validateDecimals = (decimals) => isNaN(Number(decimals)) === false && deci
const validateTicker = (ticker) => typeof ticker === 'string' && ticker.length < 4 && ticker.length > 0
-const validateTime = (time) => getTimeAsNumber(time) > Date.now()
+const validateTime = (time) => getTimeAsNumber(time) > Date.now()
const validateRate = (rate) => isNaN(Number(rate)) === false && Number(rate) > 0
@@ -370,13 +332,10 @@ const isNotWhiteListTierObject = (value) => !(typeof value === 'object' && value
// still thinks that we do not have an array... we do
export const validateValue = (value, property) => {
- //console.log("'" + property + "'");
- //console.log("'" + value + "'");
if (!isNaN(property)
|| property === 'reservedTokensInput'
|| property === 'reservedTokens'
|| property === 'reservedTokensElements') return VALID;
- //console.log('value of : ' + value + ' and property of : ' + property, Array.isArray(value), JSON.stringify(value))
let validationFunction, valueIsValid;
if(isNotWhiteListTierObject(value)) {
validationFunction = inputFieldValidators[property]
@@ -387,7 +346,6 @@ export const validateValue = (value, property) => {
if (validationFunction)
valueIsValid = validationFunction(value[property])
}
- //console.log("valueIsValid: " + valueIsValid);
return valueIsValid === true ? VALID : INVALID
}
@@ -409,15 +367,12 @@ export const allFieldsAreValid = (parent, state) => {
} else {
properties = Object.keys(newState[parent])
}
- //console.log(newState);
- //console.log(properties);
- //console.log(properties.filter(property => property !== 'startBlock' && property !== 'endBlock' && property !== 'updatable' && property.toLowerCase().indexOf("whitelist") == -1 ));
let iterator = 0
- let validationValues = properties/*.filter(property => property !== 'startBlock' && property !== 'endBlock' && property !== 'updatable' && property.toLowerCase().indexOf("whitelist") == -1 )*/.map(property => {
+ let validationValues = properties.map(property => {
if (property === 'startBlock' || property === 'endBlock' || property === 'updatable' || property.toLowerCase().indexOf("whitelist") > -1) {
iterator++
return VALID
- }
+ }
let value
if( Object.prototype.toString.call( newState[parent] ) === '[object Array]' ) {
if (newState[parent].length > 0)
@@ -425,14 +380,11 @@ export const allFieldsAreValid = (parent, state) => {
} else {
value = newState[parent][property]
}
- //console.log("value: " + value, "property: " + property, "iterator: " + iterator);
iterator++
if (parent == "token" && property == "supply") return VALID
return validateValue(value, property)
})
- //console.log(validationValues);
- //console.log(values);
-
+
return validationValues.find(value => value === INVALID) === undefined
}