diff --git a/apps/remix-ide/src/app/compiler/compiler-artefacts.js b/apps/remix-ide/src/app/compiler/compiler-artefacts.js index 631affde8e..68b1cad9bd 100644 --- a/apps/remix-ide/src/app/compiler/compiler-artefacts.js +++ b/apps/remix-ide/src/app/compiler/compiler-artefacts.js @@ -67,6 +67,11 @@ module.exports = class CompilerArtefacts extends Plugin { return contractsData } + getCompilerAbstract (file) { + return this.compilersArtefactsPerFile[file] + } + + // compilerData is a CompilerAbstract object addResolvedContract (address, compilerData) { this.compilersArtefacts[address] = compilerData } diff --git a/apps/remix-ide/src/app/compiler/compiler-sourceVerifier-fetchAndCompile.js b/apps/remix-ide/src/app/compiler/compiler-sourceVerifier-fetchAndCompile.js index 5748cea971..d9fbdc5cce 100644 --- a/apps/remix-ide/src/app/compiler/compiler-sourceVerifier-fetchAndCompile.js +++ b/apps/remix-ide/src/app/compiler/compiler-sourceVerifier-fetchAndCompile.js @@ -33,7 +33,7 @@ export default class FetchAndCompile extends Plugin { contractAddress = ethutil.toChecksumAddress(contractAddress) const compilersartefacts = globalRegistry.get('compilersartefacts').api - const localCompilation = () => compilersartefacts.get('__last') ? compilersartefacts.get('__last') : null + const localCompilation = () => compilersartefacts.get(contractAddress) ? compilersartefacts.get(contractAddress) : compilersartefacts.get('__last') ? compilersartefacts.get('__last') : null const resolved = compilersartefacts.get(contractAddress) if (resolved) return resolved diff --git a/apps/remix-ide/src/app/panels/terminal.js b/apps/remix-ide/src/app/panels/terminal.js index 25f3e3e546..367de3d943 100644 --- a/apps/remix-ide/src/app/panels/terminal.js +++ b/apps/remix-ide/src/app/panels/terminal.js @@ -478,8 +478,8 @@ class Terminal extends Plugin { self._components.txLogger.event.register('debuggingRequested', async (hash) => { // TODO should probably be in the run module if (!await self._opts.appManager.isActive('debugger')) await self._opts.appManager.activatePlugin('debugger') - this.call('debugger', 'debug', hash) this.call('menuicons', 'select', 'debugger') + this.call('debugger', 'debug', hash) }) return self._view.el diff --git a/apps/remix-ide/src/app/tabs/runTab/contractDropdown.js b/apps/remix-ide/src/app/tabs/runTab/contractDropdown.js index 0e3918ed6a..f712a81d94 100644 --- a/apps/remix-ide/src/app/tabs/runTab/contractDropdown.js +++ b/apps/remix-ide/src/app/tabs/runTab/contractDropdown.js @@ -1,13 +1,14 @@ import publishToStorage from '../../../publishToStorage' -var yo = require('yo-yo') -var css = require('../styles/run-tab-styles') -var modalDialogCustom = require('../../ui/modal-dialog-custom') -var remixLib = require('@remix-project/remix-lib') -var EventManager = remixLib.EventManager -var confirmDialog = require('../../ui/confirmDialog') -var modalDialog = require('../../ui/modaldialog') -var MultiParamManager = require('../../ui/multiParamManager') +const yo = require('yo-yo') +const css = require('../styles/run-tab-styles') +const modalDialogCustom = require('../../ui/modal-dialog-custom') +const remixLib = require('@remix-project/remix-lib') +const EventManager = remixLib.EventManager +const confirmDialog = require('../../ui/confirmDialog') +const modalDialog = require('../../ui/modaldialog') +const MultiParamManager = require('../../ui/multiParamManager') +const helper = require('../../../lib/helper') class ContractDropdownUI { constructor (blockchain, dropdownLogic, logCallback, runView) { @@ -279,6 +280,8 @@ class ContractDropdownUI { } } + const self = this + var promptCb = (okCb, cancelCb) => { modalDialogCustom.promptPassphrase('Passphrase requested', 'Personal mode is enabled. Please provide passphrase of account', '', okCb, cancelCb) } @@ -288,15 +291,18 @@ class ContractDropdownUI { } var finalCb = (error, contractObject, address) => { - this.event.trigger('clearInstance') + self.event.trigger('clearInstance') if (error) { return this.logCallback(error) } - this.event.trigger('newContractInstanceAdded', [contractObject, address, contractObject.name]) - if (this.ipfsCheckedState) { - publishToStorage('ipfs', this.runView.fileProvider, this.runView.fileManager, selectedContract) + self.event.trigger('newContractInstanceAdded', [contractObject, address, contractObject.name]) + + const data = self.runView.compilersArtefacts.getCompilerAbstract(contractObject.contract.file) + self.runView.compilersArtefacts.addResolvedContract(helper.addressToString(address), data) + if (self.ipfsCheckedState) { + publishToStorage('ipfs', self.runView.fileProvider, self.runView.fileManager, selectedContract) } } diff --git a/apps/remix-ide/src/app/tabs/runTab/model/recorder.js b/apps/remix-ide/src/app/tabs/runTab/model/recorder.js index c82bbd1225..d30791a3e6 100644 --- a/apps/remix-ide/src/app/tabs/runTab/model/recorder.js +++ b/apps/remix-ide/src/app/tabs/runTab/model/recorder.js @@ -4,11 +4,10 @@ var remixLib = require('@remix-project/remix-lib') var EventManager = remixLib.EventManager var format = remixLib.execution.txFormat var txHelper = remixLib.execution.txHelper +const helper = require('../../../../lib/helper') /** * Record transaction as long as the user create them. - * - * */ class Recorder { constructor (blockchain) { @@ -69,8 +68,7 @@ class Recorder { if (call) return if (!rawAddress) return // not a contract creation - const stringAddress = this.addressToString(rawAddress) - const address = ethutil.toChecksumAddress(stringAddress) + const address = helper.addressToString(rawAddress) // save back created addresses for the convertion from tokens to real adresses this.data._createdContracts[address] = timestamp this.data._createdContractsReverse[timestamp] = address @@ -252,8 +250,7 @@ class Recorder { return logCallBack(err + '. Execution failed at ' + index) } if (rawAddress) { - const stringAddress = self.addressToString(rawAddress) - const address = ethutil.toChecksumAddress(stringAddress) + const address = helper.addressToString(rawAddress) // save back created addresses for the convertion from tokens to real adresses self.data._createdContracts[address] = tx.timestamp self.data._createdContractsReverse[tx.timestamp] = address @@ -265,17 +262,6 @@ class Recorder { }, () => { self.setListen(true); self.clearAll() }) } - addressToString (address) { - if (!address) return null - if (typeof address !== 'string') { - address = address.toString('hex') - } - if (address.indexOf('0x') === -1) { - address = '0x' + address - } - return address - } - runScenario (json, continueCb, promptCb, alertCb, confirmationCb, logCallBack, cb) { if (!json) { return cb('a json content must be provided') diff --git a/apps/remix-ide/src/app/ui/txLogger.js b/apps/remix-ide/src/app/ui/txLogger.js index 9546f7c110..9a945a805d 100644 --- a/apps/remix-ide/src/app/ui/txLogger.js +++ b/apps/remix-ide/src/app/ui/txLogger.js @@ -215,7 +215,14 @@ function renderKnownTransaction (self, data, blockchain) { ${checkTxStatus(data.receipt, txType)} ${context(self, { from, to, data }, blockchain)}
-
+