Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function runMigrationsAsync(supportedProvider: SupportedProvider, txDefaults: TxData): Promise {
const provider = providerUtils.standardizeOrThrow(supportedProvider);
const chainId = new BigNumber(await providerUtils.getChainIdAsync(provider));
const deployedAddresses = getContractAddressesForChainOrThrow(chainId.toNumber());
const configs = getConfigsByChainId(chainId.toNumber());
// NOTE: This must be deployed before running these migrations, since its address is hard coded in the
// staking logic contract.
const zrxVault = new ZrxVaultContract(deployedAddresses.zrxVault, provider, txDefaults);
const stakingLogic = await StakingContract.deployFrom0xArtifactAsync(
stakingArtifacts.Staking,
provider,
txDefaults,
stakingArtifacts,
);
const exchange = await ExchangeContract.deployFrom0xArtifactAsync(
exchangeArtifacts.Exchange,
export async function runMigrationsAsync(
supportedProvider: SupportedProvider,
txDefaults: TxData,
): Promise {
const provider = providerUtils.standardizeOrThrow(supportedProvider);
const chainId = await providerUtils.getChainIdAsync(provider);
const web3Wrapper = new Web3Wrapper(provider);
// Proxies
const erc20Proxy = await wrappers.ERC20ProxyContract.deployFrom0xArtifactAsync(
artifacts.ERC20Proxy,
provider,
txDefaults,
);
const erc721Proxy = await wrappers.ERC721ProxyContract.deployFrom0xArtifactAsync(
artifacts.ERC721Proxy,
provider,
txDefaults,
);
// ZRX
const zrxToken = await wrappers.ZRXTokenContract.deployFrom0xArtifactAsync(
export async function runMigrationsAsync(
supportedProvider: SupportedProvider,
txDefaults: TxData,
): Promise {
const provider = providerUtils.standardizeOrThrow(supportedProvider);
const chainId = new BigNumber(await providerUtils.getChainIdAsync(provider));
// Proxies
const erc20Proxy = await ERC20ProxyContract.deployFrom0xArtifactAsync(
artifacts.ERC20Proxy,
provider,
txDefaults,
artifacts,
);
const erc721Proxy = await ERC721ProxyContract.deployFrom0xArtifactAsync(
artifacts.ERC721Proxy,
provider,
txDefaults,
artifacts,
);
// ZRX
public async getChainIdAsync(): Promise {
return providerUtils.getChainIdAsync(this.provider);
}
makerAddress: string,
makerAssetAmount: BigNumber,
makerAssetData: string,
takerAssetAmount: BigNumber,
takerAssetData: string,
exchangeAddress: string,
createOrderOpts?: CreateOrderOpts,
): Promise {
const order = orderFactory.createOrder(
makerAddress,
makerAssetAmount,
makerAssetData,
takerAssetAmount,
takerAssetData,
exchangeAddress,
await providerUtils.getChainIdAsync(supportedProvider),
createOrderOpts,
);
const orderHash = await new DevUtilsContract('0x0000000000000000000000000000000000000000', {
isEIP1193: true,
} as any)
.getOrderHash(order, new BigNumber(order.chainId), order.exchangeAddress)
.callAsync();
const signature = await signatureUtils.ecSignHashAsync(supportedProvider, orderHash, makerAddress);
const signedOrder: SignedOrder = _.assign(order, { signature });
return signedOrder;
},
};