How to use the @0x/types.AssetProxyId.StaticCall 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 / contracts / exchange / src / balance_stores / local_balance_store.ts View on Github external
_.set(this.balances.erc1155, [fromAddress, tokenAddress], fromBalances);
                _.set(this.balances.erc1155, [toAddress, tokenAddress], toBalances);
                break;
            }
            case AssetProxyId.MultiAsset: {
                // tslint:disable-next-line:no-unused-variable
                const [_proxyId, amounts, nestedAssetData] = await this._devUtils
                    .decodeMultiAssetData(assetData)
                    .callAsync();
                for (const [i, amt] of amounts.entries()) {
                    const nestedAmount = amount.times(amt);
                    await this.transferAssetAsync(fromAddress, toAddress, nestedAmount, nestedAssetData[i]);
                }
                break;
            }
            case AssetProxyId.StaticCall:
                // Do nothing
                break;
            default:
                throw new Error(`Unhandled asset proxy ID: ${assetProxyId}`);
        }
    }
}
github 0xProject / 0x-monorepo / packages / migrations / src / test_contract_configs.ts View on Github external
const registeredERC721ProxyInMAP = await multiAssetProxy.getAssetProxy(AssetProxyId.ERC721).callAsync();
        warnIfMismatch(
            registeredERC721ProxyInMAP,
            erc721Proxy.address,
            'Unexpected ERC721Proxy registered in MultiAssetProxy',
        );

        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 registeredERC1155Proxy = await exchangeV2.getAssetProxy(AssetProxyId.ERC1155).callAsync();
        warnIfMismatch(
            registeredERC1155Proxy,
            erc1155Proxy.address,
            'Unexpected ERC1155Proxy registered in ExchangeV2',
        );

        const registeredMultiAssetProxy = await exchangeV2.getAssetProxy(AssetProxyId.MultiAsset).callAsync();
        warnIfMismatch(
            registeredMultiAssetProxy,
            multiAssetProxy.address,
            'Unexpected MultiAssetProxy registered in ExchangeV2',
        );

        const registeredStaticCallProxy = await exchangeV2.getAssetProxy(AssetProxyId.StaticCall).callAsync();
        warnIfMismatch(
            registeredStaticCallProxy,
            addresses.staticCallProxy,
            'Unexpected StaticCallProxy registered in ExchangeV2',
        );
    }
github 0xProject / 0x-monorepo / packages / order-utils / src / asset_data_utils.ts View on Github external
callbackData,
                };
            }
            case AssetProxyId.MultiAsset: {
                const [amounts, nestedAssetData] = assetDataEncoder.getABIDecodedTransactionData<
                    [BigNumber[], string[]]
                >('MultiAsset', assetData);

                const multiAssetData: MultiAssetData = {
                    assetProxyId,
                    amounts,
                    nestedAssetData,
                };
                return multiAssetData;
            }
            case AssetProxyId.StaticCall:
                const [callTarget, staticCallData, callResultHash] = assetDataEncoder.getABIDecodedTransactionData<
                    [string, string, string]
                >('StaticCall', assetData);
                return {
                    assetProxyId,
                    callTarget,
                    staticCallData,
                    callResultHash,
                };
            default:
                throw new Error(`Unhandled asset proxy ID: ${assetProxyId}`);
        }
    },
    /**