aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contract-wrappers/test/utils/migrate.ts
diff options
context:
space:
mode:
authorKadinsky <kandinsky454@protonmail.ch>2018-10-16 21:21:46 +0800
committerGitHub <noreply@github.com>2018-10-16 21:21:46 +0800
commite62458705039f6a187ff23e4e4ee1737476eb431 (patch)
tree27497ebaf0e7da27561620b28b28cc30833261fc /packages/contract-wrappers/test/utils/migrate.ts
parent05bf7a8280bcb46144dfef9b30bb7c0e2e4a15aa (diff)
parent5938e8a52daa913668593977e44ca25e38a29e41 (diff)
downloaddexon-sol-tools-e62458705039f6a187ff23e4e4ee1737476eb431.tar
dexon-sol-tools-e62458705039f6a187ff23e4e4ee1737476eb431.tar.gz
dexon-sol-tools-e62458705039f6a187ff23e4e4ee1737476eb431.tar.bz2
dexon-sol-tools-e62458705039f6a187ff23e4e4ee1737476eb431.tar.lz
dexon-sol-tools-e62458705039f6a187ff23e4e4ee1737476eb431.tar.xz
dexon-sol-tools-e62458705039f6a187ff23e4e4ee1737476eb431.tar.zst
dexon-sol-tools-e62458705039f6a187ff23e4e4ee1737476eb431.zip
Merge pull request #1105 from 0xProject/feature/contracts-artifacts-re-org
Reorganize and modularize generated contract wrappers and artifacts
Diffstat (limited to 'packages/contract-wrappers/test/utils/migrate.ts')
-rw-r--r--packages/contract-wrappers/test/utils/migrate.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/packages/contract-wrappers/test/utils/migrate.ts b/packages/contract-wrappers/test/utils/migrate.ts
new file mode 100644
index 000000000..53319a383
--- /dev/null
+++ b/packages/contract-wrappers/test/utils/migrate.ts
@@ -0,0 +1,18 @@
+import { ContractAddresses } from '@0xproject/contract-addresses';
+import { devConstants } from '@0xproject/dev-utils';
+import { runMigrationsOnceAsync } from '@0xproject/migrations';
+
+import { provider } from './web3_wrapper';
+
+/**
+ * Configures and runs the migrations exactly once. Any subsequent times this is
+ * called, it returns the cached addresses.
+ * @returns The addresses of contracts that were deployed during the migrations.
+ */
+export async function migrateOnceAsync(): Promise<ContractAddresses> {
+ const txDefaults = {
+ gas: devConstants.GAS_LIMIT,
+ from: devConstants.TESTRPC_FIRST_ADDRESS,
+ };
+ return runMigrationsOnceAsync(provider, txDefaults);
+}