I am trying to write an app that sells NFT using 0x protocol smart contracts and test it on Mumbai Polygon testnet, Deployed my test ER721 contract and test ERC20 contract. Got 0x contract addresses from https://gist.github.com/rahuldamodar94/6bdd022f3457934f2a104fd5f4bb45e4. However I am getting error “Transaction has been reverted by the EVM” when call fillOrder Exchange method
exchangeAddr = '0x533dc89624dcc012c7323b41f286bd2df478800b'; // taken from gistfile.txt
devUtilAddr = '0x7a2d89c4cb4b28b9cef9f269d48b3aecf0f549b7'
const erc20ProxyAddr = "0x0b47076aaa5246411458fcf85494f41bbfdb8470";
const erc721ProxyAddr = "0xff7ca10af37178bdd056628ef42fd7f799fac77c";
const currentTime = Date.now();
const expiry = Math.ceil(currentTime/1000) + 36 * 3600
let order = {
makerAddress: process.env.MAKER_ADDRESS, // seller
takerAddress: process.env.TAKER_ADDRESS, // buyer
senderAddress: process.env.TAKER_ADDRESS,
feeRecipientAddress: '0x0000000000000000000000000000000000000000',
makerAssetAmount: tokenId,
takerAssetAmount: amount,
makerFee: '0',
takerFee: '0',
expirationTimeSeconds: expiry,
salt: '125',
makerAssetData: '0x',
takerAssetData: '0x',
makerFeeAssetData: '0x',
takerFeeAssetData: '0x',
chainId: chainId,
exchangeAddress: exchangeAddr,
};
if (!initialized)
await this.init();
const exchange = new web3Taker.eth.Contract(artifacts.Exchange.compilerOutput.abi, exchangeAddr);
const devUtils = new web3Taker.eth.Contract(artifacts.DevUtils.compilerOutput.abi, devUtilAddr);
const erc721Addr = '0xBa461089AC314b56EB51920F23971FE4adF8A113';
const erc71Instance = new web3Maker.eth.Contract(erc721.abi, erc721Addr);
const erc20addr = '0x4732b9252984c255BB841CeDb3F3aE673048Da2d'; // PolyTest20 token
const makerAssetData = await devUtils.methods.encodeERC721AssetData(polyNFTAddr, BigNumber(1)).call();
const takerAssetData = await devUtils.methods.encodeERC20AssetData(erc20addr).call();
order.makerAssetData = makerAssetData;
order.takerAssetData = takerAssetData;
const sOrder = await OrderUtils.signatureUtils.ecSignOrderAsync(localKeyProviderMaker, order, process.env.MAKER_ADDRESS);
let isValid = await exchange.methods.isValidOrderSignature(order, sOrder.signature).call();
if (!isValid)
return;
const erc20Instance = new web3Taker.eth.Contract(erc21Test20.abi, erc20addr);
let isApproved1 = await erc20Instance.methods.approve(erc20ProxyAddr, amount).send({from: takerAccount});
if (!isApproved1)
return;
let isApproved2 = await erc721Instance.methods.approve(erc721ProxyAddr, tokenId).send({from: makerAcount });
if (!isApproved2)
return;
let res = await exchange.methods.fillOrder(order, new BigNumber(100000), sOrder.signature)
.send({from: takerAccount, value:10000000, gas:18000000});
Could someone tell what is wrong in this code or point to the working example? Thank you