diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-05-11 18:12:39 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-11 18:12:39 +0800 |
commit | f42f608f3f97a5244f09f17ae5ee184c0f775de3 (patch) | |
tree | 08fd03d69f8a7dfcc7beadcd56c5d1624928c430 /packages/metacoin/test | |
parent | 44f17c1706e7b3208fdc0702c54a8cd943132fd3 (diff) | |
parent | c093aab350dfbd86972d6388c3923ec60fc4501a (diff) | |
download | dexon-sol-tools-f42f608f3f97a5244f09f17ae5ee184c0f775de3.tar dexon-sol-tools-f42f608f3f97a5244f09f17ae5ee184c0f775de3.tar.gz dexon-sol-tools-f42f608f3f97a5244f09f17ae5ee184c0f775de3.tar.bz2 dexon-sol-tools-f42f608f3f97a5244f09f17ae5ee184c0f775de3.tar.lz dexon-sol-tools-f42f608f3f97a5244f09f17ae5ee184c0f775de3.tar.xz dexon-sol-tools-f42f608f3f97a5244f09f17ae5ee184c0f775de3.tar.zst dexon-sol-tools-f42f608f3f97a5244f09f17ae5ee184c0f775de3.zip |
Merge pull request #574 from 0xProject/feature/rm-rf-deployer
Remove @0xproject/deployer.Deployer. Make contracts able to deploy themselves
Diffstat (limited to 'packages/metacoin/test')
-rw-r--r-- | packages/metacoin/test/metacoin_test.ts | 11 | ||||
-rw-r--r-- | packages/metacoin/test/utils/config.ts | 4 | ||||
-rw-r--r-- | packages/metacoin/test/utils/coverage.ts | 2 | ||||
-rw-r--r-- | packages/metacoin/test/utils/deployer.ts | 17 |
4 files changed, 12 insertions, 22 deletions
diff --git a/packages/metacoin/test/metacoin_test.ts b/packages/metacoin/test/metacoin_test.ts index 51830d1ef..8369632c2 100644 --- a/packages/metacoin/test/metacoin_test.ts +++ b/packages/metacoin/test/metacoin_test.ts @@ -1,15 +1,19 @@ import { BlockchainLifecycle, devConstants } from '@0xproject/dev-utils'; +import { ContractArtifact } from '@0xproject/sol-compiler'; import { LogWithDecodedArgs } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; +import * as MetacoinArtifact from '../artifacts/Metacoin.json'; import { MetacoinContract, TransferContractEventArgs } from '../src/contract_wrappers/metacoin'; import { chaiSetup } from './utils/chai_setup'; -import { deployer } from './utils/deployer'; +import { config } from './utils/config'; import { provider, web3Wrapper } from './utils/web3_wrapper'; +const artifact: ContractArtifact = MetacoinArtifact as any; + chaiSetup.configure(); const { expect } = chai; const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); @@ -19,9 +23,8 @@ describe('Metacoin', () => { const ownerAddress = devConstants.TESTRPC_FIRST_ADDRESS; const INITIAL_BALANCE = new BigNumber(10000); before(async () => { - const metacoinInstance = await deployer.deployAsync('Metacoin'); - web3Wrapper.abiDecoder.addABI(metacoinInstance.abi); - metacoin = new MetacoinContract(metacoinInstance.abi, metacoinInstance.address, provider); + metacoin = await MetacoinContract.deployFrom0xArtifactAsync(artifact, provider, config.txDefaults); + web3Wrapper.abiDecoder.addABI(metacoin.abi); }); beforeEach(async () => { await blockchainLifecycle.startAsync(); diff --git a/packages/metacoin/test/utils/config.ts b/packages/metacoin/test/utils/config.ts index d3a830754..389edb388 100644 --- a/packages/metacoin/test/utils/config.ts +++ b/packages/metacoin/test/utils/config.ts @@ -1,3 +1,4 @@ +import { devConstants } from '@0xproject/dev-utils'; import * as path from 'path'; export const config = { @@ -5,5 +6,8 @@ export const config = { artifactsDir: path.resolve(__dirname, '../../artifacts'), contractsDir: path.resolve(__dirname, '../../contracts'), ganacheLogFile: 'ganache.log', + txDefaults: { + from: devConstants.TESTRPC_FIRST_ADDRESS, + }, mnemonic: 'concert load couple harbor equip island argue ramp clarify fence smart topic', }; diff --git a/packages/metacoin/test/utils/coverage.ts b/packages/metacoin/test/utils/coverage.ts index 6b249384f..debd544ed 100644 --- a/packages/metacoin/test/utils/coverage.ts +++ b/packages/metacoin/test/utils/coverage.ts @@ -15,6 +15,6 @@ export const coverage = { }, _getCoverageSubprovider(): CoverageSubprovider { const defaultFromAddress = devConstants.TESTRPC_FIRST_ADDRESS; - return new CoverageSubprovider(config.artifactsDir, config.contractsDir, config.networkId, defaultFromAddress); + return new CoverageSubprovider(config.artifactsDir, config.contractsDir, defaultFromAddress); }, }; diff --git a/packages/metacoin/test/utils/deployer.ts b/packages/metacoin/test/utils/deployer.ts deleted file mode 100644 index 5a631fa0a..000000000 --- a/packages/metacoin/test/utils/deployer.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Deployer } from '@0xproject/deployer'; -import { devConstants } from '@0xproject/dev-utils'; -import * as path from 'path'; - -import { config } from './config'; -import { web3Wrapper } from './web3_wrapper'; - -const deployerOpts = { - provider: web3Wrapper.getProvider(), - artifactsDir: config.artifactsDir, - networkId: config.networkId, - defaults: { - from: devConstants.TESTRPC_FIRST_ADDRESS, - }, -}; - -export const deployer = new Deployer(deployerOpts); |