aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/migrations
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-01-25 23:42:58 +0800
committerFabio Berger <me@fabioberger.com>2018-01-25 23:42:58 +0800
commit71d68f975cd7bc089f0cbef4e5888a73eab4ee42 (patch)
tree9482602fc23d2baec3fff1fb97750ad45adc6eca /packages/contracts/migrations
parentec3d8a034fe763d8255935985b1fb97aff6c177b (diff)
parentf58f0ddb67555c3f0c7252ea3e003824984c48ad (diff)
downloaddexon-sol-tools-71d68f975cd7bc089f0cbef4e5888a73eab4ee42.tar
dexon-sol-tools-71d68f975cd7bc089f0cbef4e5888a73eab4ee42.tar.gz
dexon-sol-tools-71d68f975cd7bc089f0cbef4e5888a73eab4ee42.tar.bz2
dexon-sol-tools-71d68f975cd7bc089f0cbef4e5888a73eab4ee42.tar.lz
dexon-sol-tools-71d68f975cd7bc089f0cbef4e5888a73eab4ee42.tar.xz
dexon-sol-tools-71d68f975cd7bc089f0cbef4e5888a73eab4ee42.tar.zst
dexon-sol-tools-71d68f975cd7bc089f0cbef4e5888a73eab4ee42.zip
Merge branch 'development' into feature/portal-ledger-support
* development: (437 commits) Publish Update yarn.lock Update the CHANGELOG Fix the bug making it impossible to specify the custom ZRX address Fix fill/cancel order by looking for NoError instead of empty blockchainErr given the BlockchainErrs type refactor Add a comment about a yarn bug Add our mainnet and kovan nodes as backups for Portal requests Fix bug hiding the user info from topBar Add dev-utils package to top level README Prettier newline Prettier Allow Token symbols to be alphanumeric Update CHANGELOG, rebase on development Should not -> cannot Reject negative amounts in isValidBaseUnitAmount Re-add changelog for 0x.js Fix prettier Update yarn.lock Move tests to a separate folder Change file layout ... # Conflicts: # packages/website/README.md
Diffstat (limited to 'packages/contracts/migrations')
-rw-r--r--packages/contracts/migrations/1_initial_migration.ts4
-rw-r--r--packages/contracts/migrations/2_deploy_independent_contracts.ts27
-rw-r--r--packages/contracts/migrations/3_register_tokens.ts155
-rw-r--r--packages/contracts/migrations/4_configure_proxy.ts41
-rw-r--r--packages/contracts/migrations/5_transfer_ownership.ts29
-rw-r--r--packages/contracts/migrations/config/multisig_sample.ts2
-rw-r--r--packages/contracts/migrations/config/token_info.ts4
7 files changed, 129 insertions, 133 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 878860eb6..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 {ContractInstance, 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,14 +20,16 @@ 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(() => {
- return deployer.deploy(TokenRegistry);
- }).then(() => {
- return deployer.deploy(EtherToken);
+ return deployer.deploy(TokenTransferProxy);
+ })
+ .then(() => {
+ return deployer.deploy(TokenRegistry);
+ })
+ .then(() => {
+ return deployer.deploy(EtherToken);
});
} else {
deployer.deploy([
diff --git a/packages/contracts/migrations/3_register_tokens.ts b/packages/contracts/migrations/3_register_tokens.ts
index c72ac1510..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, TokenInfoByNetwork} 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: [