How to use the @0x/types.AssetProxyId.ERC20Bridge function in @0x/types

To help you get started, we’ve selected a few @0x/types 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 0xProject / 0x-monorepo / packages / order-utils / src / asset_data_utils.ts View on Github external
decodeAssetDataOrThrow(assetData: string): AssetData {
        const assetProxyId = hexUtils.slice(assetData, 0, 4); // tslint:disable-line:custom-no-magic-numbers
        switch (assetProxyId) {
            case AssetProxyId.ERC20: {
                const tokenAddress = assetDataEncoder.getABIDecodedTransactionData('ERC20Token', assetData);
                return {
                    assetProxyId,
                    tokenAddress,
                };
            }
            case AssetProxyId.ERC20Bridge: {
                const [tokenAddress, bridgeAddress, bridgeData] = assetDataEncoder.getABIDecodedTransactionData<
                    [string, string, string]
                >('ERC20Bridge', assetData);
                return {
                    assetProxyId,
                    tokenAddress,
                    bridgeAddress,
                    bridgeData,
                };
            }
            case AssetProxyId.ERC721: {
                const [tokenAddress, tokenId] = assetDataEncoder.getABIDecodedTransactionData<[string, BigNumber]>(
                    'ERC721Token',
                    assetData,
                );
                return {
github 0xProject / 0x-monorepo / packages / migrations / src / test_contract_configs.ts View on Github external
const registeredERC1155ProxyInMAP = await multiAssetProxy.getAssetProxy(AssetProxyId.ERC1155).callAsync();
        warnIfMismatch(
            registeredERC1155ProxyInMAP,
            erc1155Proxy.address,
            'Unexpected ERC1155Proxy registered in MultiAssetProxy',
        );

        const registeredStaticCallProxyInMAP = await multiAssetProxy.getAssetProxy(AssetProxyId.StaticCall).callAsync();
        warnIfMismatch(
            registeredStaticCallProxyInMAP,
            addresses.staticCallProxy,
            'Unexpected StaticCallProxy registered in MultiAssetProxy',
        );

        const registeredERC20BridgeProxyInMAP = await multiAssetProxy
            .getAssetProxy(AssetProxyId.ERC20Bridge)
            .callAsync();
        warnIfMismatch(
            registeredERC20BridgeProxyInMAP,
            addresses.erc20BridgeProxy,
            'Unexpected ERC20BridgeProxy registered in MultiAssetProxy',
        );
    }
github 0xProject / 0x-monorepo / packages / migrations / src / test_contract_configs.ts View on Github external
const registeredMultiAssetProxy = await exchange.getAssetProxy(AssetProxyId.MultiAsset).callAsync();
        warnIfMismatch(
            registeredMultiAssetProxy,
            multiAssetProxy.address,
            'Unexpected MultiAssetProxy registered in Exchange',
        );

        const registeredStaticCallProxy = await exchange.getAssetProxy(AssetProxyId.StaticCall).callAsync();
        warnIfMismatch(
            registeredStaticCallProxy,
            addresses.staticCallProxy,
            'Unexpected StaticCallProxy registered in Exchange',
        );

        const registeredERC20BridgeProxy = await exchange.getAssetProxy(AssetProxyId.ERC20Bridge).callAsync();
        warnIfMismatch(
            registeredERC20BridgeProxy,
            addresses.erc20BridgeProxy,
            'Unexpected ERC20BridgeProxy registered in Exchange',
        );

        const protocolFeeCollector = await exchange.protocolFeeCollector().callAsync();
        warnIfMismatch(protocolFeeCollector, addresses.stakingProxy, 'Unexpected StakingProxy attached to Exchange');

        const protocolFeeMultiplier = await exchange.protocolFeeMultiplier().callAsync();
        warnIfMismatch(protocolFeeMultiplier.toString(), '150000', 'Unexpected protocolFeeMultiplier in Exchange');
    }