21
LICENSE
|
@ -1,21 +0,0 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2017 Oracles Network
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
|
@ -1,599 +0,0 @@
|
|||
function generateAddress(cb) {
|
||||
var params = { keyBytes: 32, ivBytes: 16 };
|
||||
|
||||
var dk = keythereum.create(params);
|
||||
|
||||
keythereum.create(params, function (dk) {
|
||||
var options = {};
|
||||
var password = generatePassword();
|
||||
keythereum.dump(password, dk.privateKey, dk.salt, dk.iv, options, function (keyObject) {
|
||||
console.log(keyObject);
|
||||
console.log(JSON.stringify(keyObject));
|
||||
cb(keyObject, password);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function generatePassword() {
|
||||
return passwordGenerator(20, false);
|
||||
}
|
||||
function addValidator(web3, validatorViewObj, contractAddr, abi) {
|
||||
console.log("***Add validator function***");
|
||||
let ValidatorsManager = attachToContract(web3, abi, contractAddr)
|
||||
console.log("attach to oracles contract");
|
||||
if (!ValidatorsManager) {
|
||||
return console.log("ValidatorsStorage contract is undefined");
|
||||
}
|
||||
|
||||
console.log(validatorViewObj);
|
||||
|
||||
var gasPrice = web3.utils.toWei(new web3.utils.BN(1), 'gwei')
|
||||
var opts = {from: web3.eth.defaultAccount, gasPrice: gasPrice}
|
||||
|
||||
return ValidatorsManager.methods.insertValidatorFromCeremony(
|
||||
validatorViewObj.miningKey,
|
||||
validatorViewObj.zip,
|
||||
validatorViewObj.licenseExpiredAt,
|
||||
validatorViewObj.licenseID,
|
||||
validatorViewObj.fullName,
|
||||
validatorViewObj.streetName,
|
||||
validatorViewObj.state
|
||||
)
|
||||
.send(opts)
|
||||
/*.on('transactionHash', _txHash => {
|
||||
console.log("contract method transaction: " + _txHash);
|
||||
})
|
||||
.on('confirmation', (confirmationNumber, receipt) => {
|
||||
console.log(confirmation)
|
||||
})
|
||||
.on('receipt', receipt => {
|
||||
console.log(receipt)
|
||||
cb(receipt.transactionHash)
|
||||
})
|
||||
.on('error', error => {
|
||||
cb(txHash, error);
|
||||
});*/
|
||||
}
|
||||
function showAlert(err, msg) {
|
||||
if (!err) {
|
||||
swal({
|
||||
title: "Error",
|
||||
text: msg,
|
||||
type: "error"
|
||||
});
|
||||
}
|
||||
else {
|
||||
if (err.type != "REQUEST_REJECTED") {
|
||||
swal({
|
||||
title: "Error",
|
||||
text: msg,
|
||||
type: "error"
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
function getBalance(address, cb) {
|
||||
web3.eth.getBalance(address, function(err, balance) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
$(".loading-container").hide();
|
||||
return;
|
||||
}
|
||||
|
||||
cb(balance);
|
||||
});
|
||||
}
|
||||
|
||||
function attachToContract(web3, abi, addr) {
|
||||
web3.eth.defaultAccount = web3.eth.accounts[0];
|
||||
console.log("web3.eth.defaultAccount:" + web3.eth.defaultAccount);
|
||||
|
||||
let contractInstance = new web3.eth.Contract(abi, addr);
|
||||
|
||||
return contractInstance;
|
||||
}
|
||||
function checkInitialKey(web3, initialKey, contractAddr, abi, cb) {
|
||||
let KeysStorage = attachToContract(web3, abi, contractAddr)
|
||||
console.log("attach to oracles contract");
|
||||
if (!KeysStorage) {
|
||||
let err = {"code": 500, "title": "Error", "message": "Can't attach to contract"}
|
||||
return cb(err);
|
||||
}
|
||||
|
||||
console.log(initialKey.toLowerCase())
|
||||
return KeysStorage.methods.initialKeys(initialKey.toLowerCase()).call({from: web3.eth.defaultAccount});
|
||||
}
|
||||
//check current network page is connected to. Alerts, if not Oracles network
|
||||
async function checkNetworkVersion(web3, cb) {
|
||||
var msgNotOracles = "You aren't connected to Oracles network. Please, switch on Oracles plugin and choose Oracles network. Check Oracles network <a href='https://github.com/oraclesorg/oracles-wiki' target='blank'>wiki</a> for more info.";
|
||||
let config = await getConfig()
|
||||
web3.eth.net.getId().then(function(connectedNetworkID) {
|
||||
console.log("connectedNetworkID: " + connectedNetworkID);
|
||||
connectedNetworkID = parseInt(connectedNetworkID);
|
||||
switch (connectedNetworkID) {
|
||||
case 1: {
|
||||
console.log('This is mainnet');
|
||||
swal("Warning", msgNotOracles, "warning");
|
||||
return false;
|
||||
} break;
|
||||
case 2: {
|
||||
console.log('This is the deprecated Morden test network.');
|
||||
swal("Warning", msgNotOracles, "warning");
|
||||
return false;
|
||||
} break;
|
||||
case 3: {
|
||||
console.log('This is the ropsten test network.');
|
||||
swal("Warning", msgNotOracles, "warning");
|
||||
return false;
|
||||
} break;
|
||||
case config.networkID: {
|
||||
console.log('This is Oracles from Metamask');
|
||||
return true;
|
||||
} break;
|
||||
default: {
|
||||
console.log('This is an unknown network.');
|
||||
swal("Warning", msgNotOracles, "warning");
|
||||
return false;
|
||||
} break;
|
||||
}
|
||||
})
|
||||
}
|
||||
function toUnifiedLengthLeft(strIn) {//for numbers
|
||||
var strOut = "";
|
||||
for (var i = 0; i < 64 - strIn.length; i++) {
|
||||
strOut += "0"
|
||||
}
|
||||
strOut += strIn;
|
||||
return strOut;
|
||||
}
|
||||
|
||||
function countRows(strIn) {
|
||||
var rowsCount = 0;
|
||||
if (strIn.length%64 > 0)
|
||||
rowsCount = parseInt(strIn.length/64) + 1;
|
||||
else
|
||||
rowsCount = parseInt(strIn.length/64);
|
||||
return rowsCount;
|
||||
}
|
||||
|
||||
function toUnifiedLengthRight(strIn) {//for strings
|
||||
var strOut = "";
|
||||
strOut += strIn;
|
||||
var rowsCount = countRows(strIn);
|
||||
for (var i = 0; i < rowsCount*64 - strIn.length; i++) {
|
||||
strOut += "0"
|
||||
}
|
||||
return strOut;
|
||||
}
|
||||
|
||||
String.prototype.hexEncode = function(){
|
||||
var hex, i;
|
||||
|
||||
var result = "";
|
||||
for (i=0; i<this.length; i++) {
|
||||
hex = this.charCodeAt(i).toString(16);
|
||||
result += hex.slice(-4);
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
function toUTF8Array(str) {
|
||||
var utf8 = [];
|
||||
for (var i=0; i < str.length; i++) {
|
||||
var charcode = str.charCodeAt(i);
|
||||
if (charcode < 0x80) utf8.push(charcode);
|
||||
else if (charcode < 0x800) {
|
||||
utf8.push(0xc0 | (charcode >> 6),
|
||||
0x80 | (charcode & 0x3f));
|
||||
}
|
||||
else if (charcode < 0xd800 || charcode >= 0xe000) {
|
||||
utf8.push(0xe0 | (charcode >> 12),
|
||||
0x80 | ((charcode>>6) & 0x3f),
|
||||
0x80 | (charcode & 0x3f));
|
||||
}
|
||||
// surrogate pair
|
||||
else {
|
||||
i++;
|
||||
// UTF-16 encodes 0x10000-0x10FFFF by
|
||||
// subtracting 0x10000 and splitting the
|
||||
// 20 bits of 0x0-0xFFFFF into two halves
|
||||
charcode = 0x10000 + (((charcode & 0x3ff)<<10)
|
||||
| (str.charCodeAt(i) & 0x3ff));
|
||||
utf8.push(0xf0 | (charcode >>18),
|
||||
0x80 | ((charcode>>12) & 0x3f),
|
||||
0x80 | ((charcode>>6) & 0x3f),
|
||||
0x80 | (charcode & 0x3f));
|
||||
}
|
||||
}
|
||||
return utf8;
|
||||
}
|
||||
|
||||
function toHexString(byteArray) {
|
||||
return byteArray.map(function(byte) {
|
||||
return ('0' + (byte & 0xFF).toString(16)).slice(-2);
|
||||
}).join('')
|
||||
}
|
||||
|
||||
function bytesCount(s) {
|
||||
return encodeURI(s).split(/%..|./).length - 1;
|
||||
}
|
||||
function createKeys(web3, keys, contractAddr, abi) {
|
||||
console.log("***Create keys function***");
|
||||
let KeysStorage = attachToContract(web3, abi, contractAddr)
|
||||
console.log("attach to oracles contract");
|
||||
if (!KeysStorage) {
|
||||
return console.log("KeysStorage contract is undefined");
|
||||
}
|
||||
|
||||
var gasPrice = web3.utils.toWei(new web3.utils.BN(1), 'gwei')
|
||||
var opts = {from: web3.eth.defaultAccount, gasPrice: gasPrice}
|
||||
|
||||
console.log(opts);
|
||||
console.log("0x" + keys.miningKey.miningKeyObject.address,
|
||||
"0x" + keys.payoutKey.payoutKeyObject.address,
|
||||
"0x" + keys.votingKey.votingKeyObject.address)
|
||||
|
||||
return KeysStorage.methods.createKeys("0x" + keys.miningKey.miningKeyObject.address,
|
||||
"0x" + keys.payoutKey.payoutKeyObject.address,
|
||||
"0x" + keys.votingKey.votingKeyObject.address
|
||||
).send(opts)
|
||||
/*.on('error', error => {
|
||||
return cb(txHash, error);
|
||||
})
|
||||
.on('transactionHash', _txHash => {
|
||||
console.log("contract method transaction: " + _txHash);
|
||||
txHash = _txHash;
|
||||
})
|
||||
.on('receipt', receipt => {
|
||||
return cb(txHash)
|
||||
});*/
|
||||
}
|
||||
function download(filename, text) {
|
||||
var element = document.createElement('a');
|
||||
element.setAttribute('href', 'data:application/json;charset=utf-8,' + encodeURIComponent(text));
|
||||
element.setAttribute('download', filename);
|
||||
|
||||
element.style.display = 'none';
|
||||
document.body.appendChild(element);
|
||||
|
||||
element.click();
|
||||
|
||||
document.body.removeChild(element);
|
||||
}
|
||||
//get current account chosen in MetaMask or opened at Parity
|
||||
function getAccounts(cb) {
|
||||
web3.eth.getAccounts(function(err, accounts) {
|
||||
if (err) {
|
||||
$(".loading-container").hide();
|
||||
showAlert(err, err.message);
|
||||
return;
|
||||
}
|
||||
|
||||
cb(accounts);
|
||||
});
|
||||
}
|
||||
//gets config file with address of Oracles contract
|
||||
async function getConfig(cb) {
|
||||
let config = await $.getJSON("./assets/javascripts/config.json")
|
||||
return config;
|
||||
}
|
||||
//gets web3 object from MetaMask or Parity
|
||||
async function getWeb3(callback) {
|
||||
if (typeof window.web3 === 'undefined') {
|
||||
// no web3, use fallback
|
||||
console.error("Please use a web3 browser");
|
||||
var msgNotEthereum = "You aren't connected to Oracles Network. Please, switch on Oracles plugin and refresh the page. Check Oracles network <a href='https://github.com/oraclesorg/oracles-wiki' target='blank'>wiki</a> for more info.";
|
||||
swal("Warning", msgNotEthereum, "warning");
|
||||
callback(myWeb3, false);
|
||||
} else {
|
||||
var myWeb3 = new Web3(window.web3.currentProvider);
|
||||
|
||||
myWeb3.eth.defaultAccount = window.web3.eth.defaultAccount;
|
||||
if (!myWeb3) {
|
||||
let accounts = await myWeb3.eth.getAccounts()
|
||||
myWeb3.eth.defaultAccount = accounts[0].toLowerCase()
|
||||
}
|
||||
console.log(myWeb3.eth.defaultAccount)
|
||||
|
||||
let isOraclesNetwork = checkNetworkVersion(myWeb3)
|
||||
callback(myWeb3, isOraclesNetwork);
|
||||
}
|
||||
}
|
||||
//launches main application
|
||||
window.onbeforeunload = function(){
|
||||
return 'Are you sure you want to leave?';
|
||||
};
|
||||
function startDapp(web3, isOraclesNetwork) {
|
||||
$(function() {
|
||||
|
||||
$(".loading-container").hide();
|
||||
if (!isOraclesNetwork) return;
|
||||
var keys = {
|
||||
"miningKey": {},
|
||||
"payoutKey": {},
|
||||
"votingKey": {}
|
||||
};
|
||||
|
||||
getAccounts(async function(accounts) {
|
||||
let config = await getConfig()
|
||||
getConfigCallBack(web3, accounts, config)
|
||||
});
|
||||
|
||||
//getting of config callback
|
||||
function getConfigCallBack(web3, accounts, config) {
|
||||
//checks if chosen account is valid initial key
|
||||
if (accounts.length == 1) {
|
||||
checkInitialKey(
|
||||
web3,
|
||||
web3.eth.defaultAccount,
|
||||
config.Ethereum[config.environment].KeysStorage.addr,
|
||||
config.Ethereum[config.environment].KeysStorage.abi
|
||||
)
|
||||
.then(function(_isNew) {
|
||||
console.log(_isNew)
|
||||
if (_isNew != 1) swal("Warning", "Current key isn't valid initial key. Please, choose your initial key in MetaMask and reload the page. Check Oracles network <a href='https://github.com/oraclesorg/oracles-wiki' target='blank'>wiki</a> for more info.", "warning");
|
||||
})
|
||||
.catch(function(err) {
|
||||
swal(err.title, err.message, "error")
|
||||
})
|
||||
} else if (accounts.length == 0) {
|
||||
swal("Warning", "You haven't chosen any account in MetaMask. Please, choose your initial key in MetaMask and reload the page. Check Oracles network <a href='https://github.com/oraclesorg/oracles-wiki' target='blank'>wiki</a> for more info.", "warning");
|
||||
}
|
||||
|
||||
$(".create-keys-button").click(function() {
|
||||
$("#initialKeySource").click();
|
||||
})
|
||||
|
||||
$("#initialKeySource").change({config: config}, initialKeySourceOnChange);
|
||||
}
|
||||
|
||||
function initialKeySourceOnChange(ev) {
|
||||
initialKeyChosen(this, ev.data.config)
|
||||
};
|
||||
|
||||
//triggers, if initial key is chosen
|
||||
function initialKeyChosen(el, config) {
|
||||
var file = $(el).prop('files')[0];
|
||||
$(el).remove();
|
||||
var newEl = "<input type='file' id='initialKeySource' />";
|
||||
$(newEl).change({config: config}, initialKeySourceOnChange).appendTo($(".create-keys"));
|
||||
var reader = new FileReader();
|
||||
reader.readAsText(file, "UTF-8");
|
||||
reader.onload = function (evt) {
|
||||
try {
|
||||
a = JSON.parse(evt.target.result);
|
||||
} catch(e) {
|
||||
return swal("Error", "Invalid key file", "error");
|
||||
}
|
||||
|
||||
var keyJSON = JSON.parse(evt.target.result);
|
||||
var address = keyJSON.address;
|
||||
|
||||
if (!address) return swal("Error", "No address in key file", "error");
|
||||
|
||||
let initialKey = "0x" + address
|
||||
checkInitialKey(web3,
|
||||
initialKey,
|
||||
config.Ethereum[config.environment].KeysStorage.addr,
|
||||
config.Ethereum[config.environment].KeysStorage.abi
|
||||
)
|
||||
.then(function(_isNew) {
|
||||
if (_isNew != 1) return swal("Error", "Initial key is already activated or isn't valid", "error");
|
||||
|
||||
$(".loading-container").show();
|
||||
|
||||
setTimeout(function() {
|
||||
generateProductionsKeys(config, initialKey);
|
||||
}, 500)
|
||||
})
|
||||
.catch(function(err) {
|
||||
swal(err.title, err.message, "error")
|
||||
})
|
||||
}
|
||||
reader.onerror = function (evt) {
|
||||
swal("Error", "Error in reading file", "error");
|
||||
}
|
||||
}
|
||||
|
||||
function generateProductionsKeys(config, initialKey) {
|
||||
console.log(config)
|
||||
generateAddresses(keys, function(_keys) {
|
||||
//fillContractData(config, _keys)
|
||||
//.then(function(reciept) {
|
||||
$(".content").hide();
|
||||
$('.waiting-container').show();
|
||||
$('.waiting-container').empty();
|
||||
$('.waiting-container').append("<h2>Adding production keys to Oracles contract...</h2>");
|
||||
//activate generated production keys
|
||||
createKeys(web3,
|
||||
keys,
|
||||
config.Ethereum[config.environment].KeysStorage.addr,
|
||||
config.Ethereum[config.environment].KeysStorage.abi
|
||||
)
|
||||
.then(function(receipt) {
|
||||
transferCoinsToPayoutKey(initialKey, _keys);
|
||||
})
|
||||
.catch(function(err) {
|
||||
loadingFinished();
|
||||
console.log(err);
|
||||
if (err.type != "REQUEST_REJECTED") swal("Error", "Error in addresses addition to contract", "error");
|
||||
return;
|
||||
})
|
||||
//})
|
||||
/*.catch(function(err) {
|
||||
loadingFinished();
|
||||
console.log(err.message);
|
||||
if (err.type != "REQUEST_REJECTED") swal("Error", "Error in addresses addition to contract", "error");
|
||||
return;
|
||||
})*/
|
||||
});
|
||||
}
|
||||
|
||||
//validating of initial key callback: async generates 3 addresses: mining, payout, voting
|
||||
function generateAddresses(keys, cb) {
|
||||
var keysCount = 0;
|
||||
for (var i in keys) {
|
||||
keysCount++;
|
||||
}
|
||||
var keysIterator = 0;
|
||||
|
||||
generateAddress(function(_miningKeyObject, password) {
|
||||
keysIterator++;
|
||||
keys.miningKey = {};
|
||||
_miningKeyObject.name = "miningKey";
|
||||
keys.miningKey.miningKeyObject = _miningKeyObject;
|
||||
keys.miningKey.password = password;
|
||||
|
||||
if (keysIterator == keysCount) cb(keys);
|
||||
});
|
||||
generateAddress(function(_payoutKeyObject, password) {
|
||||
keysIterator++;
|
||||
keys.payoutKey = {};
|
||||
_payoutKeyObject.name = "payoutKey";
|
||||
keys.payoutKey.payoutKeyObject = _payoutKeyObject;
|
||||
keys.payoutKey.password = password;
|
||||
|
||||
if (keysIterator == keysCount) cb(keys);
|
||||
});
|
||||
generateAddress(function(_votingKeyObject, password) {
|
||||
keysIterator++;
|
||||
keys.votingKey = {};
|
||||
_votingKeyObject.name = "votingKey";
|
||||
keys.votingKey.votingKeyObject = _votingKeyObject;
|
||||
keys.votingKey.password = password;
|
||||
|
||||
if (keysIterator == keysCount) cb(keys);
|
||||
});
|
||||
}
|
||||
|
||||
//Geeneration of all 3 addresses callback
|
||||
function fillContractData(config, keys) {
|
||||
$(".content").hide();
|
||||
$('.waiting-container').show();
|
||||
$('.waiting-container').empty();
|
||||
$('.waiting-container').append("<h2>Adding notary's data to Oracles contract...</h2>");
|
||||
var validatorViewObj = {
|
||||
miningKey: "0x" + keys.miningKey.miningKeyObject.address,
|
||||
fullName: $("#full-name").val(),
|
||||
streetName: $("#address").val(),
|
||||
state: $("#state").val(),
|
||||
zip: $("#zip").val(),
|
||||
licenseID: $("#license-id").val(),
|
||||
licenseExpiredAt: new Date($("#license-expiration").val()).getTime() / 1000,
|
||||
};
|
||||
//adds notary personal data to contract
|
||||
return addValidator(
|
||||
web3,
|
||||
validatorViewObj,
|
||||
config.Ethereum[config.environment].ValidatorsManager.addr,
|
||||
config.Ethereum[config.environment].ValidatorsManager.abi
|
||||
)
|
||||
}
|
||||
|
||||
//Production keys addition to contract callback
|
||||
function transferCoinsToPayoutKey(initialKey, keys) {
|
||||
$(".content").hide();
|
||||
$('.waiting-container').show();
|
||||
$('.waiting-container').empty();
|
||||
$('.waiting-container').append("<h2>Transfering ether from initial key to payout key...</h2>");
|
||||
|
||||
//chain:sends ether to payoutKey
|
||||
var to = "0x" + keys.payoutKey.payoutKeyObject.address;
|
||||
//gets balance of initial key
|
||||
getBalance(initialKey, function(balance) {
|
||||
//calculates how many coins we can send from initial key to payout key
|
||||
var estimatedGas = new web3.utils.BN(21000);
|
||||
var gasPrice = web3.utils.toWei(new web3.utils.BN(1), 'gwei')
|
||||
let amountToSend = calculateamountToSend(estimatedGas, gasPrice, balance)
|
||||
transferCoinsToPayoutKeyTx(estimatedGas, gasPrice, initialKey, to, amountToSend);
|
||||
});
|
||||
}
|
||||
|
||||
function calculateamountToSend(estimatedGas, gasPrice, balance, cb) {
|
||||
var amountToSend = balance.sub(new web3.utils.BN(20).mul(estimatedGas).mul(gasPrice));
|
||||
console.log("amountToSend: " + amountToSend);
|
||||
return amountToSend;
|
||||
}
|
||||
|
||||
function transferCoinsToPayoutKeyTx(estimatedGas, gasPrice, initialKey, to, amountToSend) {
|
||||
let opts = {
|
||||
"gas": estimatedGas,
|
||||
"gasPrice": gasPrice,
|
||||
"from": initialKey,
|
||||
"to": to,
|
||||
"value": amountToSend
|
||||
}
|
||||
console.log(opts)
|
||||
web3.eth.sendTransaction(opts)
|
||||
.then(function(receipt){
|
||||
loadingFinished();
|
||||
swal("Success", "Keys are created", "success");
|
||||
$('.content').empty();
|
||||
loadKeysPage();
|
||||
}).catch(function(err) {
|
||||
console.log(err);
|
||||
return loadingFinished();
|
||||
});
|
||||
}
|
||||
|
||||
function loadKeysPage() {
|
||||
$('.content').load("./keys.html", function() {
|
||||
$("#miningKey").text("0x" + keys.miningKey.miningKeyObject.address);
|
||||
$("#payoutKey").text("0x" + keys.payoutKey.payoutKeyObject.address);
|
||||
$("#votingKey").text("0x" + keys.votingKey.votingKeyObject.address);
|
||||
|
||||
$("#miningKeyPass").text(keys.miningKey.password);
|
||||
$("#payoutKeyPass").text(keys.payoutKey.password);
|
||||
$("#votingKeyPass").text(keys.votingKey.password);
|
||||
|
||||
$("#copyMiningPass").attr("data-clipboard-text", keys.miningKey.password);
|
||||
$("#copyPayoutPass").attr("data-clipboard-text", keys.payoutKey.password);
|
||||
$("#copyVotingPass").attr("data-clipboard-text", keys.votingKey.password);
|
||||
|
||||
buildCopyControl("copyMiningPass", "Mining key password copied");
|
||||
buildCopyControl("copyPayoutPass", "Payout key password copied");
|
||||
buildCopyControl("copyVotingPass", "Voting key password copied");
|
||||
|
||||
$("#copyMiningKey").attr("data-clipboard-text", "0x" + keys.miningKey.miningKeyObject.address);
|
||||
$("#copyPayoutKey").attr("data-clipboard-text", "0x" + keys.payoutKey.payoutKeyObject.address);
|
||||
$("#copyVotingKey").attr("data-clipboard-text", "0x" + keys.votingKey.votingKeyObject.address);
|
||||
|
||||
buildCopyControl("copyMiningKey", "Mining key copied");
|
||||
buildCopyControl("copyPayoutKey", "Payout key copied");
|
||||
buildCopyControl("copyVotingKey", "Voting key copied");
|
||||
|
||||
$("#miningKeyDownload").click(function() {
|
||||
download("mining_key_" + keys.miningKey.miningKeyObject.address, JSON.stringify(keys.miningKey.miningKeyObject));
|
||||
});
|
||||
|
||||
$("#payoutKeyDownload").click(function() {
|
||||
download("payout_key_" + keys.payoutKey.payoutKeyObject.address, JSON.stringify(keys.payoutKey.payoutKeyObject));
|
||||
});
|
||||
|
||||
$("#votingKeyDownload").click(function() {
|
||||
download("voting_key_" + keys.votingKey.votingKeyObject.address, JSON.stringify(keys.votingKey.votingKeyObject));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function loadingFinished() {
|
||||
$(".loading-container").hide();
|
||||
$(".waiting-container").hide();
|
||||
$(".content").show();
|
||||
}
|
||||
|
||||
function buildCopyControl(id, msg) {
|
||||
var el = document.getElementById(id);
|
||||
var clipboard = new Clipboard( el );
|
||||
|
||||
clipboard.on( "success", function( event ) {
|
||||
window.toastr.success(msg);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
window.addEventListener('load', function() {
|
||||
getWeb3(startDapp);
|
||||
});
|
|
@ -1,37 +0,0 @@
|
|||
function addValidator(web3, validatorViewObj, contractAddr, abi) {
|
||||
console.log("***Add validator function***");
|
||||
let ValidatorsManager = attachToContract(web3, abi, contractAddr)
|
||||
console.log("attach to oracles contract");
|
||||
if (!ValidatorsManager) {
|
||||
return console.log("ValidatorsStorage contract is undefined");
|
||||
}
|
||||
|
||||
console.log(validatorViewObj);
|
||||
|
||||
var gasPrice = web3.utils.toWei(new web3.utils.BN(1), 'gwei')
|
||||
var opts = {from: web3.eth.defaultAccount, gasPrice: gasPrice}
|
||||
|
||||
return ValidatorsManager.methods.insertValidatorFromCeremony(
|
||||
validatorViewObj.miningKey,
|
||||
validatorViewObj.zip,
|
||||
validatorViewObj.licenseExpiredAt,
|
||||
validatorViewObj.licenseID,
|
||||
validatorViewObj.fullName,
|
||||
validatorViewObj.streetName,
|
||||
validatorViewObj.state
|
||||
)
|
||||
.send(opts)
|
||||
/*.on('transactionHash', _txHash => {
|
||||
console.log("contract method transaction: " + _txHash);
|
||||
})
|
||||
.on('confirmation', (confirmationNumber, receipt) => {
|
||||
console.log(confirmation)
|
||||
})
|
||||
.on('receipt', receipt => {
|
||||
console.log(receipt)
|
||||
cb(receipt.transactionHash)
|
||||
})
|
||||
.on('error', error => {
|
||||
cb(txHash, error);
|
||||
});*/
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
function generateAddress(cb) {
|
||||
var params = { keyBytes: 32, ivBytes: 16 };
|
||||
|
||||
var dk = keythereum.create(params);
|
||||
|
||||
keythereum.create(params, function (dk) {
|
||||
var options = {};
|
||||
var password = generatePassword();
|
||||
keythereum.dump(password, dk.privateKey, dk.salt, dk.iv, options, function (keyObject) {
|
||||
console.log(keyObject);
|
||||
console.log(JSON.stringify(keyObject));
|
||||
cb(keyObject, password);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function generatePassword() {
|
||||
return passwordGenerator(20, false);
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
function showAlert(err, msg) {
|
||||
if (!err) {
|
||||
swal({
|
||||
title: "Error",
|
||||
text: msg,
|
||||
type: "error"
|
||||
});
|
||||
}
|
||||
else {
|
||||
if (err.type != "REQUEST_REJECTED") {
|
||||
swal({
|
||||
title: "Error",
|
||||
text: msg,
|
||||
type: "error"
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
function getBalance(address, cb) {
|
||||
web3.eth.getBalance(address, function(err, balance) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
$(".loading-container").hide();
|
||||
return;
|
||||
}
|
||||
|
||||
cb(balance);
|
||||
});
|
||||
}
|
||||
|
||||
function attachToContract(web3, abi, addr) {
|
||||
web3.eth.defaultAccount = web3.eth.accounts[0];
|
||||
console.log("web3.eth.defaultAccount:" + web3.eth.defaultAccount);
|
||||
|
||||
let contractInstance = new web3.eth.Contract(abi, addr);
|
||||
|
||||
return contractInstance;
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
function checkInitialKey(web3, initialKey, contractAddr, abi, cb) {
|
||||
let KeysStorage = attachToContract(web3, abi, contractAddr)
|
||||
console.log("attach to oracles contract");
|
||||
if (!KeysStorage) {
|
||||
let err = {"code": 500, "title": "Error", "message": "Can't attach to contract"}
|
||||
return cb(err);
|
||||
}
|
||||
|
||||
console.log(initialKey.toLowerCase())
|
||||
return KeysStorage.methods.initialKeys(initialKey.toLowerCase()).call({from: web3.eth.defaultAccount});
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
//check current network page is connected to. Alerts, if not Oracles network
|
||||
async function checkNetworkVersion(web3, cb) {
|
||||
var msgNotOracles = "You aren't connected to Oracles network. Please, switch on Oracles plugin and choose Oracles network. Check Oracles network <a href='https://github.com/oraclesorg/oracles-wiki' target='blank'>wiki</a> for more info.";
|
||||
let config = await getConfig()
|
||||
web3.eth.net.getId().then(function(connectedNetworkID) {
|
||||
console.log("connectedNetworkID: " + connectedNetworkID);
|
||||
connectedNetworkID = parseInt(connectedNetworkID);
|
||||
switch (connectedNetworkID) {
|
||||
case 1: {
|
||||
console.log('This is mainnet');
|
||||
swal("Warning", msgNotOracles, "warning");
|
||||
return false;
|
||||
} break;
|
||||
case 2: {
|
||||
console.log('This is the deprecated Morden test network.');
|
||||
swal("Warning", msgNotOracles, "warning");
|
||||
return false;
|
||||
} break;
|
||||
case 3: {
|
||||
console.log('This is the ropsten test network.');
|
||||
swal("Warning", msgNotOracles, "warning");
|
||||
return false;
|
||||
} break;
|
||||
case config.networkID: {
|
||||
console.log('This is Oracles from Metamask');
|
||||
return true;
|
||||
} break;
|
||||
default: {
|
||||
console.log('This is an unknown network.');
|
||||
swal("Warning", msgNotOracles, "warning");
|
||||
return false;
|
||||
} break;
|
||||
}
|
||||
})
|
||||
}
|
|
@ -1,80 +0,0 @@
|
|||
function toUnifiedLengthLeft(strIn) {//for numbers
|
||||
var strOut = "";
|
||||
for (var i = 0; i < 64 - strIn.length; i++) {
|
||||
strOut += "0"
|
||||
}
|
||||
strOut += strIn;
|
||||
return strOut;
|
||||
}
|
||||
|
||||
function countRows(strIn) {
|
||||
var rowsCount = 0;
|
||||
if (strIn.length%64 > 0)
|
||||
rowsCount = parseInt(strIn.length/64) + 1;
|
||||
else
|
||||
rowsCount = parseInt(strIn.length/64);
|
||||
return rowsCount;
|
||||
}
|
||||
|
||||
function toUnifiedLengthRight(strIn) {//for strings
|
||||
var strOut = "";
|
||||
strOut += strIn;
|
||||
var rowsCount = countRows(strIn);
|
||||
for (var i = 0; i < rowsCount*64 - strIn.length; i++) {
|
||||
strOut += "0"
|
||||
}
|
||||
return strOut;
|
||||
}
|
||||
|
||||
String.prototype.hexEncode = function(){
|
||||
var hex, i;
|
||||
|
||||
var result = "";
|
||||
for (i=0; i<this.length; i++) {
|
||||
hex = this.charCodeAt(i).toString(16);
|
||||
result += hex.slice(-4);
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
function toUTF8Array(str) {
|
||||
var utf8 = [];
|
||||
for (var i=0; i < str.length; i++) {
|
||||
var charcode = str.charCodeAt(i);
|
||||
if (charcode < 0x80) utf8.push(charcode);
|
||||
else if (charcode < 0x800) {
|
||||
utf8.push(0xc0 | (charcode >> 6),
|
||||
0x80 | (charcode & 0x3f));
|
||||
}
|
||||
else if (charcode < 0xd800 || charcode >= 0xe000) {
|
||||
utf8.push(0xe0 | (charcode >> 12),
|
||||
0x80 | ((charcode>>6) & 0x3f),
|
||||
0x80 | (charcode & 0x3f));
|
||||
}
|
||||
// surrogate pair
|
||||
else {
|
||||
i++;
|
||||
// UTF-16 encodes 0x10000-0x10FFFF by
|
||||
// subtracting 0x10000 and splitting the
|
||||
// 20 bits of 0x0-0xFFFFF into two halves
|
||||
charcode = 0x10000 + (((charcode & 0x3ff)<<10)
|
||||
| (str.charCodeAt(i) & 0x3ff));
|
||||
utf8.push(0xf0 | (charcode >>18),
|
||||
0x80 | ((charcode>>12) & 0x3f),
|
||||
0x80 | ((charcode>>6) & 0x3f),
|
||||
0x80 | (charcode & 0x3f));
|
||||
}
|
||||
}
|
||||
return utf8;
|
||||
}
|
||||
|
||||
function toHexString(byteArray) {
|
||||
return byteArray.map(function(byte) {
|
||||
return ('0' + (byte & 0xFF).toString(16)).slice(-2);
|
||||
}).join('')
|
||||
}
|
||||
|
||||
function bytesCount(s) {
|
||||
return encodeURI(s).split(/%..|./).length - 1;
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
function createKeys(web3, keys, contractAddr, abi) {
|
||||
console.log("***Create keys function***");
|
||||
let KeysStorage = attachToContract(web3, abi, contractAddr)
|
||||
console.log("attach to oracles contract");
|
||||
if (!KeysStorage) {
|
||||
return console.log("KeysStorage contract is undefined");
|
||||
}
|
||||
|
||||
var gasPrice = web3.utils.toWei(new web3.utils.BN(1), 'gwei')
|
||||
var opts = {from: web3.eth.defaultAccount, gasPrice: gasPrice}
|
||||
|
||||
console.log(opts);
|
||||
console.log("0x" + keys.miningKey.miningKeyObject.address,
|
||||
"0x" + keys.payoutKey.payoutKeyObject.address,
|
||||
"0x" + keys.votingKey.votingKeyObject.address)
|
||||
|
||||
return KeysStorage.methods.createKeys("0x" + keys.miningKey.miningKeyObject.address,
|
||||
"0x" + keys.payoutKey.payoutKeyObject.address,
|
||||
"0x" + keys.votingKey.votingKeyObject.address
|
||||
).send(opts)
|
||||
/*.on('error', error => {
|
||||
return cb(txHash, error);
|
||||
})
|
||||
.on('transactionHash', _txHash => {
|
||||
console.log("contract method transaction: " + _txHash);
|
||||
txHash = _txHash;
|
||||
})
|
||||
.on('receipt', receipt => {
|
||||
return cb(txHash)
|
||||
});*/
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
function download(filename, text) {
|
||||
var element = document.createElement('a');
|
||||
element.setAttribute('href', 'data:application/json;charset=utf-8,' + encodeURIComponent(text));
|
||||
element.setAttribute('download', filename);
|
||||
|
||||
element.style.display = 'none';
|
||||
document.body.appendChild(element);
|
||||
|
||||
element.click();
|
||||
|
||||
document.body.removeChild(element);
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
//get current account chosen in MetaMask or opened at Parity
|
||||
function getAccounts(cb) {
|
||||
web3.eth.getAccounts(function(err, accounts) {
|
||||
if (err) {
|
||||
$(".loading-container").hide();
|
||||
showAlert(err, err.message);
|
||||
return;
|
||||
}
|
||||
|
||||
cb(accounts);
|
||||
});
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
//gets config file with address of Oracles contract
|
||||
async function getConfig(cb) {
|
||||
let config = await $.getJSON("./assets/javascripts/config.json")
|
||||
return config;
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
//gets web3 object from MetaMask or Parity
|
||||
async function getWeb3(callback) {
|
||||
if (typeof window.web3 === 'undefined') {
|
||||
// no web3, use fallback
|
||||
console.error("Please use a web3 browser");
|
||||
var msgNotEthereum = "You aren't connected to Oracles Network. Please, switch on Oracles plugin and refresh the page. Check Oracles network <a href='https://github.com/oraclesorg/oracles-wiki' target='blank'>wiki</a> for more info.";
|
||||
swal("Warning", msgNotEthereum, "warning");
|
||||
callback(myWeb3, false);
|
||||
} else {
|
||||
var myWeb3 = new Web3(window.web3.currentProvider);
|
||||
|
||||
myWeb3.eth.defaultAccount = window.web3.eth.defaultAccount;
|
||||
if (!myWeb3) {
|
||||
let accounts = await myWeb3.eth.getAccounts()
|
||||
myWeb3.eth.defaultAccount = accounts[0].toLowerCase()
|
||||
}
|
||||
console.log(myWeb3.eth.defaultAccount)
|
||||
|
||||
let isOraclesNetwork = checkNetworkVersion(myWeb3)
|
||||
callback(myWeb3, isOraclesNetwork);
|
||||
}
|
||||
}
|
|
@ -1,297 +0,0 @@
|
|||
//launches main application
|
||||
window.onbeforeunload = function(){
|
||||
return 'Are you sure you want to leave?';
|
||||
};
|
||||
function startDapp(web3, isOraclesNetwork) {
|
||||
$(function() {
|
||||
|
||||
$(".loading-container").hide();
|
||||
if (!isOraclesNetwork) return;
|
||||
var keys = {
|
||||
"miningKey": {},
|
||||
"payoutKey": {},
|
||||
"votingKey": {}
|
||||
};
|
||||
|
||||
getAccounts(async function(accounts) {
|
||||
let config = await getConfig()
|
||||
getConfigCallBack(web3, accounts, config)
|
||||
});
|
||||
|
||||
//getting of config callback
|
||||
function getConfigCallBack(web3, accounts, config) {
|
||||
//checks if chosen account is valid initial key
|
||||
if (accounts.length == 1) {
|
||||
checkInitialKey(
|
||||
web3,
|
||||
web3.eth.defaultAccount,
|
||||
config.Ethereum[config.environment].KeysStorage.addr,
|
||||
config.Ethereum[config.environment].KeysStorage.abi
|
||||
)
|
||||
.then(function(_isNew) {
|
||||
console.log(_isNew)
|
||||
if (_isNew != 1) swal("Warning", "Current key isn't valid initial key. Please, choose your initial key in MetaMask and reload the page. Check Oracles network <a href='https://github.com/oraclesorg/oracles-wiki' target='blank'>wiki</a> for more info.", "warning");
|
||||
})
|
||||
.catch(function(err) {
|
||||
swal(err.title, err.message, "error")
|
||||
})
|
||||
} else if (accounts.length == 0) {
|
||||
swal("Warning", "You haven't chosen any account in MetaMask. Please, choose your initial key in MetaMask and reload the page. Check Oracles network <a href='https://github.com/oraclesorg/oracles-wiki' target='blank'>wiki</a> for more info.", "warning");
|
||||
}
|
||||
|
||||
$(".create-keys-button").click(function() {
|
||||
$("#initialKeySource").click();
|
||||
})
|
||||
|
||||
$("#initialKeySource").change({config: config}, initialKeySourceOnChange);
|
||||
}
|
||||
|
||||
function initialKeySourceOnChange(ev) {
|
||||
initialKeyChosen(this, ev.data.config)
|
||||
};
|
||||
|
||||
//triggers, if initial key is chosen
|
||||
function initialKeyChosen(el, config) {
|
||||
var file = $(el).prop('files')[0];
|
||||
$(el).remove();
|
||||
var newEl = "<input type='file' id='initialKeySource' />";
|
||||
$(newEl).change({config: config}, initialKeySourceOnChange).appendTo($(".create-keys"));
|
||||
var reader = new FileReader();
|
||||
reader.readAsText(file, "UTF-8");
|
||||
reader.onload = function (evt) {
|
||||
try {
|
||||
a = JSON.parse(evt.target.result);
|
||||
} catch(e) {
|
||||
return swal("Error", "Invalid key file", "error");
|
||||
}
|
||||
|
||||
var keyJSON = JSON.parse(evt.target.result);
|
||||
var address = keyJSON.address;
|
||||
|
||||
if (!address) return swal("Error", "No address in key file", "error");
|
||||
|
||||
let initialKey = "0x" + address
|
||||
checkInitialKey(web3,
|
||||
initialKey,
|
||||
config.Ethereum[config.environment].KeysStorage.addr,
|
||||
config.Ethereum[config.environment].KeysStorage.abi
|
||||
)
|
||||
.then(function(_isNew) {
|
||||
if (_isNew != 1) return swal("Error", "Initial key is already activated or isn't valid", "error");
|
||||
|
||||
$(".loading-container").show();
|
||||
|
||||
setTimeout(function() {
|
||||
generateProductionsKeys(config, initialKey);
|
||||
}, 500)
|
||||
})
|
||||
.catch(function(err) {
|
||||
swal(err.title, err.message, "error")
|
||||
})
|
||||
}
|
||||
reader.onerror = function (evt) {
|
||||
swal("Error", "Error in reading file", "error");
|
||||
}
|
||||
}
|
||||
|
||||
function generateProductionsKeys(config, initialKey) {
|
||||
console.log(config)
|
||||
generateAddresses(keys, function(_keys) {
|
||||
//fillContractData(config, _keys)
|
||||
//.then(function(reciept) {
|
||||
$(".content").hide();
|
||||
$('.waiting-container').show();
|
||||
$('.waiting-container').empty();
|
||||
$('.waiting-container').append("<h2>Adding production keys to Oracles contract...</h2>");
|
||||
//activate generated production keys
|
||||
createKeys(web3,
|
||||
keys,
|
||||
config.Ethereum[config.environment].KeysStorage.addr,
|
||||
config.Ethereum[config.environment].KeysStorage.abi
|
||||
)
|
||||
.then(function(receipt) {
|
||||
transferCoinsToPayoutKey(initialKey, _keys);
|
||||
})
|
||||
.catch(function(err) {
|
||||
loadingFinished();
|
||||
console.log(err);
|
||||
if (err.type != "REQUEST_REJECTED") swal("Error", "Error in addresses addition to contract", "error");
|
||||
return;
|
||||
})
|
||||
//})
|
||||
/*.catch(function(err) {
|
||||
loadingFinished();
|
||||
console.log(err.message);
|
||||
if (err.type != "REQUEST_REJECTED") swal("Error", "Error in addresses addition to contract", "error");
|
||||
return;
|
||||
})*/
|
||||
});
|
||||
}
|
||||
|
||||
//validating of initial key callback: async generates 3 addresses: mining, payout, voting
|
||||
function generateAddresses(keys, cb) {
|
||||
var keysCount = 0;
|
||||
for (var i in keys) {
|
||||
keysCount++;
|
||||
}
|
||||
var keysIterator = 0;
|
||||
|
||||
generateAddress(function(_miningKeyObject, password) {
|
||||
keysIterator++;
|
||||
keys.miningKey = {};
|
||||
_miningKeyObject.name = "miningKey";
|
||||
keys.miningKey.miningKeyObject = _miningKeyObject;
|
||||
keys.miningKey.password = password;
|
||||
|
||||
if (keysIterator == keysCount) cb(keys);
|
||||
});
|
||||
generateAddress(function(_payoutKeyObject, password) {
|
||||
keysIterator++;
|
||||
keys.payoutKey = {};
|
||||
_payoutKeyObject.name = "payoutKey";
|
||||
keys.payoutKey.payoutKeyObject = _payoutKeyObject;
|
||||
keys.payoutKey.password = password;
|
||||
|
||||
if (keysIterator == keysCount) cb(keys);
|
||||
});
|
||||
generateAddress(function(_votingKeyObject, password) {
|
||||
keysIterator++;
|
||||
keys.votingKey = {};
|
||||
_votingKeyObject.name = "votingKey";
|
||||
keys.votingKey.votingKeyObject = _votingKeyObject;
|
||||
keys.votingKey.password = password;
|
||||
|
||||
if (keysIterator == keysCount) cb(keys);
|
||||
});
|
||||
}
|
||||
|
||||
//Geeneration of all 3 addresses callback
|
||||
function fillContractData(config, keys) {
|
||||
$(".content").hide();
|
||||
$('.waiting-container').show();
|
||||
$('.waiting-container').empty();
|
||||
$('.waiting-container').append("<h2>Adding notary's data to Oracles contract...</h2>");
|
||||
var validatorViewObj = {
|
||||
miningKey: "0x" + keys.miningKey.miningKeyObject.address,
|
||||
fullName: $("#full-name").val(),
|
||||
streetName: $("#address").val(),
|
||||
state: $("#state").val(),
|
||||
zip: $("#zip").val(),
|
||||
licenseID: $("#license-id").val(),
|
||||
licenseExpiredAt: new Date($("#license-expiration").val()).getTime() / 1000,
|
||||
};
|
||||
//adds notary personal data to contract
|
||||
return addValidator(
|
||||
web3,
|
||||
validatorViewObj,
|
||||
config.Ethereum[config.environment].ValidatorsManager.addr,
|
||||
config.Ethereum[config.environment].ValidatorsManager.abi
|
||||
)
|
||||
}
|
||||
|
||||
//Production keys addition to contract callback
|
||||
function transferCoinsToPayoutKey(initialKey, keys) {
|
||||
$(".content").hide();
|
||||
$('.waiting-container').show();
|
||||
$('.waiting-container').empty();
|
||||
$('.waiting-container').append("<h2>Transfering ether from initial key to payout key...</h2>");
|
||||
|
||||
//chain:sends ether to payoutKey
|
||||
var to = "0x" + keys.payoutKey.payoutKeyObject.address;
|
||||
//gets balance of initial key
|
||||
getBalance(initialKey, function(balance) {
|
||||
//calculates how many coins we can send from initial key to payout key
|
||||
var estimatedGas = new web3.utils.BN(21000);
|
||||
var gasPrice = web3.utils.toWei(new web3.utils.BN(1), 'gwei')
|
||||
let amountToSend = calculateamountToSend(estimatedGas, gasPrice, balance)
|
||||
transferCoinsToPayoutKeyTx(estimatedGas, gasPrice, initialKey, to, amountToSend);
|
||||
});
|
||||
}
|
||||
|
||||
function calculateamountToSend(estimatedGas, gasPrice, balance, cb) {
|
||||
var amountToSend = balance.sub(new web3.utils.BN(20).mul(estimatedGas).mul(gasPrice));
|
||||
console.log("amountToSend: " + amountToSend);
|
||||
return amountToSend;
|
||||
}
|
||||
|
||||
function transferCoinsToPayoutKeyTx(estimatedGas, gasPrice, initialKey, to, amountToSend) {
|
||||
let opts = {
|
||||
"gas": estimatedGas,
|
||||
"gasPrice": gasPrice,
|
||||
"from": initialKey,
|
||||
"to": to,
|
||||
"value": amountToSend
|
||||
}
|
||||
console.log(opts)
|
||||
web3.eth.sendTransaction(opts)
|
||||
.then(function(receipt){
|
||||
loadingFinished();
|
||||
swal("Success", "Keys are created", "success");
|
||||
$('.content').empty();
|
||||
loadKeysPage();
|
||||
}).catch(function(err) {
|
||||
console.log(err);
|
||||
return loadingFinished();
|
||||
});
|
||||
}
|
||||
|
||||
function loadKeysPage() {
|
||||
$('.content').load("./keys.html", function() {
|
||||
$("#miningKey").text("0x" + keys.miningKey.miningKeyObject.address);
|
||||
$("#payoutKey").text("0x" + keys.payoutKey.payoutKeyObject.address);
|
||||
$("#votingKey").text("0x" + keys.votingKey.votingKeyObject.address);
|
||||
|
||||
$("#miningKeyPass").text(keys.miningKey.password);
|
||||
$("#payoutKeyPass").text(keys.payoutKey.password);
|
||||
$("#votingKeyPass").text(keys.votingKey.password);
|
||||
|
||||
$("#copyMiningPass").attr("data-clipboard-text", keys.miningKey.password);
|
||||
$("#copyPayoutPass").attr("data-clipboard-text", keys.payoutKey.password);
|
||||
$("#copyVotingPass").attr("data-clipboard-text", keys.votingKey.password);
|
||||
|
||||
buildCopyControl("copyMiningPass", "Mining key password copied");
|
||||
buildCopyControl("copyPayoutPass", "Payout key password copied");
|
||||
buildCopyControl("copyVotingPass", "Voting key password copied");
|
||||
|
||||
$("#copyMiningKey").attr("data-clipboard-text", "0x" + keys.miningKey.miningKeyObject.address);
|
||||
$("#copyPayoutKey").attr("data-clipboard-text", "0x" + keys.payoutKey.payoutKeyObject.address);
|
||||
$("#copyVotingKey").attr("data-clipboard-text", "0x" + keys.votingKey.votingKeyObject.address);
|
||||
|
||||
buildCopyControl("copyMiningKey", "Mining key copied");
|
||||
buildCopyControl("copyPayoutKey", "Payout key copied");
|
||||
buildCopyControl("copyVotingKey", "Voting key copied");
|
||||
|
||||
$("#miningKeyDownload").click(function() {
|
||||
download("mining_key_" + keys.miningKey.miningKeyObject.address, JSON.stringify(keys.miningKey.miningKeyObject));
|
||||
});
|
||||
|
||||
$("#payoutKeyDownload").click(function() {
|
||||
download("payout_key_" + keys.payoutKey.payoutKeyObject.address, JSON.stringify(keys.payoutKey.payoutKeyObject));
|
||||
});
|
||||
|
||||
$("#votingKeyDownload").click(function() {
|
||||
download("voting_key_" + keys.votingKey.votingKeyObject.address, JSON.stringify(keys.votingKey.votingKeyObject));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function loadingFinished() {
|
||||
$(".loading-container").hide();
|
||||
$(".waiting-container").hide();
|
||||
$(".content").show();
|
||||
}
|
||||
|
||||
function buildCopyControl(id, msg) {
|
||||
var el = document.getElementById(id);
|
||||
var clipboard = new Clipboard( el );
|
||||
|
||||
clipboard.on( "success", function( event ) {
|
||||
window.toastr.success(msg);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
window.addEventListener('load', function() {
|
||||
getWeb3(startDapp);
|
||||
});
|
|
@ -1 +0,0 @@
|
|||
@import './index/*';
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"main.css": "static/css/main.d7db86f1.css",
|
||||
"main.css.map": "static/css/main.d7db86f1.css.map",
|
||||
"main.js": "static/js/main.d5fb83ac.js",
|
||||
"main.js.map": "static/js/main.d5fb83ac.js.map",
|
||||
"static/media/CEREMONY.png": "static/media/CEREMONY.3aaa882b.png",
|
||||
"static/media/CEREMONY@2x.png": "static/media/CEREMONY@2x.b8495078.png",
|
||||
"static/media/CEREMONY_footer.png": "static/media/CEREMONY_footer.2e9492a0.png",
|
||||
"static/media/CEREMONY_footer@2x.png": "static/media/CEREMONY_footer@2x.7ae07c61.png",
|
||||
"static/media/bg_footer.png": "static/media/bg_footer.c0181fba.png",
|
||||
"static/media/bg_header.png": "static/media/bg_header.55fb6ae4.png",
|
||||
"static/media/copy.png": "static/media/copy.3cdc75f3.png",
|
||||
"static/media/copy@2x.png": "static/media/copy@2x.d47cd69c.png",
|
||||
"static/media/loading.png": "static/media/loading.26ca894e.png",
|
||||
"static/media/warning.svg": "static/media/warning.4ba81241.svg"
|
||||
}
|
After Width: | Height: | Size: 3.8 KiB |
|
@ -0,0 +1 @@
|
|||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><link rel="manifest" href="/oracles-dapps-keys-generation/manifest.json"><link rel="shortcut icon" href="/oracles-dapps-keys-generation/favicon.ico"><title>React App</title><link href="/oracles-dapps-keys-generation/static/css/main.d7db86f1.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><header class="header"><div class="container"><a href="#" class="header-logo"></a></div></header><div id="root"></div><footer class="footer"><div class="container"><a href="#" class="footer-logo"></a><div class="socials"><a href="#" class="socials-i socials-i_reddit"></a> <a href="https://twitter.com/oraclesorg" class="socials-i socials-i_twitter"></a> <a href="#" class="socials-i socials-i_bitcoin"></a></div><p class="footer-rights">2017 Oracles Network. All rights reserved.</p></div></footer><script type="text/javascript" src="/oracles-dapps-keys-generation/static/js/main.d5fb83ac.js"></script></body></html>
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"short_name": "React App",
|
||||
"name": "Create React App Sample",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
}
|
||||
],
|
||||
"start_url": "./index.html",
|
||||
"display": "standalone",
|
||||
"theme_color": "#000000",
|
||||
"background_color": "#ffffff"
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
"use strict";function setOfCachedUrls(e){return e.keys().then(function(e){return e.map(function(e){return e.url})}).then(function(e){return new Set(e)})}var precacheConfig=[["/oracles-dapps-keys-generation/index.html","104c0e70c74b6d8392c5db27d4fdf6d9"],["/oracles-dapps-keys-generation/static/css/main.d7db86f1.css","b270c0a205cd1a9fc5f0cc1de18ce42f"],["/oracles-dapps-keys-generation/static/js/main.d5fb83ac.js","d56d33ebe6735d912336def6b299544c"],["/oracles-dapps-keys-generation/static/media/CEREMONY.3aaa882b.png","3aaa882b8d5f53f9a5ce2a953b91308e"],["/oracles-dapps-keys-generation/static/media/CEREMONY@2x.b8495078.png","b8495078a4079c685a95c0c1f7e5ba81"],["/oracles-dapps-keys-generation/static/media/CEREMONY_footer.2e9492a0.png","2e9492a0598400a58de813350a57b78e"],["/oracles-dapps-keys-generation/static/media/CEREMONY_footer@2x.7ae07c61.png","7ae07c61178e3ef4d3d36226555f933e"],["/oracles-dapps-keys-generation/static/media/bg_footer.c0181fba.png","c0181fbaa582e7c44f4c77fb50e1781b"],["/oracles-dapps-keys-generation/static/media/bg_header.55fb6ae4.png","55fb6ae4101fe4617b5e6a3463c1e701"],["/oracles-dapps-keys-generation/static/media/copy.3cdc75f3.png","3cdc75f3003bc76ad29517b20055004c"],["/oracles-dapps-keys-generation/static/media/copy@2x.d47cd69c.png","d47cd69c027f0f324b81272274164dac"],["/oracles-dapps-keys-generation/static/media/loading.26ca894e.png","26ca894ecd4a23884b43df2a9531c30a"],["/oracles-dapps-keys-generation/static/media/warning.4ba81241.svg","4ba81241140fa3db785eacddb80abdca"]],cacheName="sw-precache-v3-sw-precache-webpack-plugin-"+(self.registration?self.registration.scope:""),ignoreUrlParametersMatching=[/^utm_/],addDirectoryIndex=function(e,a){var t=new URL(e);return"/"===t.pathname.slice(-1)&&(t.pathname+=a),t.toString()},cleanResponse=function(e){if(!e.redirected)return Promise.resolve(e);return("body"in e?Promise.resolve(e.body):e.blob()).then(function(a){return new Response(a,{headers:e.headers,status:e.status,statusText:e.statusText})})},createCacheKey=function(e,a,t,n){var r=new URL(e);return n&&r.pathname.match(n)||(r.search+=(r.search?"&":"")+encodeURIComponent(a)+"="+encodeURIComponent(t)),r.toString()},isPathWhitelisted=function(e,a){if(0===e.length)return!0;var t=new URL(a).pathname;return e.some(function(e){return t.match(e)})},stripIgnoredUrlParameters=function(e,a){var t=new URL(e);return t.hash="",t.search=t.search.slice(1).split("&").map(function(e){return e.split("=")}).filter(function(e){return a.every(function(a){return!a.test(e[0])})}).map(function(e){return e.join("=")}).join("&"),t.toString()},hashParamName="_sw-precache",urlsToCacheKeys=new Map(precacheConfig.map(function(e){var a=e[0],t=e[1],n=new URL(a,self.location),r=createCacheKey(n,hashParamName,t,/\.\w{8}\./);return[n.toString(),r]}));self.addEventListener("install",function(e){e.waitUntil(caches.open(cacheName).then(function(e){return setOfCachedUrls(e).then(function(a){return Promise.all(Array.from(urlsToCacheKeys.values()).map(function(t){if(!a.has(t)){var n=new Request(t,{credentials:"same-origin"});return fetch(n).then(function(a){if(!a.ok)throw new Error("Request for "+t+" returned a response with status "+a.status);return cleanResponse(a).then(function(a){return e.put(t,a)})})}}))})}).then(function(){return self.skipWaiting()}))}),self.addEventListener("activate",function(e){var a=new Set(urlsToCacheKeys.values());e.waitUntil(caches.open(cacheName).then(function(e){return e.keys().then(function(t){return Promise.all(t.map(function(t){if(!a.has(t.url))return e.delete(t)}))})}).then(function(){return self.clients.claim()}))}),self.addEventListener("fetch",function(e){if("GET"===e.request.method){var a,t=stripIgnoredUrlParameters(e.request.url,ignoreUrlParametersMatching),n="index.html";(a=urlsToCacheKeys.has(t))||(t=addDirectoryIndex(t,n),a=urlsToCacheKeys.has(t));var r="/oracles-dapps-keys-generation/index.html";!a&&"navigate"===e.request.mode&&isPathWhitelisted(["^(?!\\/__).*"],e.request.url)&&(t=new URL(r,self.location).toString(),a=urlsToCacheKeys.has(t)),a&&e.respondWith(caches.open(cacheName).then(function(e){return e.match(urlsToCacheKeys.get(t)).then(function(e){if(e)return e;throw Error("The cached response that was expected is missing.")})}).catch(function(a){return console.warn('Couldn\'t serve response for "%s" from cache: %O',e.request.url,a),fetch(e.request)}))}});
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 105 KiB After Width: | Height: | Size: 105 KiB |
Before Width: | Height: | Size: 126 KiB After Width: | Height: | Size: 126 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 571 B After Width: | Height: | Size: 571 B |
BIN
docs/index.png
Before Width: | Height: | Size: 169 KiB |
BIN
docs/results.png
Before Width: | Height: | Size: 233 KiB |
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 15 KiB |
|
@ -1,9 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<browserconfig>
|
||||
<msapplication>
|
||||
<tile>
|
||||
<square150x150logo src="/mstile-150x150.png"/>
|
||||
<TileColor>#da532c</TileColor>
|
||||
</tile>
|
||||
</msapplication>
|
||||
</browserconfig>
|
Before Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 11 KiB |
|
@ -1,18 +0,0 @@
|
|||
{
|
||||
"name": "",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/android-chrome-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "/android-chrome-256x256.png",
|
||||
"sizes": "256x256",
|
||||
"type": "image/png"
|
||||
}
|
||||
],
|
||||
"theme_color": "#ffffff",
|
||||
"background_color": "#ffffff",
|
||||
"display": "standalone"
|
||||
}
|
Before Width: | Height: | Size: 8.7 KiB |
41
gulpfile.js
|
@ -1,41 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
const gulp = require('gulp');
|
||||
const sass = require('gulp-sass');
|
||||
const sassGlob = require('gulp-sass-glob');
|
||||
const autoprefixer = require('gulp-autoprefixer');
|
||||
const uglifycss = require('gulp-uglifycss');
|
||||
const include = require('gulp-include');
|
||||
const addsrc = require('gulp-add-src');
|
||||
const order = require('gulp-order');
|
||||
const concat = require('gulp-concat');
|
||||
const uglify = require('gulp-uglify');
|
||||
const gutil = require('gulp-util')
|
||||
|
||||
gulp.task('sass', function() {
|
||||
return gulp.src(['assets/stylesheets/*.scss'])
|
||||
.pipe(sassGlob())
|
||||
.pipe(sass().on('error', sass.logError))
|
||||
.pipe(autoprefixer())
|
||||
.pipe(uglifycss())
|
||||
.pipe(gulp.dest('assets/stylesheets/'));
|
||||
});
|
||||
|
||||
gulp.task('javascript', function() {
|
||||
return gulp.src('assets/javascripts/application/*.js')
|
||||
.pipe(addsrc('assets/javascripts/vendor/index.js'))
|
||||
.pipe(order([
|
||||
"assets/javascripts/vendor/index.js",
|
||||
"assets/javascripts/application/*.js"
|
||||
], {base: '.'}))
|
||||
.pipe(include())
|
||||
.pipe(concat('application.js'))
|
||||
//.pipe(uglify())
|
||||
.on('error', function (err) { gutil.log(gutil.colors.red('[Error]'), err.toString()); })
|
||||
.pipe(gulp.dest('assets/javascripts'));
|
||||
});
|
||||
|
||||
gulp.task('watch', function() {
|
||||
gulp.watch('assets/stylesheets/**/*.scss', ['sass']);
|
||||
gulp.watch('assets/javascripts/application/*.js', ['javascript']);
|
||||
});
|
83
index.html
|
@ -1,83 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title></title>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<meta name="theme-color" content="#6151cc">
|
||||
<meta name="msapplication-config" content="./favicons/browserconfig.xml">
|
||||
<!-- <meta property="og:title" content="">
|
||||
<meta property="og:description" content=""> -->
|
||||
<!-- <meta property="og:url" content="https://oracles.org/"> -->
|
||||
<!-- <meta property="og:image" content="https://www.notarycoin.com/assets/images/share.png"> -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="./assets/stylesheets/index.css">
|
||||
<link rel="stylesheet" type="text/css" href="./assets/stylesheets/toastr.min.css">
|
||||
<link rel="apple-touch-icon" href="./favicons/favicon-192x192.png">
|
||||
<link rel="icon" type="image/png" sizes="192x192" href="./favicons/favicon-192x192.png">
|
||||
<link rel="mask-icon" color="#6151cc" href="./favicons/safari-pinned-tab.svg">
|
||||
<link rel="manifest" href="./favicons/manifest.webmanifest">
|
||||
<link href="./favicons/favicon.ico" rel="icon" type="image/x-icon">
|
||||
</head>
|
||||
<body>
|
||||
<header class="header">
|
||||
<div class="container">
|
||||
<a href="#" class="header-logo"></a>
|
||||
</div>
|
||||
</header>
|
||||
<section class="content">
|
||||
<div class="create-keys">
|
||||
<h1>Create keys from initial key</h1>
|
||||
<h2>
|
||||
In this application, you will create mining, payout and voting keys.
|
||||
The app will make your initial key unusable after the process.
|
||||
Please proceed with care, don't lose your keys and follow instructions.
|
||||
</h2>
|
||||
<!--<form class="create-keys-inputs">
|
||||
<div class="left">
|
||||
<label for="full-name">Full name</label>
|
||||
<input type="text" id="full-name">
|
||||
<label for="address">Address</label>
|
||||
<input type="text" id="address">
|
||||
<label for="state">State</label>
|
||||
<input type="text" id="state">
|
||||
</div>
|
||||
<div class="right">
|
||||
<label for="zip">Zip code</label>
|
||||
<input type="number" id="zip">
|
||||
<label for="license-id">License id</label>
|
||||
<input type="number" id="license-id">
|
||||
<label for="license-expiration">License expiration</label>
|
||||
<input type="date" id="license-expiration">
|
||||
</div>
|
||||
</form>-->
|
||||
<a href="#" class="create-keys-button">Upload your initial key</a>
|
||||
<input type="file" id="initialKeySource"/>
|
||||
</div>
|
||||
</section>
|
||||
<div class="waiting-container"></div>
|
||||
<div class="loading-container">
|
||||
<div class="loading">
|
||||
<div class="loading-i"></div>
|
||||
<div class="loading-i"></div>
|
||||
<div class="loading-i"></div>
|
||||
<div class="loading-i"></div>
|
||||
<div class="loading-i"></div>
|
||||
<div class="loading-i"></div>
|
||||
</div>
|
||||
</div>
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<a href="#" class="footer-logo"></a>
|
||||
<div class="socials">
|
||||
<a href="#" class="socials-i socials-i_reddit"></a>
|
||||
<a href="https://twitter.com/oraclesorg" class="socials-i socials-i_twitter"></a>
|
||||
<a href="#" class="socials-i socials-i_bitcoin"></a>
|
||||
</div>
|
||||
<p class="footer-rights">2017 Oracles Network. All rights reserved.</p>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="./assets/javascripts/modules.js" type="text/javascript"></script>
|
||||
<script src="./assets/javascripts/application.js?v=1.41" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
69
keys.html
|
@ -1,69 +0,0 @@
|
|||
<div class="container">
|
||||
<div class="keys">
|
||||
<div class="keys-i">
|
||||
<p class="keys-title">Mining key</p>
|
||||
<div class="keys-hash-container">
|
||||
<p class="keys-hash" id="miningKey"></p>
|
||||
<span id="copyMiningKey" class="copy"></span>
|
||||
</div>
|
||||
<p class="keys-hash">
|
||||
<span class="password-label">Password: </span>
|
||||
<span id="miningKeyPass" class="pass"></span>
|
||||
<span id="copyMiningPass" class="copy"></span>
|
||||
</p>
|
||||
<p class="keys-description">
|
||||
Download this key and use it in your mining node to
|
||||
validate blocks in the network. Mined coins will be
|
||||
deposited to your payout account.
|
||||
</p>
|
||||
<div class="keys-footer">
|
||||
<a href="#" class="keys-download" id="miningKeyDownload">Download key</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="keys-i">
|
||||
<p class="keys-title">Payout key</p>
|
||||
<div class="keys-hash-container">
|
||||
<p class="keys-hash" id="payoutKey"></p>
|
||||
<span id="copyPayoutKey" class="copy"></span>
|
||||
</div>
|
||||
<p class="keys-hash">
|
||||
<span class="password-label">Password: </span>
|
||||
<span id="payoutKeyPass" class="pass"></span>
|
||||
<span id="copyPayoutPass" class="copy"></span>
|
||||
</p>
|
||||
<p class="keys-description">
|
||||
Download this key and use it on your client
|
||||
node/wallet to spend earned coins.
|
||||
</p>
|
||||
<div class="keys-footer">
|
||||
<a href="#" class="keys-download" id="payoutKeyDownload">Download key</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="keys-i">
|
||||
<p class="keys-title">Voting key</p>
|
||||
<div class="keys-hash-container">
|
||||
<p class="keys-hash" id="votingKey"></p>
|
||||
<span id="copyVotingKey" class="copy"></span>
|
||||
</div>
|
||||
<p class="keys-hash">
|
||||
<span class="password-label">Password: </span>
|
||||
<span id="votingKeyPass" class="pass"></span>
|
||||
<span id="copyVotingPass" class="copy"></span>
|
||||
</p>
|
||||
<p class="keys-description">
|
||||
Download this key and use it on your client node to
|
||||
vote for necessary ballots, such as adding or
|
||||
removing miners from the network.
|
||||
</p>
|
||||
<div class="keys-footer">
|
||||
<a href="#" class="keys-download" id="votingKeyDownload">Download key</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="keys-note">
|
||||
<p class="keys-note-title">Important</p>
|
||||
<p class="keys-note-description">
|
||||
Do not close this tab until you download all keys and save passwords. Keep keys secure and protected. If you lose your keys, you will need to get a new initial key using Voting DAPP.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
"id": "KeysGenerator",
|
||||
"name": "Keys Generator",
|
||||
"description": "Oracles Keys Generator",
|
||||
"version": "1.0.0",
|
||||
"author": "Oracles",
|
||||
"iconUrl": "./favicons/fav_2.png"
|
||||
}
|
15
modules.js
|
@ -1,15 +0,0 @@
|
|||
let keythereum = require("keythereum");
|
||||
let passwordGenerator = require("password-generator");
|
||||
let sweetalert2 = require("sweetalert2");
|
||||
let toastr = require("toastr");
|
||||
let jquery = require("jquery");
|
||||
let Clipboard = require("clipboard");
|
||||
let Web3 = require("web3");
|
||||
|
||||
window.keythereum = keythereum;
|
||||
window.passwordGenerator = passwordGenerator;
|
||||
window.swal = sweetalert2;
|
||||
window.toastr = toastr;
|
||||
window.$ = jquery;
|
||||
window.Clipboard = Clipboard;
|
||||
window.Web3 = Web3;
|
|
@ -1,44 +1,28 @@
|
|||
{
|
||||
"name": "oracles-dapps-keys-generation",
|
||||
"version": "1.0.0",
|
||||
"description": "Oracles network Ceremony Dapp",
|
||||
"main": "gulpfile.js",
|
||||
"devDependencies": {
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-add-src": "^0.2.0",
|
||||
"gulp-autoprefixer": "^3.1.1",
|
||||
"gulp-concat": "^2.6.1",
|
||||
"gulp-include": "^2.3.1",
|
||||
"gulp-order": "^1.1.1",
|
||||
"gulp-postcss": "^6.2.0",
|
||||
"gulp-sass": "^2.3.2",
|
||||
"gulp-sass-glob": "^1.0.6",
|
||||
"gulp-uglify": "^2.0.0",
|
||||
"gulp-uglifycss": "^1.0.6",
|
||||
"gulp-util": "^3.0.8",
|
||||
"http-server": "^0.9.0"
|
||||
},
|
||||
"scripts": {
|
||||
"sass": "gulp sass",
|
||||
"coffee": "gulp javascript",
|
||||
"watch": "gulp watch",
|
||||
"start": "browserify modules.js -o assets/javascripts/modules.js && gulp javascript && gulp sass && http-server -a localhost -p 8000"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/oraclesorg/oracles-dapps-keys-generation"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "oraclesorg",
|
||||
"license": "MIT",
|
||||
"homepage": "https://oracles.org/",
|
||||
"name": "finalapp",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"homepage": "https://rstormsf.github.io/oracles-dapps-keys-generation",
|
||||
"dependencies": {
|
||||
"clipboard": "^1.7.1",
|
||||
"jquery": "^3.2.1",
|
||||
"keythereum": "^1.0.2",
|
||||
"password-generator": "^2.2.0",
|
||||
"sweetalert2": "^7.0.3",
|
||||
"toastr": "^2.1.2",
|
||||
"web3": "^1.0.0-beta.26"
|
||||
"gh-pages": "^1.1.0",
|
||||
"node-sass-chokidar": "0.0.3",
|
||||
"npm-run-all": "^4.1.2",
|
||||
"react": "^16.2.0",
|
||||
"react-dom": "^16.2.0",
|
||||
"react-scripts": "1.0.17",
|
||||
"sweetalert": "^2.0.8"
|
||||
},
|
||||
"scripts": {
|
||||
"predeploy": "npm run build",
|
||||
"deploy": "gh-pages -d build -o rstorm",
|
||||
"build-css": "node-sass-chokidar src/index/index.scss -o src/index",
|
||||
"watch-css": "npm run build-css && node-sass-chokidar src/index/index.scss -o src/index --watch --recursive",
|
||||
"start-js": "react-scripts start",
|
||||
"start": "npm-run-all -p watch-css start-js",
|
||||
"build-js": "react-scripts build",
|
||||
"build": "npm-run-all build-css build-js",
|
||||
"test": "react-scripts test --env=jsdom",
|
||||
"eject": "react-scripts eject"
|
||||
}
|
||||
}
|
||||
|
|
After Width: | Height: | Size: 3.8 KiB |
|
@ -0,0 +1,60 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="theme-color" content="#000000">
|
||||
<!--
|
||||
manifest.json provides metadata used when your web app is added to the
|
||||
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
|
||||
-->
|
||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
|
||||
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
|
||||
<!--
|
||||
Notice the use of %PUBLIC_URL% in the tags above.
|
||||
It will be replaced with the URL of the `public` folder during the build.
|
||||
Only files inside the `public` folder can be referenced from the HTML.
|
||||
|
||||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
||||
work correctly both with client-side routing and a non-root public URL.
|
||||
Learn how to configure a non-root public URL by running `npm run build`.
|
||||
-->
|
||||
<title>React App</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<noscript>
|
||||
You need to enable JavaScript to run this app.
|
||||
</noscript>
|
||||
<header class="header">
|
||||
<div class="container">
|
||||
<a href="#" class="header-logo"></a>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div id="root"></div>
|
||||
<!--
|
||||
This HTML file is a template.
|
||||
If you open it directly in the browser, you will see an empty page.
|
||||
|
||||
You can add webfonts, meta tags, or analytics to this file.
|
||||
The build step will place the bundled scripts into the <body> tag.
|
||||
|
||||
To begin the development, run `npm start` or `yarn start`.
|
||||
To create a production bundle, use `npm run build` or `yarn build`.
|
||||
-->
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<a href="#" class="footer-logo"></a>
|
||||
<div class="socials">
|
||||
<a href="#" class="socials-i socials-i_reddit"></a>
|
||||
<a href="https://twitter.com/oraclesorg" class="socials-i socials-i_twitter"></a>
|
||||
<a href="#" class="socials-i socials-i_bitcoin"></a>
|
||||
</div>
|
||||
<p class="footer-rights">2017 Oracles Network. All rights reserved.</p>
|
||||
</div>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"short_name": "React App",
|
||||
"name": "Create React App Sample",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
}
|
||||
],
|
||||
"start_url": "./index.html",
|
||||
"display": "standalone",
|
||||
"theme_color": "#000000",
|
||||
"background_color": "#ffffff"
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
.App {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.App-logo {
|
||||
animation: App-logo-spin infinite 20s linear;
|
||||
height: 80px;
|
||||
}
|
||||
|
||||
.App-header {
|
||||
background-color: #222;
|
||||
height: 150px;
|
||||
padding: 20px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.App-title {
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
.App-intro {
|
||||
font-size: large;
|
||||
}
|
||||
|
||||
@keyframes App-logo-spin {
|
||||
from { transform: rotate(0deg); }
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
|
@ -0,0 +1,125 @@
|
|||
import React, { Component } from 'react';
|
||||
import getWeb3 from './getWeb3'
|
||||
import KeysManager from './keysManager';
|
||||
import Keys from './Keys';
|
||||
import swal from 'sweetalert';
|
||||
import './index/index.css';
|
||||
import ReactDOM from 'react-dom';
|
||||
|
||||
const Loading = () => (
|
||||
<div className="loading-container">
|
||||
<div className="loading">
|
||||
<div className="loading-i"></div>
|
||||
<div className="loading-i"></div>
|
||||
<div className="loading-i"></div>
|
||||
<div className="loading-i"></div>
|
||||
<div className="loading-i"></div>
|
||||
<div className="loading-i"></div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
||||
class App extends Component {
|
||||
constructor(props){
|
||||
super(props);
|
||||
this.onClick = this.onClick.bind(this);
|
||||
this.state = {
|
||||
web3Config: {},
|
||||
mining: null,
|
||||
isDisabledBtn: false
|
||||
}
|
||||
this.keysManager = null;
|
||||
getWeb3().then((web3Config) => {
|
||||
this.setState({web3Config})
|
||||
this.keysManager = new KeysManager({
|
||||
web3: web3Config.web3Instance
|
||||
});
|
||||
}).catch((error) => {
|
||||
if(error.msg){
|
||||
this.setState({isDisabledBtn: true});
|
||||
swal({
|
||||
icon: 'warning',
|
||||
title: 'Warning',
|
||||
content: error.node
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
async onClick() {
|
||||
this.setState({loading:true});
|
||||
const initialKey = window.web3.eth.defaultAccount;
|
||||
const isValid = await this.keysManager.isInitialKeyValid(initialKey);
|
||||
console.log(isValid);
|
||||
if(Number(isValid) !== 1){
|
||||
swal("Warning!", "The key is not valid initial Key! Please make sure you have loaded correct initial key in metamask", "warning");
|
||||
return;
|
||||
}
|
||||
if(Number(isValid) === 1){
|
||||
const mining = await this.keysManager.generateKeys();
|
||||
const voting = await this.keysManager.generateKeys();
|
||||
const payout = await this.keysManager.generateKeys();
|
||||
this.setState({
|
||||
mining,
|
||||
voting,
|
||||
payout,
|
||||
keysGenerated: true
|
||||
})
|
||||
// add loading screen
|
||||
await this.keysManager.createKeys({
|
||||
mining: mining.jsonStore.address,
|
||||
voting: voting.jsonStore.address,
|
||||
payout: payout.jsonStore.address,
|
||||
sender: initialKey
|
||||
}).then((receipt) => {
|
||||
console.log(receipt);
|
||||
this.setState({loading: false})
|
||||
swal("Congratulations!", "Your keys are generated!", "success");
|
||||
}).catch((error) => {
|
||||
console.error(error.message);
|
||||
this.setState({loading: false})
|
||||
var content = document.createElement("div");
|
||||
content.innerHTML = `<div>
|
||||
Something went wrong!<br/><br/>
|
||||
${error.message}
|
||||
</div>`;
|
||||
swal({
|
||||
icon: 'error',
|
||||
title: 'Error',
|
||||
content: content
|
||||
});
|
||||
})
|
||||
console.log(this.state);
|
||||
}
|
||||
}
|
||||
render() {
|
||||
let loader = this.state.loading ? <Loading /> : '';
|
||||
let createKeyBtn = (<div className="create-keys">
|
||||
<h1>Create keys from initial key</h1>
|
||||
<h2>
|
||||
In this application, you will create mining, payout and voting keys.
|
||||
The app will make your initial key unusable after the process.
|
||||
Please proceed with care, don't lose your keys and follow instructions.
|
||||
</h2>
|
||||
<div className="create-keys-button-container">
|
||||
<button className="create-keys-button" onClick={this.onClick} disabled={this.state.isDisabledBtn}>Generate keys</button>
|
||||
|
||||
</div>
|
||||
</div>)
|
||||
let content;
|
||||
if(this.state.keysGenerated){
|
||||
content = <Keys mining={this.state.mining} voting={this.state.voting} payout={this.state.payout}/>
|
||||
} else {
|
||||
content = createKeyBtn
|
||||
}
|
||||
return (
|
||||
<div className="App">
|
||||
{loader}
|
||||
<section className="content">
|
||||
{content}
|
||||
</section>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default App;
|
|
@ -0,0 +1,8 @@
|
|||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import App from './App';
|
||||
|
||||
it('renders without crashing', () => {
|
||||
const div = document.createElement('div');
|
||||
ReactDOM.render(<App />, div);
|
||||
});
|
|
@ -0,0 +1,93 @@
|
|||
import React, { Component } from 'react';
|
||||
const encodeJson = (json) => {
|
||||
const encoded = window.encodeURIComponent(JSON.stringify(json));
|
||||
return `data:application/json;charset=utf-8,${encoded}`;
|
||||
}
|
||||
|
||||
export default class Keys extends Component{
|
||||
componentWillUpdate(nextProps, nextState) {
|
||||
if (this.refs.miningKeyAddress) {
|
||||
const Clipboard = require('clipboard');
|
||||
// this.clipboard = new Clipboard(this.refs.copyBtn);
|
||||
new Clipboard(this.refs.miningKeyAddress);
|
||||
new Clipboard(this.refs.miningKeyPass);
|
||||
new Clipboard(this.refs.payoutKeyAddress);
|
||||
new Clipboard(this.refs.payoutKeyPass);
|
||||
new Clipboard(this.refs.votingKeyAddress);
|
||||
new Clipboard(this.refs.votingKeyPass);
|
||||
}
|
||||
}
|
||||
render(){
|
||||
return ( <div className="container">
|
||||
<div className="keys">
|
||||
<div className="keys-i">
|
||||
<p className="keys-title">Mining key</p>
|
||||
<div className="keys-hash-container">
|
||||
<p className="keys-hash" id="miningKey">0x{this.props.mining.jsonStore.address}</p>
|
||||
<span id="copyMiningKey" className="copy" ref="miningKeyAddress" data-clipboard-text={"0x"+this.props.mining.jsonStore.address}></span>
|
||||
</div>
|
||||
<p className="keys-hash">
|
||||
<span className="password-label">Password:</span>
|
||||
<span id="miningKeyPass" className="pass">{this.props.mining.password}</span>
|
||||
<span id="copyMiningPass" className="copy" ref="miningKeyPass" data-clipboard-text={this.props.mining.password} ></span>
|
||||
</p>
|
||||
<p className="keys-description">
|
||||
Download this key and use it in your mining node to
|
||||
validate blocks in the network. Mined coins will be
|
||||
deposited to your payout account.
|
||||
</p>
|
||||
<div className="keys-footer">
|
||||
<a className="keys-download" id="miningKeyDownload" href={encodeJson(this.props.mining.jsonStore)} download="Mining_Key.json">Download Mining Key</a>
|
||||
</div>
|
||||
</div>
|
||||
<div className="keys-i">
|
||||
<p className="keys-title">Payout key</p>
|
||||
<div className="keys-hash-container">
|
||||
<p className="keys-hash" id="payoutKey">0x{this.props.payout.jsonStore.address}</p>
|
||||
<span id="copyPayoutKey" className="copy" ref="payoutKeyAddress" data-clipboard-text={"0x"+this.props.payout.jsonStore.address}></span>
|
||||
</div>
|
||||
<p className="keys-hash">
|
||||
<span className="password-label">Password:</span>
|
||||
<span id="payoutKeyPass" className="pass">{this.props.payout.password}</span>
|
||||
<span id="copyPayoutPass" className="copy" ref="payoutKeyPass" data-clipboard-text={this.props.payout.password}></span>
|
||||
</p>
|
||||
<p className="keys-description">
|
||||
Download this key and use it on your client
|
||||
node/wallet to spend earned coins.
|
||||
</p>
|
||||
<div className="keys-footer">
|
||||
<a className="keys-download" id="payoutKeyDownload" href={encodeJson(this.props.payout.jsonStore)} download="Payout_Key.json">Download Payout Key</a>
|
||||
</div>
|
||||
</div>
|
||||
<div className="keys-i">
|
||||
<p className="keys-title">Voting key</p>
|
||||
<div className="keys-hash-container">
|
||||
<p className="keys-hash" id="votingKey">0x{this.props.voting.jsonStore.address}</p>
|
||||
<span id="copyVotingKey" className="copy" ref="votingKeyAddress" data-clipboard-text={"0x"+this.props.voting.jsonStore.address}></span>
|
||||
</div>
|
||||
<p className="keys-hash">
|
||||
<span className="password-label">Password:</span>
|
||||
<span id="votingKeyPass" className="pass">{this.props.voting.password}</span>
|
||||
<span id="copyVotingPass" className="copy" ref="votingKeyPass" data-clipboard-text={this.props.voting.password} ></span>
|
||||
</p>
|
||||
<p className="keys-description">
|
||||
Download this key and use it on your client node to
|
||||
vote for necessary ballots, such as adding or
|
||||
removing miners from the network.
|
||||
</p>
|
||||
<div className="keys-footer">
|
||||
<a className="keys-download" id="votingKeyDownload" href={encodeJson(this.props.voting.jsonStore)} download="Voting_Key.json">Download Voting Key</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="keys-note">
|
||||
<p className="keys-note-title">Important</p>
|
||||
<p className="keys-note-description">
|
||||
Do not close this tab until you download all keys and save passwords. Keep keys secure and protected. If you lose your keys, you will need to get a new initial key using Voting DAPP.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
import keythereum from 'keythereum';
|
||||
import passwordGenerator from 'password-generator';
|
||||
|
||||
export default function generateAddress(cb) {
|
||||
return new Promise((resolve, reject) => {
|
||||
var params = { keyBytes: 32, ivBytes: 16 };
|
||||
|
||||
var dk = keythereum.create(params);
|
||||
|
||||
keythereum.create(params, function (dk) {
|
||||
var options = {};
|
||||
var password = passwordGenerator(20, false);
|
||||
keythereum.dump(password, dk.privateKey, dk.salt, dk.iv, options, function (jsonStore) {
|
||||
resolve({jsonStore, password});
|
||||
});
|
||||
});
|
||||
})
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
let errorMsgNoMetamaskAccount = `You haven't chosen any account in MetaMask.
|
||||
Please, choose your initial key in MetaMask and reload the page.
|
||||
Check Oracles network <a href='https://github.com/oraclesorg/oracles-wiki' target='blank'>wiki</a> for more info.`;
|
||||
|
||||
|
||||
function generateElement(msg){
|
||||
let errorNode = document.createElement("div");
|
||||
errorNode.innerHTML = `<div>
|
||||
${msg}
|
||||
</div>`;
|
||||
return errorNode;
|
||||
}
|
||||
let getWeb3 = () => {
|
||||
return new Promise(function (resolve, reject) {
|
||||
// Wait for loading completion to avoid race conditions with web3 injection timing.
|
||||
window.addEventListener('load', function () {
|
||||
var results
|
||||
var web3 = window.web3
|
||||
|
||||
// Checking if Web3 has been injected by the browser (Mist/MetaMask)
|
||||
if (typeof web3 !== 'undefined') {
|
||||
// Use Mist/MetaMask's provider.
|
||||
var errorMsg = null;
|
||||
web3 = new window.Web3(web3.currentProvider)
|
||||
web3.version.getNetwork((err, netId) => {
|
||||
let netIdName;
|
||||
switch (netId) {
|
||||
case "12648430":
|
||||
netIdName = 'Oracles'
|
||||
console.log('This is oracles')
|
||||
break
|
||||
default:
|
||||
netIdName = 'ERROR'
|
||||
errorMsg = `You aren't connected to Oracles Network.
|
||||
Please, switch on Oracles plugin and refresh the page.
|
||||
Check Oracles network <a href='https://github.com/oraclesorg/oracles-wiki' target='blank'>wiki</a> for more info.`
|
||||
console.log('This is an unknown network.')
|
||||
}
|
||||
results = {
|
||||
web3Instance: web3,
|
||||
netIdName,
|
||||
netId,
|
||||
injectedWeb3: true
|
||||
}
|
||||
var defaultAccount = web3.eth.defaultAccount || null;
|
||||
if(defaultAccount === null){
|
||||
reject({msg: errorMsgNoMetamaskAccount, node: generateElement(errorMsgNoMetamaskAccount)})
|
||||
}
|
||||
if(errorMsg !== null){
|
||||
reject({msg: errorMsg, node: generateElement(errorMsg)})
|
||||
}
|
||||
resolve(results)
|
||||
})
|
||||
|
||||
console.log('Injected web3 detected.');
|
||||
|
||||
} else {
|
||||
reject({msg: errorMsgNoMetamaskAccount, node: generateElement(errorMsgNoMetamaskAccount)})
|
||||
console.error('Metamask not found');
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export default getWeb3
|
||||
|
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 105 KiB |
After Width: | Height: | Size: 126 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 541 B After Width: | Height: | Size: 541 B |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="20"><path fill="#FBFBFB" fill-rule="evenodd" d="M21.377 14.326L14.152 1.82a3.645 3.645 0 0 0-6.312 0L.488 14.54a3.636 3.636 0 0 0 0 3.64A3.645 3.645 0 0 0 3.644 20h14.712A3.643 3.643 0 0 0 22 16.36c0-.753-.23-1.455-.623-2.034zm-8.821 1.217c0 .861-.663 1.519-1.556 1.519s-1.556-.658-1.556-1.519v-.035c0-.857.663-1.519 1.556-1.519s1.556.658 1.556 1.519v.035zm.036-10.238l-.77 6.717c-.052.484-.373.785-.822.785-.449 0-.77-.305-.822-.785l-.77-6.721c-.051-.519.23-.912.715-.912h1.75c.485.004.771.397.719.916z"/></svg>
|
After Width: | Height: | Size: 571 B |
|
@ -0,0 +1,7 @@
|
|||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import App from './App';
|
||||
import registerServiceWorker from './registerServiceWorker';
|
||||
|
||||
ReactDOM.render(<App />, document.getElementById('root'));
|
||||
registerServiceWorker();
|
|
@ -1,3 +1,8 @@
|
|||
.create-keys-button-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center
|
||||
}
|
||||
.create-keys {
|
||||
@extend %item;
|
||||
padding: 30px 20px;
|
|
@ -0,0 +1,457 @@
|
|||
@font-face {
|
||||
font-family: 'Open Sans';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local("Open Sans"), local("OpenSans"), url(https://fonts.gstatic.com/s/opensans/v13/cJZKeOuBrn4kERxqtaUH3ZBw1xU1rKptJj_0jans920.woff2) format("woff2");
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000; }
|
||||
|
||||
@font-face {
|
||||
font-family: 'Open Sans';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: local("Open Sans Bold"), local("OpenSans-Bold"), url(https://fonts.gstatic.com/s/opensans/v13/k3k702ZOKiLJc3WVjuplzBampu5_7CjHW5spxoeN3Vs.woff2) format("woff2");
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000; }
|
||||
|
||||
html,
|
||||
body {
|
||||
color: #333;
|
||||
line-height: 1;
|
||||
font-size: 14px;
|
||||
font-family: 'Open Sans', sans-serif;
|
||||
-webkit-font-smoothing: antialiased; }
|
||||
|
||||
.footer, .footer-rights, .header {
|
||||
left: 0;
|
||||
right: 0; }
|
||||
|
||||
.create-keys h1, .keys-title {
|
||||
color: #333;
|
||||
text-transform: uppercase;
|
||||
font-size: 16px;
|
||||
font-weight: bold; }
|
||||
|
||||
.create-keys h2, .keys-description {
|
||||
color: #8197a2;
|
||||
line-height: 24px;
|
||||
font-size: 14px;
|
||||
font-weight: normal; }
|
||||
|
||||
.create-keys-button, .keys-download {
|
||||
transition: 0.3s background-color;
|
||||
border-radius: 3px;
|
||||
padding: 0 15px 0 32px;
|
||||
background-repeat: no-repeat;
|
||||
background-size: 12px 12px;
|
||||
background-position: left 15px center;
|
||||
color: #fff;
|
||||
line-height: 36px;
|
||||
font-size: 13px;
|
||||
text-decoration: none;
|
||||
text-transform: uppercase;
|
||||
font-weight: bold; }
|
||||
|
||||
.create-keys {
|
||||
margin-bottom: 30px;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #eee;
|
||||
background-color: #fff;
|
||||
color: #333; }
|
||||
|
||||
html,
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0; }
|
||||
|
||||
p, h1, h2, h3, h4 {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: 'Open Sans', sans-serif; }
|
||||
|
||||
html {
|
||||
height: 100%;
|
||||
background-repeat: no-repeat;
|
||||
background-attachment: fixed;
|
||||
background-size: cover;
|
||||
background-position: center center; }
|
||||
|
||||
body {
|
||||
position: relative;
|
||||
display: table;
|
||||
width: 100%;
|
||||
min-width: 960px;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
padding: 80px 0 60px; }
|
||||
|
||||
.container {
|
||||
max-width: 960px;
|
||||
margin: 0 auto; }
|
||||
|
||||
.content {
|
||||
vertical-align: middle;
|
||||
padding: 30px 10px 0px 10px;
|
||||
background-color: #fdfdfd;
|
||||
margin-left: 140px;
|
||||
margin-right: 140px; }
|
||||
|
||||
.copy {
|
||||
background-image: url("../images/copy.png");
|
||||
background-size: 14px 14px;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
display: inline-block;
|
||||
margin-left: 5px; }
|
||||
@media (min--moz-device-pixel-ratio: 1.3), (-o-min-device-pixel-ratio: 2.6 / 2), (-webkit-min-device-pixel-ratio: 1.3), (min-device-pixel-ratio: 1.3), (min-resolution: 1.3dppx) {
|
||||
.copy {
|
||||
background-image: url("../images/copy@2x.png");
|
||||
background-size: 14px 14px; } }
|
||||
|
||||
.hidden {
|
||||
display: none; }
|
||||
|
||||
input[type=file] {
|
||||
position: absolute;
|
||||
top: -100px;
|
||||
width: 100px !important; }
|
||||
|
||||
button:focus {
|
||||
outline: 0; }
|
||||
|
||||
#createKeys {
|
||||
position: absolute;
|
||||
top: -webkit-calc(50% - 20px);
|
||||
left: -webkit-calc(50% - 50px); }
|
||||
|
||||
.loader {
|
||||
border: 16px solid grey;
|
||||
border-radius: 50%;
|
||||
border-top: 16px solid white;
|
||||
width: 120px;
|
||||
height: 120px;
|
||||
-webkit-animation: spin 2s linear infinite;
|
||||
animation: spin 2s linear infinite;
|
||||
position: absolute;
|
||||
top: -webkit-calc(50% - 76px);
|
||||
left: -webkit-calc(50% - 76px); }
|
||||
|
||||
@-webkit-keyframes spin {
|
||||
0% {
|
||||
-webkit-transform: rotate(0deg); }
|
||||
100% {
|
||||
-webkit-transform: rotate(360deg); } }
|
||||
|
||||
@keyframes spin {
|
||||
0% {
|
||||
transform: rotate(0deg); }
|
||||
100% {
|
||||
transform: rotate(360deg); } }
|
||||
|
||||
.password-label {
|
||||
color: #333; }
|
||||
|
||||
button:focus {
|
||||
outline: none; }
|
||||
|
||||
.create-keys-button-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center; }
|
||||
|
||||
.create-keys {
|
||||
padding: 30px 20px; }
|
||||
.create-keys h1 {
|
||||
margin-bottom: 20px; }
|
||||
.create-keys h2 {
|
||||
margin-bottom: 20px; }
|
||||
.create-keys-button {
|
||||
margin-top: 20px;
|
||||
display: inline-block;
|
||||
background-color: #08b3f2;
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAFVBMVEX///////////////////////////9nSIHRAAAABnRSTlMASUrk5udXTd49AAAAOUlEQVR42tXQsQEAIAgDQcAn+4+snRZxAK79KokrIcNBwgYdc0Migwxk8Qsd1TJWDf/KQWobqt+9G4coA99W7as5AAAAAElFTkSuQmCC); }
|
||||
.create-keys-button:hover {
|
||||
background-color: #079dd4; }
|
||||
.create-keys-inputs {
|
||||
overflow: hidden;
|
||||
display: table;
|
||||
width: 100%; }
|
||||
.create-keys .left {
|
||||
padding-right: 10px; }
|
||||
.create-keys .right {
|
||||
padding-left: 10px; }
|
||||
.create-keys .left,
|
||||
.create-keys .right {
|
||||
display: table-cell;
|
||||
width: 48%; }
|
||||
.create-keys label:not(.radio) {
|
||||
display: block;
|
||||
margin-bottom: 15px;
|
||||
margin-top: 20px;
|
||||
text-transform: uppercase;
|
||||
font-size: 12px;
|
||||
font-weight: bold; }
|
||||
.create-keys button,
|
||||
.create-keys input,
|
||||
.create-keys textarea {
|
||||
outline: none;
|
||||
font-family: 'Open Sans', sans-serif; }
|
||||
.create-keys input,
|
||||
.create-keys textarea {
|
||||
transition: 0.3s border-color;
|
||||
width: 100%;
|
||||
border-radius: 3px;
|
||||
box-sizing: border-box;
|
||||
border: 1px solid #eee; }
|
||||
.create-keys input:focus,
|
||||
.create-keys textarea:focus {
|
||||
border-color: #08b3f2; }
|
||||
.create-keys textarea {
|
||||
padding: 15px;
|
||||
height: 110px;
|
||||
resize: none; }
|
||||
.create-keys input {
|
||||
padding: 0 15px;
|
||||
height: 36px; }
|
||||
.create-keys input[type="radio"] {
|
||||
display: none; }
|
||||
.create-keys input[type="radio"]:checked + .radio:after {
|
||||
opacity: 1; }
|
||||
|
||||
.footer {
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
bottom: 0;
|
||||
padding: 15px 10px;
|
||||
color: #fff;
|
||||
line-height: 30px;
|
||||
font-size: 12px;
|
||||
background-image: url(../images/bg_footer.png);
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover; }
|
||||
.footer .container {
|
||||
position: relative;
|
||||
overflow: hidden; }
|
||||
.footer-logo {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
width: 100px;
|
||||
height: 24px;
|
||||
background-image: url(../images/CEREMONY_footer.png);
|
||||
background-position: 0 0; }
|
||||
@media (min--moz-device-pixel-ratio: 1.3), (-o-min-device-pixel-ratio: 2.6 / 2), (-webkit-min-device-pixel-ratio: 1.3), (min-device-pixel-ratio: 1.3), (min-resolution: 1.3dppx) {
|
||||
.footer-logo {
|
||||
background-image: url("../images/CEREMONY_footer@2x.png");
|
||||
background-size: 100px 24px; } }
|
||||
.footer-rights {
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
top: 0;
|
||||
text-align: center; }
|
||||
|
||||
.header {
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
top: 0;
|
||||
padding: 18px 10px;
|
||||
background-image: url(../images/bg_header.png);
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover; }
|
||||
.header-logo {
|
||||
float: left;
|
||||
width: 149px;
|
||||
height: 35px;
|
||||
background-image: url(../images/CEREMONY.png);
|
||||
background-position: 0 0; }
|
||||
@media (min--moz-device-pixel-ratio: 1.3), (-o-min-device-pixel-ratio: 2.6 / 2), (-webkit-min-device-pixel-ratio: 1.3), (min-device-pixel-ratio: 1.3), (min-resolution: 1.3dppx) {
|
||||
.header-logo {
|
||||
background-image: url("../images/CEREMONY@2x.png");
|
||||
background-size: 149px 35px; } }
|
||||
|
||||
.keys {
|
||||
display: table;
|
||||
width: 100%;
|
||||
margin-bottom: 60px;
|
||||
text-align: left; }
|
||||
.keys-i {
|
||||
position: relative;
|
||||
display: table-cell;
|
||||
vertical-align: top;
|
||||
width: 33.33%;
|
||||
box-sizing: border-box;
|
||||
padding: 0 15px 60px 15px; }
|
||||
.keys-i:first-child {
|
||||
padding-left: 0; }
|
||||
.keys-i:last-child {
|
||||
padding-right: 0; }
|
||||
.keys-i:not(:first-child) {
|
||||
border-left: 1px solid #e1e1e1; }
|
||||
.keys-title {
|
||||
margin-bottom: 10px; }
|
||||
.keys-hash {
|
||||
height: 30px;
|
||||
color: #6d2eae;
|
||||
line-height: 16px;
|
||||
font-size: 12px;
|
||||
display: table-cell; }
|
||||
.keys-hash-container {
|
||||
display: table; }
|
||||
.keys-description {
|
||||
line-height: 18px;
|
||||
font-size: 12px; }
|
||||
.keys-footer {
|
||||
position: absolute;
|
||||
left: 15px;
|
||||
right: 15px;
|
||||
bottom: 0; }
|
||||
.keys-i:first-child .keys-footer {
|
||||
left: 0; }
|
||||
.keys-download, .keys-read-more {
|
||||
display: inline-block;
|
||||
vertical-align: middle; }
|
||||
.keys-download {
|
||||
background-color: #6d2eae;
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAANlBMVEX///////////////////////////////////////////////////////////////////////8BOg0gAAAAEXRSTlMASUtWV1hZXF1e5ebn6Orr/GN0dVoAAABnSURBVHja1cnJDYBADENRDzBsYYn7bxaCFFmMaADf/B+0YlbwNSPtE3jvv9Ad29DCsB0dVtKnN8xOGowhCdm5o/eUgOw+AktKQPYFkDygLglQhyRAXZLzWV2iLlFvRb2V7O3qeVa9C41xDOyv+UmuAAAAAElFTkSuQmCC); }
|
||||
.keys-download:hover {
|
||||
background-color: #5d2795; }
|
||||
.keys-read-more {
|
||||
margin-left: 10px;
|
||||
color: #6d2eae;
|
||||
text-decoration: none; }
|
||||
.keys-read-more:hover {
|
||||
text-decoration: underline; }
|
||||
.keys-note {
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
border: 1px solid #6d2eae;
|
||||
border-radius: 5px;
|
||||
padding: 20px 15px 20px 53px;
|
||||
background-color: rgba(109, 46, 174, 0.1);
|
||||
color: #6d2eae;
|
||||
text-align: left; }
|
||||
.keys-note:before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 42px;
|
||||
background-color: #6d2eae;
|
||||
background-image: url(../images/warning.svg);
|
||||
background-repeat: no-repeat;
|
||||
background-position: center center; }
|
||||
.keys-note-title {
|
||||
margin-bottom: 10px;
|
||||
text-transform: uppercase;
|
||||
font-size: 14px;
|
||||
font-weight: bold; }
|
||||
.keys-note-description {
|
||||
font-size: 12px; }
|
||||
|
||||
@keyframes fadeOut {
|
||||
0% {
|
||||
opacity: .2; }
|
||||
20% {
|
||||
opacity: 1;
|
||||
transform: scale(1); }
|
||||
100% {
|
||||
opacity: .2;
|
||||
transform: scale(0.3); } }
|
||||
|
||||
.loading {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
width: 146px;
|
||||
margin: -30px 0 0 -81.5px;
|
||||
padding-top: 50px; }
|
||||
.loading:before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 146px;
|
||||
height: 35px;
|
||||
background-image: url("../images/loading.png");
|
||||
background-position: 0 0; }
|
||||
.loading-container {
|
||||
position: fixed;
|
||||
z-index: 1000000;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(35, 29, 115, 0.8); }
|
||||
.loading-i {
|
||||
animation-duration: 2s;
|
||||
animation-fill-mode: forwards;
|
||||
animation-iteration-count: infinite;
|
||||
animation-name: fadeOut;
|
||||
animation-timing-function: linear;
|
||||
opacity: .2;
|
||||
width: 9px;
|
||||
height: 9px;
|
||||
border-radius: 50%;
|
||||
background-color: #fff; }
|
||||
.loading-i:nth-child(2) {
|
||||
animation-delay: .1s; }
|
||||
.loading-i:nth-child(3) {
|
||||
animation-delay: .2s; }
|
||||
.loading-i:nth-child(4) {
|
||||
animation-delay: .3s; }
|
||||
.loading-i:nth-child(5) {
|
||||
animation-delay: .4s; }
|
||||
.loading-i:nth-child(6) {
|
||||
animation-delay: .5s; }
|
||||
|
||||
.waiting-container {
|
||||
text-align: center;
|
||||
text-transform: uppercase;
|
||||
height: 100px;
|
||||
line-height: 100px; }
|
||||
|
||||
.socials {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
float: right;
|
||||
font-size: 0; }
|
||||
.socials-i {
|
||||
transition: 0.3s background-color;
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
margin-left: 10px;
|
||||
border-radius: 50%;
|
||||
background-color: rgba(255, 255, 255, 0.2); }
|
||||
@media screen and (min-width: 768px) {
|
||||
.socials-i:hover {
|
||||
background-color: rgba(255, 255, 255, 0.4); } }
|
||||
.socials-i:before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
background-image: url(../images/socials.png); }
|
||||
@media (min--moz-device-pixel-ratio: 1.3), (-o-min-device-pixel-ratio: 2.6 / 2), (-webkit-min-device-pixel-ratio: 1.3), (min-device-pixel-ratio: 1.3), (min-resolution: 1.3dppx) {
|
||||
.socials-i:before {
|
||||
background-image: url("../images/socials@2x.png");
|
||||
background-size: 15px 40px; } }
|
||||
.socials-i_reddit:before {
|
||||
width: 15px;
|
||||
height: 13px;
|
||||
margin: -6.5px 0 0 -7.5px;
|
||||
background-position: 0 -15px; }
|
||||
.socials-i_twitter:before {
|
||||
width: 15px;
|
||||
height: 12px;
|
||||
margin: -6px 0 0 -7.5px;
|
||||
background-position: 0 -28px; }
|
||||
.socials-i_bitcoin:before {
|
||||
width: 11px;
|
||||
height: 15px;
|
||||
margin: -7.5px 0 0 -5.5px;
|
||||
background-position: 0 0; }
|
|
@ -0,0 +1,11 @@
|
|||
@import './_0_fonts';
|
||||
@import './_1_mixins';
|
||||
@import './_2_placeholders';
|
||||
@import './_3_base';
|
||||
@import './addition';
|
||||
@import './create-keys';
|
||||
@import './footer';
|
||||
@import './header';
|
||||
@import './keys';
|
||||
@import './loading';
|
||||
@import './socials';
|
|
@ -23,14 +23,13 @@
|
|||
padding-top: 50px;
|
||||
|
||||
&:before {
|
||||
@include image-2x('../images/loading@2x.png');
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 146px;
|
||||
height: 35px;
|
||||
background-image: url(../images/loading.png);
|
||||
background-image: url("../images/loading.png");
|
||||
background-position: 0 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
import KeysManagerAbi from './keysManagerAbi.json'
|
||||
import Web3 from 'web3';
|
||||
import addressGenerator from './addressGenerator';
|
||||
|
||||
export default class KeysManager {
|
||||
constructor(){
|
||||
if(window.web3.currentProvider){
|
||||
let web3_10 = new Web3(window.web3.currentProvider);
|
||||
this.keysInstance = new web3_10.eth.Contract(KeysManagerAbi, '0x758492834ed6454f41d6d3d6b73d6e46d4555429');
|
||||
}
|
||||
}
|
||||
async isInitialKeyValid(initialKey) {
|
||||
return await this.keysInstance.methods.initialKeys(initialKey).call();
|
||||
}
|
||||
|
||||
async generateKeys() {
|
||||
return await addressGenerator();
|
||||
}
|
||||
createKeys({mining, voting, payout, sender}){
|
||||
return this.keysInstance.methods.createKeys(mining, voting, payout).send({from: sender})
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,434 @@
|
|||
[
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "removePayoutKey",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "removeVotingKey",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "getVotingByMining",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "getMiningKeyByVoting",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "addMiningKey",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "poaNetworkConsensus",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "miningKeyHistory",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "getTime",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "isVotingActive",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "addPayoutKey",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "initialKeys",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint8"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "swapPayoutKey",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "getPayoutByMining",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "removeMiningKey",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "maxLimitValidators",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "initiateKeys",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "addVotingKey",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "isMiningActive",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "votingContract",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "createKeys",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "initialKeysCount",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "swapVotingKey",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "swapMiningKey",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "maxNumberOfInitialKeys",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "masterOfCeremony",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "isPayoutActive",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
]
|