Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
openZeroExInstant: async () => {
const { contracts } = augurSdk.get();
const repTokenAddress = contracts.getReputationToken();
const assetData = assetDataUtils.encodeERC20AssetData(repTokenAddress.address);
const networkSettings = [
{
orderSource: [
{
senderAddress: NULL_ADDRESS,
makerAddress: '0x14e2f1f157e7dd4057d02817436d628a37120fd1',
takerAddress: NULL_ADDRESS,
makerFee: new BigNumber('0'),
takerFee: new BigNumber('0'),
makerAssetAmount: new BigNumber('94000000000000000000'),
takerAssetAmount: new BigNumber('1000000000000000000'),
makerAssetData:
'0xf47261b00000000000000000000000004c7493b70f16bec1e087bf74a31d095f9b8f9c40',
takerAssetData:
'0xf47261b0000000000000000000000000d0a1e359811322d97991e03f863a0c30c2cf029c',
expirationTimeSeconds: new BigNumber('1549008000'),
public async getEtherTokenAssetDataOrThrowAsync(): Promise {
return assetDataUtils.encodeERC20AssetData(this._contractAddresses.etherToken);
}
bridgeAddress: string,
makerToken: string,
takerToken: string,
makerAssetAmount: BigNumber,
takerAssetAmount: BigNumber,
slippage: number,
isBuy: boolean = false,
): SignedOrderWithFillableAmounts {
return {
makerAddress: bridgeAddress,
makerAssetData: assetDataUtils.encodeERC20BridgeAssetData(
makerToken,
bridgeAddress,
createBridgeData(takerToken),
),
takerAssetData: assetDataUtils.encodeERC20AssetData(takerToken),
...createCommonOrderFields(orderDomain, makerAssetAmount, takerAssetAmount, slippage, isBuy),
};
}
signature: string,
tokenByAddress: TokenByAddress,
orderSalt: BigNumber,
): PortalOrder {
const makerToken = tokenByAddress[sideToAssetToken[Side.Deposit].address];
const takerToken = tokenByAddress[sideToAssetToken[Side.Receive].address];
const order = {
signedOrder: {
senderAddress: constants.NULL_ADDRESS,
makerAddress: orderMakerAddress,
takerAddress: orderTakerAddress,
makerFee,
takerFee,
makerAssetAmount: sideToAssetToken[Side.Deposit].amount,
takerAssetAmount: sideToAssetToken[Side.Receive].amount,
makerAssetData: assetDataUtils.encodeERC20AssetData(makerToken.address),
takerAssetData: assetDataUtils.encodeERC20AssetData(takerToken.address),
expirationTimeSeconds,
feeRecipientAddress,
salt: orderSalt,
signature,
exchangeAddress,
},
metadata: {
makerToken: {
name: makerToken.name,
symbol: makerToken.symbol,
decimals: makerToken.decimals,
},
takerToken: {
name: takerToken.name,
symbol: takerToken.symbol,
public async getMarketSellSwapQuoteAsync(
makerTokenAddress: string,
takerTokenAddress: string,
takerAssetSellAmount: BigNumber,
options: Partial = {},
): Promise {
assert.isETHAddressHex('makerTokenAddress', makerTokenAddress);
assert.isETHAddressHex('takerTokenAddress', takerTokenAddress);
assert.isBigNumber('takerAssetSellAmount', takerAssetSellAmount);
const makerAssetData = assetDataUtils.encodeERC20AssetData(makerTokenAddress);
const takerAssetData = assetDataUtils.encodeERC20AssetData(takerTokenAddress);
const swapQuote = this.getMarketSellSwapQuoteForAssetDataAsync(
makerAssetData,
takerAssetData,
takerAssetSellAmount,
options,
);
return swapQuote;
}
public getZRXAssetData(): string {
const zrxAssetData = assetDataUtils.encodeERC20AssetData(this.zrxTokenAddress);
return zrxAssetData;
}
/**
feeRecipientAddress: efx.config['0x'].ethfinexAddress.toLowerCase(),
senderAddress: efx.config['0x'].ethfinexAddress.toLowerCase(),
makerAssetAmount: sellAmount,
takerAssetAmount: buyAmount,
makerFee: new BigNumber(0),
takerFee: new BigNumber(0),
expirationTimeSeconds: new BigNumber(expiration),
salt: generatePseudoRandomSalt(),
makerAssetData: assetDataUtils.encodeERC20AssetData(sellCurrency.wrapperAddress.toLowerCase()),
takerAssetData: assetDataUtils.encodeERC20AssetData(buyCurrency.wrapperAddress.toLowerCase()),
exchangeAddress: efx.config['0x'].exchangeAddress.toLowerCase()
}
return order
}
private _getEtherTokenAssetDataOrThrow(): string {
return assetDataUtils.encodeERC20AssetData(this._contractAddresses.etherToken);
}
}