(Update) Set gasPrice = 0 for DAI networks

This commit is contained in:
Vadim Arasev 2018-10-04 15:36:03 +03:00
parent b3656f3fb8
commit ee4d4b4927
2 changed files with 12 additions and 7 deletions

View File

@ -109,9 +109,9 @@ class App extends Component {
console.log(isValid);
if(Number(isValid) !== 1){
this.setState({loading:false});
const invalidKeyMsg = `The key is invalid initial Key<br/>
or you're connect to incorrect chain!<br/>
Please make sure you have loaded correct initial key in Metamask.<br/><br/>
const invalidKeyMsg = `The key is an invalid Initial key<br/>
or you're connected to the incorrect chain!<br/>
Please make sure you have loaded correct Initial key in MetaMask.<br/><br/>
<b>Your current selected key is</b> <i>${initialKey}</i><br/>
<b>Current Network ID</b> is <i>${this.state.web3Config.netId}</i>`
swal({
@ -156,7 +156,7 @@ class App extends Component {
let content = document.createElement("div");
let msg;
if (error.message.includes(constants.userDeniedTransactionPattern))
msg = `Error: User ${constants.userDeniedTransactionPattern}`
msg = `Error: ${constants.userDeniedTransactionPattern}`
else
msg = error.message
content.innerHTML = `<div>

View File

@ -1,6 +1,7 @@
import Web3 from 'web3';
import addressGenerator from './addressGenerator';
import helpers from "./helpers";
import { constants } from "./constants";
export default class KeysManager {
async init({web3, netId, addresses}){
@ -12,6 +13,7 @@ export default class KeysManager {
const KeysManagerAbi = await helpers.getABI(branch, 'KeysManager')
this.keysInstance = new this.web3_10.eth.Contract(KeysManagerAbi, KEYS_MANAGER_ADDRESS);
this.netId = netId;
}
async isInitialKeyValid(initialKey) {
@ -34,9 +36,12 @@ export default class KeysManager {
async generateKeys() {
return await addressGenerator();
}
createKeys({mining, voting, payout, sender}){
const gasPrice = this.web3_10.utils.toWei('2', 'gwei')
return this.keysInstance.methods.createKeys(mining, voting, payout).send({from: sender, gasPrice})
let gasPrice = this.web3_10.utils.toWei('2', 'gwei');
if (this.netId === constants.NETID_DAI_TEST || this.netId === constants.NETID_DAI) {
gasPrice = 0;
}
return this.keysInstance.methods.createKeys(mining, voting, payout).send({from: sender, gasPrice});
}
}