Commit 05191c14 authored by yann300's avatar yann300

don/'t add instances if the creation fails

parent 38debddc
...@@ -355,7 +355,9 @@ function contractDropdown (events, appAPI, appEvents, opts, self) { ...@@ -355,7 +355,9 @@ function contractDropdown (events, appAPI, appEvents, opts, self) {
if (!error) { if (!error) {
appAPI.logMessage(`creation of ${selectedContract.name} pending...`) appAPI.logMessage(`creation of ${selectedContract.name} pending...`)
opts.udapp.createContract(data, (error, txResult) => { opts.udapp.createContract(data, (error, txResult) => {
if (!error) { if (error) {
appAPI.logMessage(`creation of ${selectedContract.name} errored: ` + error)
} else {
var isVM = executionContext.isVM() var isVM = executionContext.isVM()
if (isVM) { if (isVM) {
var vmError = txExecution.checkVMError(txResult) var vmError = txExecution.checkVMError(txResult)
...@@ -364,12 +366,14 @@ function contractDropdown (events, appAPI, appEvents, opts, self) { ...@@ -364,12 +366,14 @@ function contractDropdown (events, appAPI, appEvents, opts, self) {
return return
} }
} }
if (txResult.result.status && txResult.result.status === '0x0') {
appAPI.logMessage(`creation of ${selectedContract.name} errored: transaction execution failed`)
return
}
var noInstancesText = self._view.noInstancesText var noInstancesText = self._view.noInstancesText
if (noInstancesText.parentNode) { noInstancesText.parentNode.removeChild(noInstancesText) } if (noInstancesText.parentNode) { noInstancesText.parentNode.removeChild(noInstancesText) }
var address = isVM ? txResult.result.createdAddress : txResult.result.contractAddress var address = isVM ? txResult.result.createdAddress : txResult.result.contractAddress
instanceContainer.appendChild(opts.udappUI.renderInstance(selectedContract.contract.object, address, selectContractNames.value)) instanceContainer.appendChild(opts.udappUI.renderInstance(selectedContract.contract.object, address, selectContractNames.value))
} else {
appAPI.logMessage(`creation of ${selectedContract.name} errored: ` + error)
} }
}) })
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment