Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
expirationTimeSeconds: randomExpiration,
salt: generatePseudoRandomSalt(),
makerAssetAmount: leftOrder.takerAssetAmount,
takerAssetAmount: rightOrderTakerAssetAmount,
makerAssetData: leftOrder.takerAssetData,
takerAssetData: leftOrder.makerAssetData,
makerFee: ZERO,
takerFee: ZERO,
};
PrintUtils.printData('Right Order', Object.entries(rightOrder));
// Sign the Left Order
const leftSignedOrder = await signatureUtils.ecSignOrderAsync(providerEngine, leftOrder, leftMaker);
// Sign the Right Order
const rightSignedOrder = await signatureUtils.ecSignOrderAsync(providerEngine, rightOrder, rightMaker);
// Print out the Balances and Allowances
await printUtils.fetchAndPrintContractAllowancesAsync();
await printUtils.fetchAndPrintContractBalancesAsync();
// Match the orders via 0x Exchange
txHash = await contractWrappers.exchange.matchOrders.validateAndSendTransactionAsync(
leftSignedOrder,
rightSignedOrder,
leftSignedOrder.signature,
rightSignedOrder.signature,
{
gas: TX_DEFAULTS.gas,
from: matcherAccount,
},
);
const leftOrderHashHex = orderHashUtils.getOrderHashHex(leftOrder);
takerAddress: NULL_ADDRESS,
senderAddress: NULL_ADDRESS,
feeRecipientAddress: NULL_ADDRESS,
expirationTimeSeconds: randomExpiration,
salt: generatePseudoRandomSalt(),
makerAssetAmount: leftOrder.takerAssetAmount,
takerAssetAmount: rightOrderTakerAssetAmount,
makerAssetData: leftOrder.takerAssetData,
takerAssetData: leftOrder.makerAssetData,
makerFee: ZERO,
takerFee: ZERO,
};
PrintUtils.printData('Right Order', Object.entries(rightOrder));
// Sign the Left Order
const leftSignedOrder = await signatureUtils.ecSignOrderAsync(providerEngine, leftOrder, leftMaker);
// Sign the Right Order
const rightSignedOrder = await signatureUtils.ecSignOrderAsync(providerEngine, rightOrder, rightMaker);
// Print out the Balances and Allowances
await printUtils.fetchAndPrintContractAllowancesAsync();
await printUtils.fetchAndPrintContractBalancesAsync();
// Match the orders via 0x Exchange
txHash = await contractWrappers.exchange.matchOrders.validateAndSendTransactionAsync(
leftSignedOrder,
rightSignedOrder,
leftSignedOrder.signature,
rightSignedOrder.signature,
{
gas: TX_DEFAULTS.gas,
from: matcherAccount,
makerAssetAmount,
takerAssetAmount,
makerAssetData,
takerAssetData,
makerFee: ZERO,
takerFee: ZERO,
};
printUtils.printOrder(order);
// Print out the Balances and Allowances
await printUtils.fetchAndPrintContractAllowancesAsync();
await printUtils.fetchAndPrintContractBalancesAsync();
// Maker signs the order
const signedOrder = await signatureUtils.ecSignOrderAsync(providerEngine, order, maker);
const affiliateFeeRecipient = NULL_ADDRESS;
const affiliateFee = ZERO;
// Use the Forwarder to market buy the ERC20 orders using Eth. When using the Forwarder
// the taker does not need to set any allowances or deposit any ETH into WETH
txHash = await contractWrappers.forwarder.marketBuyOrdersWithEth.validateAndSendTransactionAsync(
[signedOrder],
order.makerAssetAmount,
[signedOrder.signature],
[], // no fees required
[],
affiliateFee,
affiliateFeeRecipient,
{
gas: TX_DEFAULTS.gas,
from: taker,
takerAssetAmount,
makerAssetData,
takerAssetData,
makerFee: ZERO,
takerFee: ZERO,
};
printUtils.printOrder(order);
// Print out the Balances and Allowances
await printUtils.fetchAndPrintContractAllowancesAsync();
await printUtils.fetchAndPrintContractBalancesAsync();
await printUtils.fetchAndPrintERC721OwnerAsync(dummyERC721TokenContract.address, tokenId);
// Maker signs the order
const signedOrder = await signatureUtils.ecSignOrderAsync(providerEngine, order, maker);
const affiliateFeeRecipient = NULL_ADDRESS;
const affiliateFee = ZERO;
// Use the Forwarder to market buy the ERC721 orders using Eth. When using the Forwarder
// the taker does not need to set any allowances or deposit any ETH into WETH
txHash = await contractWrappers.forwarder.marketBuyOrdersWithEth.validateAndSendTransactionAsync(
[signedOrder],
order.makerAssetAmount,
[signedOrder.signature],
[], // no fees required
[],
affiliateFee,
affiliateFeeRecipient,
{
gas: TX_DEFAULTS.gas,
from: taker,