How to use the @0x/contracts-test-utils.constants.NULL_ADDRESS function in @0x/contracts-test-utils

To help you get started, we’ve selected a few @0x/contracts-test-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 0xProject / 0x-monorepo / contracts / exchange / src / exchange_data_encoder.ts View on Github external
encodeOrdersToExchangeData(fnName: ExchangeFunctionName, orders: SignedOrder[] = []): string {
        const exchangeInstance = new IExchangeContract(constants.NULL_ADDRESS, provider);
        let data;
        if (constants.SINGLE_FILL_FN_NAMES.indexOf(fnName) !== -1) {
            data = (exchangeInstance as any)
                [fnName](orders[0], orders[0].takerAssetAmount, orders[0].signature)
                .getABIEncodedTransactionData();
        } else if (constants.BATCH_FILL_FN_NAMES.indexOf(fnName) !== -1) {
            data = (exchangeInstance as any)
                [fnName](orders, orders.map(order => order.takerAssetAmount), orders.map(order => order.signature))
                .getABIEncodedTransactionData();
        } else if (constants.MARKET_FILL_FN_NAMES.indexOf(fnName) !== -1) {
            const fillAsset = /Buy/.test(fnName) ? 'makerAssetAmount' : 'takerAssetAmount';
            data = (exchangeInstance as any)
                [fnName](
                    orders,
                    orders.map(order => order[fillAsset]).reduce((prev, curr) => prev.plus(curr)),
                    orders.map(order => order.signature),
github 0xProject / 0x-monorepo / contracts / asset-proxy / src / erc1155_proxy_wrapper.ts View on Github external
constructor(provider: Provider, tokenOwnerAddresses: string[], contractOwnerAddress: string) {
        this._web3Wrapper = new Web3Wrapper(provider);
        this._provider = provider;
        const allArtifacts = _.merge(artifacts, erc1155Artifacts);
        this._logDecoder = new LogDecoder(this._web3Wrapper, allArtifacts);
        this._dummyTokenWrappers = [];
        this._assetProxyInterface = new IAssetProxyContract(constants.NULL_ADDRESS, provider);
        this._devUtils = new DevUtilsContract(constants.NULL_ADDRESS, provider);
        this._tokenOwnerAddresses = tokenOwnerAddresses;
        this._contractOwnerAddress = contractOwnerAddress;
        this._fungibleTokenIds = [];
        this._nonFungibleTokenIds = [];
        this._nfts = [];
    }
    /**
github 0xProject / 0x-monorepo / contracts / exchange / src / exchange_data_encoder.ts View on Github external
.getABIEncodedTransactionData();
        } else if (constants.MATCH_ORDER_FN_NAMES.indexOf(fnName) !== -1) {
            data = exchangeInstance
                .matchOrders(orders[0], orders[1], orders[0].signature, orders[1].signature)
                .getABIEncodedTransactionData();
        } else if (fnName === ExchangeFunctionName.CancelOrder) {
            data = exchangeInstance.cancelOrder(orders[0]).getABIEncodedTransactionData();
        } else if (fnName === ExchangeFunctionName.BatchCancelOrders) {
            data = exchangeInstance.batchCancelOrders(orders).getABIEncodedTransactionData();
        } else if (fnName === ExchangeFunctionName.CancelOrdersUpTo) {
            data = exchangeInstance.cancelOrdersUpTo(constants.ZERO_AMOUNT).getABIEncodedTransactionData();
        } else if (fnName === ExchangeFunctionName.PreSign) {
            data = exchangeInstance.preSign(orderHashUtils.getOrderHashHex(orders[0])).getABIEncodedTransactionData();
        } else if (fnName === ExchangeFunctionName.SetSignatureValidatorApproval) {
            data = exchangeInstance
                .setSignatureValidatorApproval(constants.NULL_ADDRESS, true)
                .getABIEncodedTransactionData();
        } else {
            throw new Error(`Error: ${fnName} not a supported function`);
        }
        return data;
    },
};
github 0xProject / 0x-monorepo / contracts / asset-proxy / src / erc1155_proxy_wrapper.ts View on Github external
constructor(provider: Provider, tokenOwnerAddresses: string[], contractOwnerAddress: string) {
        this._web3Wrapper = new Web3Wrapper(provider);
        this._provider = provider;
        const allArtifacts = _.merge(artifacts, erc1155Artifacts);
        this._logDecoder = new LogDecoder(this._web3Wrapper, allArtifacts);
        this._dummyTokenWrappers = [];
        this._assetProxyInterface = new IAssetProxyContract(constants.NULL_ADDRESS, provider);
        this._devUtils = new DevUtilsContract(constants.NULL_ADDRESS, provider);
        this._tokenOwnerAddresses = tokenOwnerAddresses;
        this._contractOwnerAddress = contractOwnerAddress;
        this._fungibleTokenIds = [];
        this._nonFungibleTokenIds = [];
        this._nfts = [];
    }
    /**
github 0xProject / 0x-monorepo / contracts / asset-proxy / src / erc20_wrapper.ts View on Github external
constructor(provider: ZeroExProvider, tokenOwnerAddresses: string[], contractOwnerAddress: string) {
        this._dummyTokenContracts = [];
        this._provider = provider;
        this._tokenOwnerAddresses = tokenOwnerAddresses;
        this._contractOwnerAddress = contractOwnerAddress;
        this._devUtils = new DevUtilsContract(constants.NULL_ADDRESS, provider);
    }
    public async deployDummyTokensAsync(
github 0xProject / 0x-monorepo / contracts / asset-proxy / src / erc721_wrapper.ts View on Github external
public async doesTokenExistAsync(tokenAddress: string, tokenId: BigNumber): Promise {
        const tokenContract = this._getTokenContractFromAssetData(tokenAddress);
        const owner = await tokenContract.ownerOf(tokenId).callAsync();
        const doesExist = owner !== constants.NULL_ADDRESS;
        return doesExist;
    }
    public async approveProxyAsync(tokenAddress: string, tokenId: BigNumber): Promise {