Support of mainnet contracts

This commit is contained in:
viktor 2017-12-06 20:14:05 -08:00
parent 8f2f343cb4
commit 9bf408b4e3
7 changed files with 36 additions and 720 deletions

21
assets/javascripts/application.js Executable file → Normal file
View File

@ -101,7 +101,7 @@ function checkInitialKey(web3, initialKey, contractAddr, abi, cb) {
}
console.log(initialKey.toLowerCase())
return KeysStorage.methods.checkInitialKey(initialKey.toLowerCase()).call({from: web3.eth.defaultAccount});
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) {
@ -228,6 +228,11 @@ function createKeys(web3, keys, contractAddr, abi) {
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,
@ -327,7 +332,7 @@ function startDapp(web3, isOraclesNetwork) {
)
.then(function(_isNew) {
console.log(_isNew)
if (!_isNew) 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");
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")
@ -374,7 +379,7 @@ function startDapp(web3, isOraclesNetwork) {
config.Ethereum[config.environment].KeysStorage.abi
)
.then(function(_isNew) {
if (!_isNew) return swal("Error", "Initial key is already activated or isn't valid", "error");
if (_isNew != 1) return swal("Error", "Initial key is already activated or isn't valid", "error");
$(".loading-container").show();
@ -394,8 +399,8 @@ function startDapp(web3, isOraclesNetwork) {
function generateProductionsKeys(config, initialKey) {
console.log(config)
generateAddresses(keys, function(_keys) {
fillContractData(config, _keys)
.then(function(reciept) {
//fillContractData(config, _keys)
//.then(function(reciept) {
$(".content").hide();
$('.waiting-container').show();
$('.waiting-container').empty();
@ -415,13 +420,13 @@ function startDapp(web3, isOraclesNetwork) {
if (err.type != "REQUEST_REJECTED") swal("Error", "Error in addresses addition to contract", "error");
return;
})
})
.catch(function(err) {
//})
/*.catch(function(err) {
loadingFinished();
console.log(err.message);
if (err.type != "REQUEST_REJECTED") swal("Error", "Error in addresses addition to contract", "error");
return;
})
})*/
});
}

View File

@ -7,5 +7,5 @@ function checkInitialKey(web3, initialKey, contractAddr, abi, cb) {
}
console.log(initialKey.toLowerCase())
return KeysStorage.methods.checkInitialKey(initialKey.toLowerCase()).call({from: web3.eth.defaultAccount});
return KeysStorage.methods.initialKeys(initialKey.toLowerCase()).call({from: web3.eth.defaultAccount});
}

View File

@ -8,6 +8,11 @@ function createKeys(web3, keys, contractAddr, abi) {
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,

View File

@ -30,7 +30,7 @@ function startDapp(web3, isOraclesNetwork) {
)
.then(function(_isNew) {
console.log(_isNew)
if (!_isNew) 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");
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")
@ -77,7 +77,7 @@ function startDapp(web3, isOraclesNetwork) {
config.Ethereum[config.environment].KeysStorage.abi
)
.then(function(_isNew) {
if (!_isNew) return swal("Error", "Initial key is already activated or isn't valid", "error");
if (_isNew != 1) return swal("Error", "Initial key is already activated or isn't valid", "error");
$(".loading-container").show();
@ -97,8 +97,8 @@ function startDapp(web3, isOraclesNetwork) {
function generateProductionsKeys(config, initialKey) {
console.log(config)
generateAddresses(keys, function(_keys) {
fillContractData(config, _keys)
.then(function(reciept) {
//fillContractData(config, _keys)
//.then(function(reciept) {
$(".content").hide();
$('.waiting-container').show();
$('.waiting-container').empty();
@ -118,13 +118,13 @@ function startDapp(web3, isOraclesNetwork) {
if (err.type != "REQUEST_REJECTED") swal("Error", "Error in addresses addition to contract", "error");
return;
})
})
.catch(function(err) {
//})
/*.catch(function(err) {
loadingFinished();
console.log(err.message);
if (err.type != "REQUEST_REJECTED") swal("Error", "Error in addresses addition to contract", "error");
return;
})
})*/
});
}

File diff suppressed because one or more lines are too long

View File

@ -23091,7 +23091,7 @@ module.exports={
"_args": [
[
"elliptic@6.4.0",
"/Users/viktor/Documents/HintsProjects/BlockNotary/Oracles/oracles-dapps-keys-generation"
"/Users/viktor/Documents/HintsProjects/BlockNotary/Oracles/oracles-dapps-keys-generation-mainnet"
]
],
"_from": "elliptic@6.4.0",
@ -23117,7 +23117,7 @@ module.exports={
],
"_resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz",
"_spec": "6.4.0",
"_where": "/Users/viktor/Documents/HintsProjects/BlockNotary/Oracles/oracles-dapps-keys-generation",
"_where": "/Users/viktor/Documents/HintsProjects/BlockNotary/Oracles/oracles-dapps-keys-generation-mainnet",
"author": {
"name": "Fedor Indutny",
"email": "fedor@indutny.com"
@ -74006,7 +74006,7 @@ module.exports={
"_args": [
[
"web3@1.0.0-beta.26",
"/Users/viktor/Documents/HintsProjects/BlockNotary/Oracles/oracles-dapps-keys-generation"
"/Users/viktor/Documents/HintsProjects/BlockNotary/Oracles/oracles-dapps-keys-generation-mainnet"
]
],
"_from": "web3@1.0.0-beta.26",
@ -74030,7 +74030,7 @@ module.exports={
],
"_resolved": "https://registry.npmjs.org/web3/-/web3-1.0.0-beta.26.tgz",
"_spec": "1.0.0-beta.26",
"_where": "/Users/viktor/Documents/HintsProjects/BlockNotary/Oracles/oracles-dapps-keys-generation",
"_where": "/Users/viktor/Documents/HintsProjects/BlockNotary/Oracles/oracles-dapps-keys-generation-mainnet",
"author": {
"name": "ethereum.org"
},
@ -74235,7 +74235,7 @@ module.exports={
],
"_resolved": "git://github.com/frozeman/WebSocket-Node.git#7004c39c42ac98875ab61126e5b4a925430f592c",
"_spec": "websocket@git://github.com/frozeman/WebSocket-Node.git#7004c39c42ac98875ab61126e5b4a925430f592c",
"_where": "/Users/viktor/Documents/HintsProjects/BlockNotary/Oracles/oracles-dapps-keys-generation",
"_where": "/Users/viktor/Documents/HintsProjects/BlockNotary/Oracles/oracles-dapps-keys-generation-mainnet",
"author": {
"name": "Brian McKelvey",
"email": "brian@worlize.com",

View File

@ -33,7 +33,7 @@
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">
<!--<form class="create-keys-inputs">
<div class="left">
<label for="full-name">Full name</label>
<input type="text" id="full-name">
@ -50,7 +50,7 @@
<label for="license-expiration">License expiration</label>
<input type="date" id="license-expiration">
</div>
</form>
</form>-->
<a href="#" class="create-keys-button">Upload your initial key</a>
<input type="file" id="initialKeySource"/>
</div>