Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Use the registry fee in Token Deployment dapp #4915

Merged
merged 1 commit into from
Mar 15, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions js/src/dapps/tokendeploy/Deploy/Deployment/deployment.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,23 +253,28 @@ export default class Deployment extends Component {

onDeploy = () => {
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);

if (hasError || deployBusy) {
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 options = {
value: globalReg ? globalFee : 0
};
const options = {};

this.setState({ deployBusy: true, deployState: 'Estimating gas for the transaction' });

return api.parity
.defaultAccount()
return registry.fee.call({}, [])
.then((fee) => {
console.log('deploying with fee of', fee.toFixed());
options.value = fee;

return api.parity.defaultAccount();
})
.then((defaultAddress) => {
options.from = defaultAddress;

Expand Down