How to use the @0x/order-utils.assetDataUtils.encodeERC20AssetData function in @0x/order-utils

To help you get started, we’ve selected a few @0x/order-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AugurProject / augur / packages / augur-ui / src / modules / modal / containers / modal-deposit.ts View on Github external
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'),
github 0xProject / 0x-monorepo / packages / asset-swapper / src / swap_quoter.ts View on Github external
public async getEtherTokenAssetDataOrThrowAsync(): Promise {
        return assetDataUtils.encodeERC20AssetData(this._contractAddresses.etherToken);
    }
github 0xProject / 0x-monorepo / packages / asset-swapper / src / utils / market_operation_utils / create_order.ts View on Github external
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),
    };
}
github 0xProject / 0x-monorepo / packages / website / ts / utils / utils.ts View on Github external
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,
github 0xProject / 0x-monorepo / packages / asset-swapper / src / swap_quoter.ts View on Github external
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;
    }
github 0xProject / 0x-monorepo / packages / contract-wrappers / src / contract_wrappers / exchange_wrapper.ts View on Github external
public getZRXAssetData(): string {
        const zrxAssetData = assetDataUtils.encodeERC20AssetData(this.zrxTokenAddress);
        return zrxAssetData;
    }
    /**
github ethfinex / efx-api-node / src / api / contract / create_order.js View on Github external
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
}
github 0xProject / 0x-monorepo / packages / asset-swapper / src / quote_consumers / forwarder_swap_quote_consumer.ts View on Github external
private _getEtherTokenAssetDataOrThrow(): string {
        return assetDataUtils.encodeERC20AssetData(this._contractAddresses.etherToken);
    }
}