Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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,
provider,
txDefaults,
artifacts,
token.name,
);
// ZRX
const zrxToken = await wrappers.ZRXTokenContract.deployFrom0xArtifactAsync(
artifacts.ZRXToken,
provider,
txDefaults,
);
// Ether token
const etherToken = await wrappers.WETH9Contract.deployFrom0xArtifactAsync(artifacts.WETH9, provider, txDefaults);
// Exchange
const zrxAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
const exchange = await wrappers.ExchangeContract.deployFrom0xArtifactAsync(
artifacts.Exchange,
provider,
txDefaults,
zrxAssetData,
new BigNumber(chainId),
);
// Dummy ERC20 tokens
for (const token of erc20TokenInfo) {
const totalSupply = new BigNumber(1000000000000000000000000000);
// tslint:disable-next-line:no-unused-variable
const dummyErc20Token = await wrappers.DummyERC20TokenContract.deployFrom0xArtifactAsync(
artifacts.DummyERC20Token,
provider,
txDefaults,
token.name,
token.symbol,
takerAssetData: string,
takerAddress: string,
fillableAmount: BigNumber,
partialFillAmount: BigNumber,
): Promise {
const [makerAddress] = this._userAddresses;
const signedOrder = await this.createAsymmetricFillableSignedOrderAsync(
makerAssetData,
takerAssetData,
makerAddress,
takerAddress,
fillableAmount,
fillableAmount,
);
const exchangeInstance = new ExchangeContract(
artifacts.Exchange.compilerOutput.abi,
signedOrder.domain.verifyingContractAddress,
this._web3Wrapper.getProvider(),
this._web3Wrapper.getContractDefaults(),
);
const orderWithoutDomain = _.omit(signedOrder, ['signature', 'domain']) as OrderWithoutDomain;
const txHash = await exchangeInstance.fillOrder.sendTransactionAsync(
orderWithoutDomain,
partialFillAmount,
signedOrder.signature,
{ from: takerAddress },
);
await this._web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
return signedOrder;
}