diff options
author | Alex Browne <stephenalexbrowne@gmail.com> | 2018-06-15 04:58:28 +0800 |
---|---|---|
committer | Alex Browne <stephenalexbrowne@gmail.com> | 2018-06-15 04:58:54 +0800 |
commit | 7ab921669bf52c1cb2d43350b2cccc8efe91bdbd (patch) | |
tree | 3ed0e1047f6b9bb04ce7084cb0b98bdb5cb5b78a /packages/contracts/src/utils/revert_trace.ts | |
parent | 4efd28c092e74b438d0397069c0c55cc90c537f2 (diff) | |
download | dexon-sol-tools-7ab921669bf52c1cb2d43350b2cccc8efe91bdbd.tar dexon-sol-tools-7ab921669bf52c1cb2d43350b2cccc8efe91bdbd.tar.gz dexon-sol-tools-7ab921669bf52c1cb2d43350b2cccc8efe91bdbd.tar.bz2 dexon-sol-tools-7ab921669bf52c1cb2d43350b2cccc8efe91bdbd.tar.lz dexon-sol-tools-7ab921669bf52c1cb2d43350b2cccc8efe91bdbd.tar.xz dexon-sol-tools-7ab921669bf52c1cb2d43350b2cccc8efe91bdbd.tar.zst dexon-sol-tools-7ab921669bf52c1cb2d43350b2cccc8efe91bdbd.zip |
Introduce subprovider for printing revert stack traces
Diffstat (limited to 'packages/contracts/src/utils/revert_trace.ts')
-rw-r--r-- | packages/contracts/src/utils/revert_trace.ts | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/packages/contracts/src/utils/revert_trace.ts b/packages/contracts/src/utils/revert_trace.ts new file mode 100644 index 000000000..0bf8384bc --- /dev/null +++ b/packages/contracts/src/utils/revert_trace.ts @@ -0,0 +1,21 @@ +import { devConstants } from '@0xproject/dev-utils'; +import { RevertTraceSubprovider, SolCompilerArtifactAdapter } from '@0xproject/sol-cov'; +import * as _ from 'lodash'; + +let revertTraceSubprovider: RevertTraceSubprovider; + +export const revertTrace = { + getRevertTraceSubproviderSingleton(): RevertTraceSubprovider { + if (_.isUndefined(revertTraceSubprovider)) { + revertTraceSubprovider = revertTrace._getRevertTraceSubprovider(); + } + return revertTraceSubprovider; + }, + _getRevertTraceSubprovider(): RevertTraceSubprovider { + const defaultFromAddress = devConstants.TESTRPC_FIRST_ADDRESS; + const solCompilerArtifactAdapter = new SolCompilerArtifactAdapter(); + const isVerbose = true; + const subprovider = new RevertTraceSubprovider(solCompilerArtifactAdapter, defaultFromAddress, isVerbose); + return subprovider; + }, +}; |