From 3fc50e3615348b86e97725afe63a61ebb712da41 Mon Sep 17 00:00:00 2001 From: yann300 Date: Fri, 8 May 2015 18:12:49 +0200 Subject: [PATCH] bux fix --- mix/ClientModel.cpp | 12 ++++++++++-- mix/ClientModel.h | 1 + mix/qml/StateListModel.qml | 3 +++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/mix/ClientModel.cpp b/mix/ClientModel.cpp index a58366046..8067f62c4 100644 --- a/mix/ClientModel.cpp +++ b/mix/ClientModel.cpp @@ -373,7 +373,7 @@ void ClientModel::executeSequence(vector const& _sequence, auto contractAddressIter = m_contractAddresses.find(transaction.contractId); if (contractAddressIter == m_contractAddresses.end() || newAddress != contractAddressIter->second) { - QString contractToken = "<" + transaction.contractId + " - " + QString::number(deployedContracts.size() - 1) + ">"; + QString contractToken = retrieveToken(transaction.contractId, deployedContracts); m_contractAddresses[contractToken] = newAddress; m_contractNames[newAddress] = contractToken; contractAddressesChanged(); @@ -382,7 +382,7 @@ void ClientModel::executeSequence(vector const& _sequence, } else { - auto contractAddressIter = m_contractAddresses.find(transaction.contractId); + auto contractAddressIter = m_contractAddresses.find(retrieveToken(transaction.contractId, deployedContracts)); if (contractAddressIter == m_contractAddresses.end()) { emit runFailed("Contract '" + transaction.contractId + tr(" not deployed.") + "' " + tr(" Cannot call ") + transaction.functionId); @@ -425,6 +425,14 @@ QString ClientModel::resolveToken(QString const& _value, vector
const& return ret; } +QString ClientModel::retrieveToken(QString const& _value, vector
const& _contracts) +{ + QString ret = _value; + if (!_value.startsWith("<") && !_value.endsWith(">")) + return "<" + _value + " - " + QString::number(_contracts.size() - 1) + ">"; + return ret; +} + QString ClientModel::resolveContractName(QString const& _value) { QString ret = _value; diff --git a/mix/ClientModel.h b/mix/ClientModel.h index 15cdc7086..2ba37f593 100644 --- a/mix/ClientModel.h +++ b/mix/ClientModel.h @@ -232,6 +232,7 @@ private: QVariant formatStorageValue(SolidityType const& _type, std::map const& _storage, unsigned _offset, dev::u256 const& _slot); QString resolveToken(QString const& _value, std::vector
const& _contracts); QString resolveContractName(QString const& _value); + QString retrieveToken(QString const& _value, std::vector
const& _contracts); std::atomic m_running; std::atomic m_mining; diff --git a/mix/qml/StateListModel.qml b/mix/qml/StateListModel.qml index a7b83aec9..b4eed525d 100644 --- a/mix/qml/StateListModel.qml +++ b/mix/qml/StateListModel.qml @@ -64,6 +64,9 @@ Item { if (!r.label) r.label = r.contractId + " - " + r.functionId; + if (r.isContractCreation === undefined) + r.isContractCreation = r.functionId === r.contractId; + for (var key in t.parameters) r.parameters[key] = t.parameters[key];