Skip to content

Commit

Permalink
Update routeProcessor.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
rouzwelt committed Nov 8, 2024
1 parent 036eb7d commit 702ed9d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/modes/routeProcessor.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-console */
import { Token } from "sushi/currency";
import { BaseError, PublicClient } from "viem";
import { getBountyEnsureBytecode } from "../config";
Expand Down Expand Up @@ -167,8 +168,11 @@ export async function dryrun({
try {
blockNumber = Number(await viemClient.getBlockNumber());
spanAttributes["blockNumber"] = blockNumber;
console.log("dryrun1");
gasLimit = ethers.BigNumber.from(await signer.estimateGas(rawtx));
console.log("end-dryrun1");
} catch (e) {
console.log("end-dryrun1-err");
// reason, code, method, transaction, error, stack, message
const isNodeError = containsNodeError(e as BaseError);
const errMsg = errorSnapshot("", e);
Expand Down Expand Up @@ -211,7 +215,9 @@ export async function dryrun({
try {
blockNumber = Number(await viemClient.getBlockNumber());
spanAttributes["blockNumber"] = blockNumber;
console.log("dryrun2");
gasLimit = ethers.BigNumber.from(await signer.estimateGas(rawtx));
console.log("end-dryrun2");
rawtx.gas = gasLimit.toBigInt();
gasCost = gasLimit.mul(gasPrice);
task.evaluable.bytecode = getBountyEnsureBytecode(
Expand All @@ -225,6 +231,7 @@ export async function dryrun({
task,
]);
} catch (e) {
console.log("end-dryrun2-err");
const isNodeError = containsNodeError(e as BaseError);
const errMsg = errorSnapshot("", e);
spanAttributes["isNodeError"] = isNodeError;
Expand Down

0 comments on commit 702ed9d

Please sign in to comment.