How to use the @0x/contract-wrappers.DevUtilsContract function in @0x/contract-wrappers

To help you get started, we’ve selected a few @0x/contract-wrappers 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 / asset-swapper / src / swap_quoter.ts View on Github external
const { chainId, expiryBufferMs, permittedOrderFeeTypes } = _.merge(
            {},
            constants.DEFAULT_SWAP_QUOTER_OPTS,
            options,
        );
        const provider = providerUtils.standardizeOrThrow(supportedProvider);
        assert.isValidOrderbook('orderbook', orderbook);
        assert.isNumber('chainId', chainId);
        assert.isNumber('expiryBufferMs', expiryBufferMs);
        this.chainId = chainId;
        this.provider = provider;
        this.orderbook = orderbook;
        this.expiryBufferMs = expiryBufferMs;
        this.permittedOrderFeeTypes = permittedOrderFeeTypes;
        this._contractAddresses = getContractAddressesForChainOrThrow(chainId);
        this._devUtilsContract = new DevUtilsContract(this._contractAddresses.devUtils, provider);
        this._protocolFeeUtils = new ProtocolFeeUtils(constants.PROTOCOL_FEE_UTILS_POLLING_INTERVAL_IN_MS);
        this._orderStateUtils = new OrderStateUtils(this._devUtilsContract);
        const samplerContract = new IERC20BridgeSamplerContract(
            this._contractAddresses.erc20BridgeSampler,
            this.provider,
        );
        this._marketOperationUtils = new MarketOperationUtils(samplerContract, this._contractAddresses, {
            chainId,
            exchangeAddress: this._contractAddresses.exchange,
        });
        this._swapQuoteCalculator = new SwapQuoteCalculator(this._protocolFeeUtils, this._marketOperationUtils);
    }