diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-06-12 13:03:22 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-12 13:03:22 +0800 |
commit | 71934f05a8758a180d85797156eb254360d9e5ce (patch) | |
tree | dc774b4a4a6f260c75365f5c9f00a7cd3db21689 /packages/metacoin/test/utils/profiler.ts | |
parent | 746b1d0c4d0c5a6442373655877b268d365f9a0a (diff) | |
parent | 534a0d68362abb5a7e643852015c3496bead705c (diff) | |
download | dexon-sol-tools-71934f05a8758a180d85797156eb254360d9e5ce.tar dexon-sol-tools-71934f05a8758a180d85797156eb254360d9e5ce.tar.gz dexon-sol-tools-71934f05a8758a180d85797156eb254360d9e5ce.tar.bz2 dexon-sol-tools-71934f05a8758a180d85797156eb254360d9e5ce.tar.lz dexon-sol-tools-71934f05a8758a180d85797156eb254360d9e5ce.tar.xz dexon-sol-tools-71934f05a8758a180d85797156eb254360d9e5ce.tar.zst dexon-sol-tools-71934f05a8758a180d85797156eb254360d9e5ce.zip |
Merge pull request #687 from 0xProject/feature/metacoin-docs
Add profiler and geth tests to metacoin
Diffstat (limited to 'packages/metacoin/test/utils/profiler.ts')
-rw-r--r-- | packages/metacoin/test/utils/profiler.ts | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/packages/metacoin/test/utils/profiler.ts b/packages/metacoin/test/utils/profiler.ts new file mode 100644 index 000000000..701337451 --- /dev/null +++ b/packages/metacoin/test/utils/profiler.ts @@ -0,0 +1,27 @@ +import { devConstants } from '@0xproject/dev-utils'; +import { ProfilerSubprovider, SolCompilerArtifactAdapter } from '@0xproject/sol-cov'; +import * as _ from 'lodash'; + +import { config } from './config'; + +let profilerSubprovider: ProfilerSubprovider; + +export const profiler = { + start(): void { + profiler.getProfilerSubproviderSingleton().start(); + }, + stop(): void { + profiler.getProfilerSubproviderSingleton().stop(); + }, + getProfilerSubproviderSingleton(): ProfilerSubprovider { + if (_.isUndefined(profilerSubprovider)) { + profilerSubprovider = profiler._getProfilerSubprovider(); + } + return profilerSubprovider; + }, + _getProfilerSubprovider(): ProfilerSubprovider { + const defaultFromAddress = devConstants.TESTRPC_FIRST_ADDRESS; + const zeroExArtifactsAdapter = new SolCompilerArtifactAdapter(config.artifactsDir, config.contractsDir); + return new ProfilerSubprovider(zeroExArtifactsAdapter, defaultFromAddress); + }, +}; |