Merge pull request #3446 from ethcore/ng-tokenreg-correct-owner

Use Contract owner for unregistering Token
This commit is contained in:
Jaco Greeff 2016-11-15 13:45:57 +01:00 committed by GitHub
commit 10c503b5c7
2 changed files with 6 additions and 6 deletions

View File

@ -25,7 +25,7 @@ const initialState = {
isLoading: true, isLoading: true,
subscriptionId: null, subscriptionId: null,
contract: { contract: {
addres: null, address: null,
instance: null, instance: null,
raw: null, raw: null,
owner: null, owner: null,

View File

@ -239,22 +239,22 @@ export const addGithubhintURL = (from, key, url) => (dispatch, getState) => {
export const unregisterToken = (index) => (dispatch, getState) => { export const unregisterToken = (index) => (dispatch, getState) => {
console.log('unregistering token', index); console.log('unregistering token', index);
const state = getState(); const { contract } = getState().status;
const contractInstance = state.status.contract.instance; const { instance, owner } = contract;
const values = [ index ]; const values = [ index ];
const options = { const options = {
from: state.accounts.selected.address from: owner
}; };
contractInstance instance
.unregister .unregister
.estimateGas(options, values) .estimateGas(options, values)
.then((gasEstimate) => { .then((gasEstimate) => {
options.gas = gasEstimate.mul(1.2).toFixed(0); options.gas = gasEstimate.mul(1.2).toFixed(0);
console.log(`transfer: gas estimated as ${gasEstimate.toFixed(0)} setting to ${options.gas}`); console.log(`transfer: gas estimated as ${gasEstimate.toFixed(0)} setting to ${options.gas}`);
return contractInstance.unregister.postTransaction(options, values); return instance.unregister.postTransaction(options, values);
}) })
.catch((e) => { .catch((e) => {
console.error(`unregisterToken #${index} error`, e); console.error(`unregisterToken #${index} error`, e);