diff options
Diffstat (limited to 'packages/contracts/migrations')
7 files changed, 126 insertions, 130 deletions
diff --git a/packages/contracts/migrations/1_initial_migration.ts b/packages/contracts/migrations/1_initial_migration.ts index b34bbc2a1..8661ee218 100644 --- a/packages/contracts/migrations/1_initial_migration.ts +++ b/packages/contracts/migrations/1_initial_migration.ts @@ -1,5 +1,5 @@ -import {Artifacts} from '../util/artifacts'; -const {Migrations} = new Artifacts(artifacts); +import { Artifacts } from '../util/artifacts'; +const { Migrations } = new Artifacts(artifacts); module.exports = (deployer: any) => { deployer.deploy(Migrations); diff --git a/packages/contracts/migrations/2_deploy_independent_contracts.ts b/packages/contracts/migrations/2_deploy_independent_contracts.ts index b465db7db..ac1752347 100644 --- a/packages/contracts/migrations/2_deploy_independent_contracts.ts +++ b/packages/contracts/migrations/2_deploy_independent_contracts.ts @@ -1,11 +1,6 @@ -import {Artifacts} from '../util/artifacts'; -import {MultiSigConfigByNetwork} from '../util/types'; -const { - MultiSigWalletWithTimeLock, - TokenTransferProxy, - EtherToken, - TokenRegistry, -} = new Artifacts(artifacts); +import { Artifacts } from '../util/artifacts'; +import { MultiSigConfigByNetwork } from '../util/types'; +const { MultiSigWalletWithTimeLock, TokenTransferProxy, EtherToken, TokenRegistry } = new Artifacts(artifacts); let multiSigConfigByNetwork: MultiSigConfigByNetwork; try { @@ -25,13 +20,15 @@ module.exports = (deployer: any, network: string, accounts: string[]) => { }; const config = multiSigConfigByNetwork[network] || defaultConfig; if (network !== 'live') { - deployer.deploy(MultiSigWalletWithTimeLock, config.owners, - config.confirmationsRequired, config.secondsRequired) + deployer + .deploy(MultiSigWalletWithTimeLock, config.owners, config.confirmationsRequired, config.secondsRequired) .then(() => { return deployer.deploy(TokenTransferProxy); - }).then(() => { + }) + .then(() => { return deployer.deploy(TokenRegistry); - }).then(() => { + }) + .then(() => { return deployer.deploy(EtherToken); }); } else { diff --git a/packages/contracts/migrations/3_register_tokens.ts b/packages/contracts/migrations/3_register_tokens.ts index f81693628..d5cf63f94 100644 --- a/packages/contracts/migrations/3_register_tokens.ts +++ b/packages/contracts/migrations/3_register_tokens.ts @@ -1,86 +1,95 @@ import * as Bluebird from 'bluebird'; import * as _ from 'lodash'; -import {Artifacts} from '../util/artifacts'; -import {constants} from '../util/constants'; -import {ContractInstance, Token} from '../util/types'; +import { Artifacts } from '../util/artifacts'; +import { constants } from '../util/constants'; +import { ContractInstance, Token } from '../util/types'; -import {tokenInfo} from './config/token_info'; -const { - DummyToken, - EtherToken, - ZRXToken, - TokenRegistry, -} = new Artifacts(artifacts); +import { tokenInfo } from './config/token_info'; +const { DummyToken, EtherToken, ZRXToken, TokenRegistry } = new Artifacts(artifacts); module.exports = (deployer: any, network: string) => { const tokens = network === 'live' ? tokenInfo.live : tokenInfo.development; - deployer.then(() => { - return TokenRegistry.deployed(); - }).then((tokenRegistry: ContractInstance) => { - if (network !== 'live') { - const totalSupply = Math.pow(10, 18) * 1000000000; - return Bluebird.each(tokens.map((token: Token) => DummyToken.new( - token.name, - token.symbol, - token.decimals, - totalSupply, - )), _.noop).then((dummyTokens: ContractInstance[]) => { - const weth = { - address: EtherToken.address, - name: 'Ether Token', - symbol: 'WETH', - url: '', + deployer + .then(() => { + return TokenRegistry.deployed(); + }) + .then((tokenRegistry: ContractInstance) => { + if (network !== 'live') { + const totalSupply = Math.pow(10, 18) * 1000000000; + return Bluebird.each( + tokens.map((token: Token) => DummyToken.new(token.name, token.symbol, token.decimals, totalSupply)), + _.noop, + ).then((dummyTokens: ContractInstance[]) => { + const weth = { + address: EtherToken.address, + name: 'Ether Token', + symbol: 'WETH', + url: '', + decimals: 18, + ipfsHash: constants.NULL_BYTES, + swarmHash: constants.NULL_BYTES, + }; + return Bluebird.each( + dummyTokens + .map((tokenContract: ContractInstance, i: number) => { + const token = tokens[i]; + return tokenRegistry.addToken( + tokenContract.address, + token.name, + token.symbol, + token.decimals, + token.ipfsHash, + token.swarmHash, + ); + }) + .concat( + tokenRegistry.addToken( + weth.address, + weth.name, + weth.symbol, + weth.decimals, + weth.ipfsHash, + weth.swarmHash, + ), + ), + _.noop, + ); + }); + } else { + const zrx = { + address: ZRXToken.address, + name: '0x Protocol Token', + symbol: 'ZRX', + url: 'https://www.0xproject.com/', decimals: 18, ipfsHash: constants.NULL_BYTES, swarmHash: constants.NULL_BYTES, }; - return Bluebird.each(dummyTokens.map((tokenContract: ContractInstance, i: number) => { - const token = tokens[i]; - return tokenRegistry.addToken( - tokenContract.address, - token.name, - token.symbol, - token.decimals, - token.ipfsHash, - token.swarmHash, - ); - }).concat(tokenRegistry.addToken( - weth.address, - weth.name, - weth.symbol, - weth.decimals, - weth.ipfsHash, - weth.swarmHash, - )), _.noop); - }); - } else { - const zrx = { - address: ZRXToken.address, - name: '0x Protocol Token', - symbol: 'ZRX', - url: 'https://www.0xproject.com/', - decimals: 18, - ipfsHash: constants.NULL_BYTES, - swarmHash: constants.NULL_BYTES, - }; - return Bluebird.each(tokens.map((token: Token) => { - return tokenRegistry.addToken( - token.address, - token.name, - token.symbol, - token.decimals, - token.ipfsHash, - token.swarmHash, + return Bluebird.each( + tokens + .map((token: Token) => { + return tokenRegistry.addToken( + token.address, + token.name, + token.symbol, + token.decimals, + token.ipfsHash, + token.swarmHash, + ); + }) + .concat( + tokenRegistry.addToken( + zrx.address, + zrx.name, + zrx.symbol, + zrx.decimals, + zrx.ipfsHash, + zrx.swarmHash, + ), + ), + _.noop, ); - }).concat(tokenRegistry.addToken( - zrx.address, - zrx.name, - zrx.symbol, - zrx.decimals, - zrx.ipfsHash, - zrx.swarmHash, - )), _.noop); - } - }); + } + }); }; diff --git a/packages/contracts/migrations/4_configure_proxy.ts b/packages/contracts/migrations/4_configure_proxy.ts index f4c4a725b..ff3b844d6 100644 --- a/packages/contracts/migrations/4_configure_proxy.ts +++ b/packages/contracts/migrations/4_configure_proxy.ts @@ -1,27 +1,22 @@ -import {Artifacts} from '../util/artifacts'; -import {ContractInstance} from '../util/types'; -const { - TokenTransferProxy, - Exchange, - TokenRegistry, -} = new Artifacts(artifacts); +import { Artifacts } from '../util/artifacts'; +import { ContractInstance } from '../util/types'; +const { TokenTransferProxy, Exchange, TokenRegistry } = new Artifacts(artifacts); let tokenTransferProxy: ContractInstance; module.exports = (deployer: any) => { - deployer.then(async () => { - return Promise.all([ - TokenTransferProxy.deployed(), - TokenRegistry.deployed(), - ]); - }) - .then((instances: ContractInstance[]) => { - let tokenRegistry: ContractInstance; - [tokenTransferProxy, tokenRegistry] = instances; - return tokenRegistry.getTokenAddressBySymbol('ZRX'); - }) - .then((ptAddress: string) => { - return deployer.deploy(Exchange, ptAddress, tokenTransferProxy.address); - }).then(() => { - return tokenTransferProxy.addAuthorizedAddress(Exchange.address); - }); + deployer + .then(async () => { + return Promise.all([TokenTransferProxy.deployed(), TokenRegistry.deployed()]); + }) + .then((instances: ContractInstance[]) => { + let tokenRegistry: ContractInstance; + [tokenTransferProxy, tokenRegistry] = instances; + return tokenRegistry.getTokenAddressBySymbol('ZRX'); + }) + .then((ptAddress: string) => { + return deployer.deploy(Exchange, ptAddress, tokenTransferProxy.address); + }) + .then(() => { + return tokenTransferProxy.addAuthorizedAddress(Exchange.address); + }); }; diff --git a/packages/contracts/migrations/5_transfer_ownership.ts b/packages/contracts/migrations/5_transfer_ownership.ts index 17de9bc7b..a27801de3 100644 --- a/packages/contracts/migrations/5_transfer_ownership.ts +++ b/packages/contracts/migrations/5_transfer_ownership.ts @@ -1,25 +1,20 @@ -import {Artifacts} from '../util/artifacts'; -import {ContractInstance} from '../util/types'; -const { - TokenTransferProxy, - MultiSigWalletWithTimeLock, - TokenRegistry, -} = new Artifacts(artifacts); +import { Artifacts } from '../util/artifacts'; +import { ContractInstance } from '../util/types'; +const { TokenTransferProxy, MultiSigWalletWithTimeLock, TokenRegistry } = new Artifacts(artifacts); let tokenRegistry: ContractInstance; module.exports = (deployer: any, network: string) => { if (network !== 'development') { deployer.then(async () => { - return Promise.all([ - TokenTransferProxy.deployed(), - TokenRegistry.deployed(), - ]).then((instances: ContractInstance[]) => { - let tokenTransferProxy: ContractInstance; - [tokenTransferProxy, tokenRegistry] = instances; - return tokenTransferProxy.transferOwnership(MultiSigWalletWithTimeLock.address); - }).then(() => { - return tokenRegistry.transferOwnership(MultiSigWalletWithTimeLock.address); - }); + return Promise.all([TokenTransferProxy.deployed(), TokenRegistry.deployed()]) + .then((instances: ContractInstance[]) => { + let tokenTransferProxy: ContractInstance; + [tokenTransferProxy, tokenRegistry] = instances; + return tokenTransferProxy.transferOwnership(MultiSigWalletWithTimeLock.address); + }) + .then(() => { + return tokenRegistry.transferOwnership(MultiSigWalletWithTimeLock.address); + }); }); } }; diff --git a/packages/contracts/migrations/config/multisig_sample.ts b/packages/contracts/migrations/config/multisig_sample.ts index eca54ba28..97cdc2eae 100644 --- a/packages/contracts/migrations/config/multisig_sample.ts +++ b/packages/contracts/migrations/config/multisig_sample.ts @@ -1,4 +1,4 @@ -import {MultiSigConfigByNetwork} from '../../util/types'; +import { MultiSigConfigByNetwork } from '../../util/types'; // Make a copy of this file named `multisig.js` and input custom params as needed export const multiSig: MultiSigConfigByNetwork = { diff --git a/packages/contracts/migrations/config/token_info.ts b/packages/contracts/migrations/config/token_info.ts index 766a28664..6ae67175e 100644 --- a/packages/contracts/migrations/config/token_info.ts +++ b/packages/contracts/migrations/config/token_info.ts @@ -1,5 +1,5 @@ -import {constants} from '../../util/constants'; -import {TokenInfoByNetwork} from '../../util/types'; +import { constants } from '../../util/constants'; +import { TokenInfoByNetwork } from '../../util/types'; export const tokenInfo: TokenInfoByNetwork = { development: [ |