Browse Source

bux fix

cl-refactor
yann300 10 years ago
parent
commit
3fc50e3615
  1. 12
      mix/ClientModel.cpp
  2. 1
      mix/ClientModel.h
  3. 3
      mix/qml/StateListModel.qml

12
mix/ClientModel.cpp

@ -373,7 +373,7 @@ void ClientModel::executeSequence(vector<TransactionSettings> 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<TransactionSettings> 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<Address> const&
return ret;
}
QString ClientModel::retrieveToken(QString const& _value, vector<Address> 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;

1
mix/ClientModel.h

@ -232,6 +232,7 @@ private:
QVariant formatStorageValue(SolidityType const& _type, std::map<dev::u256, dev::u256> const& _storage, unsigned _offset, dev::u256 const& _slot);
QString resolveToken(QString const& _value, std::vector<Address> const& _contracts);
QString resolveContractName(QString const& _value);
QString retrieveToken(QString const& _value, std::vector<Address> const& _contracts);
std::atomic<bool> m_running;
std::atomic<bool> m_mining;

3
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];

Loading…
Cancel
Save