|
|
@ -57,7 +57,7 @@ export function callFunction (from, to, data, value, gasLimit, funAbi, txRunner, |
|
|
|
* @param {Object} execResult - execution result given by the VM |
|
|
|
* @param {Object} execResult - execution result given by the VM |
|
|
|
* @return {Object} - { error: true/false, message: DOMNode } |
|
|
|
* @return {Object} - { error: true/false, message: DOMNode } |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
export function checkVMError (txResult, abi) { |
|
|
|
export function checkVMError (execResult, abi) { |
|
|
|
const errorCode = { |
|
|
|
const errorCode = { |
|
|
|
OUT_OF_GAS: 'out of gas', |
|
|
|
OUT_OF_GAS: 'out of gas', |
|
|
|
STACK_UNDERFLOW: 'stack underflow', |
|
|
|
STACK_UNDERFLOW: 'stack underflow', |
|
|
@ -75,10 +75,10 @@ export function checkVMError (txResult, abi) { |
|
|
|
error: false, |
|
|
|
error: false, |
|
|
|
message: '' |
|
|
|
message: '' |
|
|
|
} |
|
|
|
} |
|
|
|
if (!txResult.result.execResult.exceptionError) { |
|
|
|
if (!execResult.exceptionError) { |
|
|
|
return ret |
|
|
|
return ret |
|
|
|
} |
|
|
|
} |
|
|
|
const exceptionError = txResult.result.execResult.exceptionError.error || '' |
|
|
|
const exceptionError = execResult.exceptionError.error || '' |
|
|
|
const error = `VM error: ${exceptionError}.\n` |
|
|
|
const error = `VM error: ${exceptionError}.\n` |
|
|
|
let msg |
|
|
|
let msg |
|
|
|
if (exceptionError === errorCode.INVALID_OPCODE) { |
|
|
|
if (exceptionError === errorCode.INVALID_OPCODE) { |
|
|
@ -88,7 +88,7 @@ export function checkVMError (txResult, abi) { |
|
|
|
msg = '\tThe transaction ran out of gas. Please increase the Gas Limit.\n' |
|
|
|
msg = '\tThe transaction ran out of gas. Please increase the Gas Limit.\n' |
|
|
|
ret.error = true |
|
|
|
ret.error = true |
|
|
|
} else if (exceptionError === errorCode.REVERT) { |
|
|
|
} else if (exceptionError === errorCode.REVERT) { |
|
|
|
const returnData = txResult.result.execResult.returnValue |
|
|
|
const returnData = execResult.returnValue |
|
|
|
const returnDataHex = returnData.slice(0, 4).toString('hex') |
|
|
|
const returnDataHex = returnData.slice(0, 4).toString('hex') |
|
|
|
let customError |
|
|
|
let customError |
|
|
|
if (abi) { |
|
|
|
if (abi) { |
|
|
|