How to use the @0x/contract-artifacts.ERC20Token function in @0x/contract-artifacts

To help you get started, we’ve selected a few @0x/contract-artifacts 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-watcher / src / order_watcher / order_watcher.ts View on Github external
supportedProvider: SupportedProvider,
        networkId: number,
        contractAddresses?: ContractAddresses,
        partialConfig: Partial = DEFAULT_ORDER_WATCHER_CONFIG,
    ) {
        const provider = providerUtils.standardizeOrThrow(supportedProvider);
        assert.isNumber('networkId', networkId);
        assert.doesConformToSchema('partialConfig', partialConfig, orderWatcherPartialConfigSchema);
        const config = {
            ...DEFAULT_ORDER_WATCHER_CONFIG,
            ...partialConfig,
        };

        this._provider = provider;
        this._collisionResistantAbiDecoder = new CollisionResistanceAbiDecoder(
            artifacts.ERC20Token.compilerOutput.abi,
            artifacts.ERC721Token.compilerOutput.abi,
            [artifacts.WETH9.compilerOutput.abi, artifacts.Exchange.compilerOutput.abi],
        );
        const contractWrappers = new ContractWrappers(provider, {
            networkId,
            // Note(albrow): We let the contract-wrappers package handle
            // default values for contractAddresses.
            contractAddresses,
        });
        this._eventWatcher = new EventWatcher(provider, config.eventPollingIntervalMs, config.isVerbose);
        const balanceAndProxyAllowanceFetcher = new AssetBalanceAndProxyAllowanceFetcher(
            contractWrappers.erc20Token,
            contractWrappers.erc721Token,
            STATE_LAYER,
        );
        this._balanceAndProxyAllowanceLazyStore = new BalanceAndProxyAllowanceLazyStore(