aboutsummaryrefslogtreecommitdiffstats
path: root/packages/dev-utils/src
diff options
context:
space:
mode:
authorJacob Evans <jacob@dekz.net>2018-12-17 09:42:27 +0800
committerJacob Evans <jacob@dekz.net>2018-12-17 12:44:24 +0800
commit2a577e04750f9f90f72f763b45232dd9b5a35d93 (patch)
tree5b6837a220835361d7bc92e62c17e81ced6a1dde /packages/dev-utils/src
parent737d1dc54d72872e24abce5a1dbe1b66d35fa21a (diff)
downloaddexon-sol-tools-2a577e04750f9f90f72f763b45232dd9b5a35d93.tar
dexon-sol-tools-2a577e04750f9f90f72f763b45232dd9b5a35d93.tar.gz
dexon-sol-tools-2a577e04750f9f90f72f763b45232dd9b5a35d93.tar.bz2
dexon-sol-tools-2a577e04750f9f90f72f763b45232dd9b5a35d93.tar.lz
dexon-sol-tools-2a577e04750f9f90f72f763b45232dd9b5a35d93.tar.xz
dexon-sol-tools-2a577e04750f9f90f72f763b45232dd9b5a35d93.tar.zst
dexon-sol-tools-2a577e04750f9f90f72f763b45232dd9b5a35d93.zip
Add Docker image and Snapshot commands
Diffstat (limited to 'packages/dev-utils/src')
-rw-r--r--packages/dev-utils/src/web3_factory.ts6
1 files changed, 6 insertions, 0 deletions
diff --git a/packages/dev-utils/src/web3_factory.ts b/packages/dev-utils/src/web3_factory.ts
index b22bcc88b..5f8981a46 100644
--- a/packages/dev-utils/src/web3_factory.ts
+++ b/packages/dev-utils/src/web3_factory.ts
@@ -17,6 +17,7 @@ export interface Web3Config {
shouldThrowErrorsOnGanacheRPCResponse?: boolean; // default: true
rpcUrl?: string; // default: localhost:8545
shouldUseFakeGasEstimate?: boolean; // default: true
+ ganacheDatabasePath?: string; // default: undefined, creates a tmp dir
}
export const web3Factory = {
@@ -45,9 +46,14 @@ export const web3Factory = {
const shouldThrowErrorsOnGanacheRPCResponse =
_.isUndefined(config.shouldThrowErrorsOnGanacheRPCResponse) ||
config.shouldThrowErrorsOnGanacheRPCResponse;
+ if (!_.isUndefined(config.ganacheDatabasePath)) {
+ // Saving the snapshot to a local db. Ganache requires this directory to exist
+ fs.mkdirSync(config.ganacheDatabasePath);
+ }
provider.addProvider(
new GanacheSubprovider({
vmErrorsOnRPCResponse: shouldThrowErrorsOnGanacheRPCResponse,
+ db_path: config.ganacheDatabasePath,
gasLimit: constants.GAS_LIMIT,
logger,
verbose: env.parseBoolean(EnvVars.VerboseGanache),