Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Proxies
const erc20Proxy = await ERC20ProxyContract.deployFrom0xArtifactAsync(
artifacts.ERC20Proxy,
provider,
txDefaults,
artifacts,
);
const erc721Proxy = await ERC721ProxyContract.deployFrom0xArtifactAsync(
artifacts.ERC721Proxy,
provider,
txDefaults,
artifacts,
);
// ZRX
const zrxToken = await DummyERC20TokenContract.deployFrom0xArtifactAsync(
artifacts.DummyERC20Token,
provider,
txDefaults,
artifacts,
'0x Protocol Token',
'ZRX',
new BigNumber(18),
new BigNumber(1000000000000000000000000000),
);
// Ether token
const etherToken = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.WETH9, provider, txDefaults, artifacts);
// Exchange
const exchange = await ExchangeContract.deployFrom0xArtifactAsync(
artifacts.Exchange,
const etherToken = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.WETH9, provider, txDefaults, artifacts);
// Exchange
const exchange = await ExchangeContract.deployFrom0xArtifactAsync(
artifacts.Exchange,
provider,
txDefaults,
artifacts,
chainId,
);
// Dummy ERC20 tokens
for (const token of erc20TokenInfo) {
const totalSupply = new BigNumber(1000000000000000000000000000);
// tslint:disable-next-line:no-unused-variable
const dummyErc20Token = await DummyERC20TokenContract.deployFrom0xArtifactAsync(
artifacts.DummyERC20Token,
provider,
txDefaults,
artifacts,
token.name,
token.symbol,
token.decimals,
totalSupply,
);
}
// ERC721
// tslint:disable-next-line:no-unused-variable
const cryptoKittieToken = await DummyERC721TokenContract.deployFrom0xArtifactAsync(
artifacts.DummyERC721Token,
provider,
);
// ZRX
const zrxToken = await DummyERC20TokenContract.deployFrom0xArtifactAsync(
artifacts.DummyERC20Token,
provider,
txDefaults,
artifacts,
'0x Protocol Token',
'ZRX',
new BigNumber(18),
new BigNumber(1000000000000000000000000000),
);
// Ether token
const etherToken = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.WETH9, provider, txDefaults, artifacts);
// Exchange
const exchange = await ExchangeContract.deployFrom0xArtifactAsync(
artifacts.Exchange,
provider,
txDefaults,
artifacts,
chainId,
);
// Dummy ERC20 tokens
for (const token of erc20TokenInfo) {
const totalSupply = new BigNumber(1000000000000000000000000000);
// tslint:disable-next-line:no-unused-variable
const dummyErc20Token = await DummyERC20TokenContract.deployFrom0xArtifactAsync(
artifacts.DummyERC20Token,
public async deployDummyTokensAsync(
numberToDeploy: number,
decimals: BigNumber,
): Promise {
for (let i = 0; i < numberToDeploy; i++) {
this._dummyTokenContracts.push(
await DummyERC20TokenContract.deployFrom0xArtifactAsync(
erc20Artifacts.DummyERC20Token,
this._provider,
txDefaults,
artifacts,
constants.DUMMY_TOKEN_NAME,
constants.DUMMY_TOKEN_SYMBOL,
decimals,
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
),
);
}
return this._dummyTokenContracts;
}
public async deployProxyAsync(): Promise {
const erc721 = await ERC721TokenContract.deployFrom0xArtifactAsync(
ERC721Artifacts.ERC721Token,
environment.provider,
txDefaults,
ERC721Artifacts,
);
const erc1155 = await ERC1155Contract.deployFrom0xArtifactAsync(
ERC1155Artifacts.ERC1155,
environment.provider,
txDefaults,
ERC1155Artifacts,
);
const weth = await WETH9Contract.deployFrom0xArtifactAsync(
ERC20Artifacts.WETH9,
environment.provider,
txDefaults,
ERC20Artifacts,
);
const zrx = await ZRXTokenContract.deployFrom0xArtifactAsync(
ERC20Artifacts.ZRXToken,
environment.provider,
txDefaults,
ERC20Artifacts,
);
return {
erc1155,
erc20,
protected static async _deployTokenContractsAsync(
environment: BlockchainTestsEnvironment,
txDefaults: Partial,
): Promise {
const erc20 = await ERC20TokenContract.deployFrom0xArtifactAsync(
ERC20Artifacts.ERC20Token,
environment.provider,
txDefaults,
ERC20Artifacts,
);
const erc721 = await ERC721TokenContract.deployFrom0xArtifactAsync(
ERC721Artifacts.ERC721Token,
environment.provider,
txDefaults,
ERC721Artifacts,
);
const erc1155 = await ERC1155Contract.deployFrom0xArtifactAsync(
ERC1155Artifacts.ERC1155,
environment.provider,
const erc1155 = await ERC1155Contract.deployFrom0xArtifactAsync(
ERC1155Artifacts.ERC1155,
environment.provider,
txDefaults,
ERC1155Artifacts,
);
const weth = await WETH9Contract.deployFrom0xArtifactAsync(
ERC20Artifacts.WETH9,
environment.provider,
txDefaults,
ERC20Artifacts,
);
const zrx = await ZRXTokenContract.deployFrom0xArtifactAsync(
ERC20Artifacts.ZRXToken,
environment.provider,
txDefaults,
ERC20Artifacts,
);
return {
erc1155,
erc20,
erc721,
weth,
zrx,
};
}
public async deployDummyTokensAsync(
numberToDeploy: number,
decimals: BigNumber,
): Promise {
for (let i = 0; i < numberToDeploy; i++) {
this._dummyTokenContracts.push(
await DummyERC20TokenContract.deployFrom0xArtifactAsync(
erc20Artifacts.DummyERC20Token,
this._provider,
txDefaults,
artifacts,
constants.DUMMY_TOKEN_NAME,
constants.DUMMY_TOKEN_SYMBOL,
decimals,
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
),
);
}
return this._dummyTokenContracts;
}
public async deployProxyAsync(): Promise {
protected static async _deployTokenContractsAsync(
environment: BlockchainTestsEnvironment,
txDefaults: Partial,
): Promise {
const erc20 = await ERC20TokenContract.deployFrom0xArtifactAsync(
ERC20Artifacts.ERC20Token,
environment.provider,
txDefaults,
ERC20Artifacts,
);
const erc721 = await ERC721TokenContract.deployFrom0xArtifactAsync(
ERC721Artifacts.ERC721Token,
environment.provider,
txDefaults,
ERC721Artifacts,
);
const erc1155 = await ERC1155Contract.deployFrom0xArtifactAsync(
ERC1155Artifacts.ERC1155,
environment.provider,
txDefaults,
const erc721 = await ERC721TokenContract.deployFrom0xArtifactAsync(
ERC721Artifacts.ERC721Token,
environment.provider,
txDefaults,
ERC721Artifacts,
);
const erc1155 = await ERC1155Contract.deployFrom0xArtifactAsync(
ERC1155Artifacts.ERC1155,
environment.provider,
txDefaults,
ERC1155Artifacts,
);
const weth = await WETH9Contract.deployFrom0xArtifactAsync(
ERC20Artifacts.WETH9,
environment.provider,
txDefaults,
ERC20Artifacts,
);
const zrx = await ZRXTokenContract.deployFrom0xArtifactAsync(
ERC20Artifacts.ZRXToken,
environment.provider,
txDefaults,
ERC20Artifacts,
);
return {
erc1155,
erc20,
erc721,