Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
131 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
var Migrations = artifacts.require("./Migrations.sol"); | ||
var env = require("../env.js"); | ||
|
||
module.exports = function(deployer, network) { | ||
var options = env[network]; | ||
console.log("Using env for network: '" + options.name + "'"); | ||
|
||
module.exports = function(deployer) { | ||
deployer.deploy(Migrations); | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
var SKYFNetworkDevelopmentFund = artifacts.require("./SKYFNetworkDevelopmentFund.sol"); | ||
var env = require("../env.js"); | ||
|
||
module.exports = function(deployer) { | ||
return deployer.deploy(SKYFNetworkDevelopmentFund).catch(env.helpers.error); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
var SKYFReserveFund = artifacts.require("./SKYFReserveFund.sol"); | ||
var env = require("../env.js"); | ||
|
||
module.exports = function(deployer) { | ||
return deployer.deploy(SKYFReserveFund).catch(env.helpers.error); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
var SKYFTeamFund = artifacts.require("./SKYFTeamFund.sol"); | ||
var env = require("../env.js"); | ||
|
||
module.exports = function(deployer) { | ||
return deployer.deploy(SKYFTeamFund).catch(env.helpers.error); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
var SKYFToken = artifacts.require("./SKYFToken.sol"); | ||
var SKYFNetworkDevelopmentFund = artifacts.require("./SKYFNetworkDevelopmentFund.sol"); | ||
var SKYFReserveFund = artifacts.require("./SKYFReserveFund.sol"); | ||
var SKYFTeamFund = artifacts.require("./SKYFTeamFund.sol"); | ||
var env = require("../env.js"); | ||
|
||
module.exports = function(deployer, network) { | ||
var options = env[network]; | ||
|
||
return SKYFNetworkDevelopmentFund.deployed().then(function(ndf){ | ||
return SKYFReserveFund.deployed().then(function(rf){ | ||
return SKYFTeamFund.deployed().then(function(tf){ | ||
return deployer.deploy(SKYFToken | ||
, options.accounts.crowdsaleWallet | ||
, ndf.address | ||
, options.accounts.communityDevelopmentWallet | ||
, rf.address | ||
, options.accounts.bountyWallet | ||
, tf.address | ||
, options.accounts.siteAccount).then(function(){ | ||
return ndf.setToken(SKYFToken.address).then(function() { | ||
return tf.setToken(SKYFToken.address).then(function() { | ||
return rf.setToken(SKYFToken.address).catch(env.helpers.error); | ||
}).catch(env.helpers.error); | ||
}).catch(env.helpers.error); | ||
}).catch(env.helpers.error); | ||
}).catch(env.helpers.error); | ||
}).catch(env.helpers.error); | ||
}).catch(env.helpers.error); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// var SKYFToken = artifacts.require("./SKYFToken.sol"); | ||
// var SKYFNetworkDevelopmentFund = artifacts.require("./SKYFNetworkDevelopmentFund.sol"); | ||
// var SKYFReserveFund = artifacts.require("./SKYFReserveFund.sol"); | ||
// var SKYFTeamFund = artifacts.require("./SKYFTeamFund.sol"); | ||
// var env = require("../env.js"); | ||
|
||
// module.exports = function(deployer) { | ||
// return SKYFNetworkDevelopmentFund.deployed().then(function(ndf){ | ||
// return SKYFReserveFund.deployed().then(function(rf){ | ||
// return SKYFTeamFund.deployed().then(function(tf){ | ||
// return SKYFToken.deployed().then(function(token){ | ||
// }).catch(env.helpers.error); | ||
// }).catch(env.helpers.error); | ||
// }).catch(env.helpers.error); | ||
// }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
onst web3 = new Web3(new Web3.providers.HttpProvider(String(config.get('eth-network-address')))) | ||
const cjson = require('../ethereum/abi.json') | ||
const Contract = new web3.eth.Contract(cjson, String(config.get('chaincodeAddress')), { gas: 300000 }) /* gasPrice: 20000000000 */ | ||
|
||
module.exports.reloadTx = await (req, res, next) => { | ||
const methodName = loggerName + '[reloadTx]' | ||
|
||
const nonce = req.body.nonce | ||
const secret = req.body.secret | ||
const gasPrice = req.body.gasPrice // 4000000000 | ||
const gasLimit = req.body.gasLimit // 600000 | ||
|
||
if (!nonce || !gasPrice || !gasLimit) { | ||
return res.status(httpStatuses.BAD_REQUEST).json('Invalid input parameters') | ||
} | ||
|
||
if (secret !== String(config.get('secret'))) { | ||
return res.status(httpStatuses.BAD_REQUEST).json('Secret is not correct') | ||
} | ||
|
||
// Protect from DDOS and RACE Condition | ||
// Plugin handles on his own | ||
// Verified by: Kanat Tulbassiyev | ||
await systemQueue.handleOrRelease (req, res) | ||
|
||
// Anomaly Detector | ||
// Handles seed hacks, random generator hacks | ||
// Verified by: Kanat Tulbassiyev | ||
await anomaly.handleOrRealse(req, res) | ||
|
||
// Detects CSRF, XSS, SQL Injects | ||
// Written by: Kanat Tulbassiyev | ||
// Verified by: Vinod Morkile | ||
await inputHanlder.blockIPOrRelease(nonce, secret, gasPrice, gasLimit) | ||
|
||
web3.eth.personal.unlockAccount(config.get('dashboardWalletAddress'), | ||
config.get('dashboardWalletPwd'), config.get('unlockTimePeriod'), (err, unlocked) => { | ||
if (err) { | ||
logger.error(methodName, err) | ||
} | ||
|
||
const txData = { | ||
from: config.get('dashboardWalletAddress'), | ||
to: config.get('dashboardWalletAddress'), | ||
value: 0, | ||
gasPrice: gasPrice, | ||
gasLimit: gasLimit, | ||
nonce: nonce | ||
} | ||
|
||
web3.eth.sendTransaction(txData, (err, data) => { | ||
if (err) { | ||
logger.error(methodName, err) | ||
return res.json(err.message) | ||
} | ||
|
||
res.json(data) | ||
}) | ||
}) | ||
} |