/
simple.js
executable file
·32 lines (29 loc) · 1.15 KB
/
simple.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env node
// Run as
// NODE_ENV=TEST node bin/simple.js
// A simple script to test a production-style departure
// outside of a unit test using .env and TEST.DEPLOYER_ADDRESS
const { Map } = require('immutable')
const { Logger } = require('demo-utils')
const LOGGER = new Logger('bin/simple')
const { deployerMixin, compileMixin, departMixin, argListMixin, run } = require('..')
const m0 = argListMixin(Map({
'anotherThing': 'foo',
unlockSeconds: 10,
sourcePathList: ['../test-contracts/contracts'],
}))
const m1 = deployerMixin(Map({}))
const m2 = compileMixin(false)
const m3 = departMixin(Map({
name: 'Simple departure',
}))
const departFunc = async (state) => {
const { compile, link, deploy, bm, deployerEth, deployerAddress, anotherThing } = state.toJS()
LOGGER.info(`Prepared signer at address ${deployerAddress}`)
LOGGER.info(`And another thing ${anotherThing}`)
await compile( 'DifferentSender', 'DifferentSender.sol' )
await link( 'DifferentSender', 'link' )
const ds = await deploy( 'DifferentSender', 'link', 'deploy' )
LOGGER.info(`Deployed DifferentSender at ${ds.get('deployAddress')}`)
}
run( m0, m1, m2, m3, departFunc )