flashbots / ethers-provider-flashbots-bundle

Flashbots provider for ethers.js
543 stars 212 forks source link

execution reverted #112

Open yuzhongrong opened 7 months ago

yuzhongrong commented 7 months ago

the simulate result logs:

{ "bundleGasPrice": { "type": "BigNumber", "hex": "0x3f95c826" }, "bundleHash": "0x8e48b583cf400618731643f83ac906ae3d6c9f4ad041f5c26fb0700d282fe6fc", "coinbaseDiff": { "type": "BigNumber", "hex": "0x9499447dc400" }, "ethSentToCoinbase": { "type": "BigNumber", "hex": "0x00" }, "gasFees": { "type": "BigNumber", "hex": "0x9499447dc400" }, "results": [ { "txHash": "0x729f20355cbca7fd16658a629afcf78d08eff5b72d2f26d0844afa3dd489c256", "gasUsed": 22123, "gasPrice": "0", "gasFees": "0", "fromAddress": "0xF727aDCef4C8e1D348ACD16e815538FcB0403E1b", "toAddress": "0xC1c4301C5bd4eBe2C04817aC815AaceB4DeDA8DB", "coinbaseDiff": "0", "ethSentToCoinbase": "0", "error": "execution reverted", "revert": "\u0000\u0000\u0000", "value": null }, { "txHash": "0x9887f405a3a1ff5cb7b2823f47b2d2fe4ed914119655452b89c7d88109792d5b", "gasUsed": 108924, "gasPrice": "1500000000", "gasFees": "163386000000000", "fromAddress": "0xcB0F1996905CbDf2659FCB78EB4Ebd22afa70984", "toAddress": "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD", "coinbaseDiff": "163386000000000", "ethSentToCoinbase": "0", "value": "0x" }, { "txHash": "0xf0c3c99a665e0824ab43bc5bb536fe263561646426aea1434f2620d28d3f7d37", "gasUsed": 22111, "gasPrice": "0", "gasFees": "0", "fromAddress": "0xF727aDCef4C8e1D348ACD16e815538FcB0403E1b", "toAddress": "0xC1c4301C5bd4eBe2C04817aC815AaceB4DeDA8DB", "coinbaseDiff": "0", "ethSentToCoinbase": "0", "error": "execution reverted", "revert": "\u0000\u0000\u0000", "value": null } ], "stateBlockNumber": 10420429, "totalGasUsed": 153158, "firstRevert": { "txHash": "0x729f20355cbca7fd16658a629afcf78d08eff5b72d2f26d0844afa3dd489c256", "gasUsed": 22123, "gasPrice": "0", "gasFees": "0", "fromAddress": "0xF727aDCef4C8e1D348ACD16e815538FcB0403E1b", "toAddress": "0xC1c4301C5bd4eBe2C04817aC815AaceB4DeDA8DB", "coinbaseDiff": "0", "ethSentToCoinbase": "0", "error": "execution reverted", "revert": "\u0000\u0000\u0000", "value": null } }

that have a error message example:
"error": "execution reverted", "revert": "\u0000\u0000\u0000",

my first transation of the code is payload:

const backslicePayload = ethers.utils.solidityPack( ["address", "address", "uint128", "uint128", "uint8"], [ weth, pairToSandwich, sandwichStates.frontrun.amountOut, sandwichStates.backrun.amountOut, ethers.BigNumber.from(weth).lt(ethers.BigNumber.from(token)) ? 0 : 1, ] ); const backsliceTx = { to: CONTRACTS.SANDWICH, from: searcherWallet.address, data: backslicePayload, chainId: PUBLISH.ENV==0?Chain.Goerli:Chain.Mainnet, maxPriorityFeePerGas: 0, maxFeePerGas: nextBaseFee, gasLimit: 250000, nonce: nonce + 1, type: 2, }; const backsliceTxSigned = await searcherWallet.signTransaction(backsliceTx);

yuzhongrong commented 7 months ago

const frontslicePayload = ethers.utils.solidityPack( ["address", "address", "uint128", "uint128", "uint8"], [ token, pairToSandwich, optimalWethIn, sandwichStates.frontrun.amountOut, ethers.BigNumber.from(token).lt(ethers.BigNumber.from(weth)) ? 0 : 1, ] ); const frontsliceTx = { to: CONTRACTS.SANDWICH, from: searcherWallet.address, data: frontslicePayload, chainId: PUBLISH.ENV==0?Chain.Goerli:Chain.Mainnet, maxPriorityFeePerGas: 0, maxFeePerGas: nextBaseFee, gasLimit: 250000, nonce, type: 2, }; const frontsliceTxSigned = await searcherWallet.signTransaction(frontsliceTx);