Use the registry fee in Token Deployment dapp (#4915)
This commit is contained in:
parent
1f7fb1591d
commit
f8aec7571f
@ -253,23 +253,28 @@ export default class Deployment extends Component {
|
|||||||
|
|
||||||
onDeploy = () => {
|
onDeploy = () => {
|
||||||
const { managerInstance, registryInstance, tokenregInstance } = this.context;
|
const { managerInstance, registryInstance, tokenregInstance } = this.context;
|
||||||
const { base, deployBusy, globalReg, globalFee, name, nameError, tla, tlaError, totalSupply, totalSupplyError } = this.state;
|
const { base, deployBusy, globalReg, name, nameError, tla, tlaError, totalSupply, totalSupplyError } = this.state;
|
||||||
const hasError = !!(nameError || tlaError || totalSupplyError);
|
const hasError = !!(nameError || tlaError || totalSupplyError);
|
||||||
|
|
||||||
if (hasError || deployBusy) {
|
if (hasError || deployBusy) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const tokenreg = (globalReg ? tokenregInstance : registryInstance).address;
|
const registry = globalReg ? tokenregInstance : registryInstance;
|
||||||
|
const tokenreg = registry.address;
|
||||||
|
|
||||||
const values = [base.mul(totalSupply), tla, name, tokenreg];
|
const values = [base.mul(totalSupply), tla, name, tokenreg];
|
||||||
const options = {
|
const options = {};
|
||||||
value: globalReg ? globalFee : 0
|
|
||||||
};
|
|
||||||
|
|
||||||
this.setState({ deployBusy: true, deployState: 'Estimating gas for the transaction' });
|
this.setState({ deployBusy: true, deployState: 'Estimating gas for the transaction' });
|
||||||
|
|
||||||
return api.parity
|
return registry.fee.call({}, [])
|
||||||
.defaultAccount()
|
.then((fee) => {
|
||||||
|
console.log('deploying with fee of', fee.toFixed());
|
||||||
|
options.value = fee;
|
||||||
|
|
||||||
|
return api.parity.defaultAccount();
|
||||||
|
})
|
||||||
.then((defaultAddress) => {
|
.then((defaultAddress) => {
|
||||||
options.from = defaultAddress;
|
options.from = defaultAddress;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user