Error while fill order with 0x Protocol using BUSD

103 views Asked by At

I'm working with 0x Protocol, and and want to support users use BUSD to fill order to purchase NFT item. Basically, I do flowing steps:

const ethTokenAddress = contractWrappers.contractAddresses.etherToken;      // Contract BUSD
const ethToken = new ERC20TokenContract(ethTokenAddress, Web3.givenProvider);

const zrxTokenAddress = contractWrappers.contractAddresses.zrxToken;
const zrxToken = new ERC20TokenContract(zrxTokenAddress, Web3.givenProvider);

// 1. Allow the 0x ERC20 Proxy to move ZRX on behalf of takerAccount
const takerZRXApprovalTxHash = await zrxToken
                            .approve(contractWrappers.contractAddresses.erc20Proxy, UNLIMITED_ALLOWANCE_IN_BASE_UNITS)
                            .sendTransactionAsync({ from: taker });

// 2. Allow the 0x ERC20 Proxy move BUSD on behalf of takerAccount
const takerErc20ProxyApprovalTxHash = await ethToken
                                .approve(contractWrappers.contractAddresses.erc20Proxy, UNLIMITED_ALLOWANCE_IN_BASE_UNITS)
                                .sendTransactionAsync({ from: taker });

// 3. Fill Order
const txHash = await contractWrappers.exchange
                        .fillOrder(sraOrder, takerAssetAmount, sraOrder.signature)
                        .sendTransactionAsync({
                            from: taker,
                            ...TX_DEFAULTS,
                            value: calculateProtocolFee([sraOrder]),
                        });

But I encounter error with FillOrder function, there for transaction is failed.
Please help me resolve this problem.

Thank you!

0

There are 0 answers