Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
rouzwelt committed Nov 5, 2024
1 parent 5002cdb commit aaaba91
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Other optional arguments are:
- `--pool-update-interval`, Option to specify time (in minutes) between pools updates, default is 15 minutes, Will override the 'POOL_UPDATE_INTERVAL' in env variables
- `--self-fund-orders`, Specifies owned order to get funded once their vault goes below the specified threshold, example: token,vaultId,threshold,toptupamount;token,vaultId,threshold,toptupamount;... . Will override the 'SELF_FUND_ORDERS' in env variables
- `--route`, Specifies the routing mode 'multi' or 'single' or 'full', default is 'single'. Will override the 'ROUTE' in env variables
- `--exec-record-size`, Option for specifying the count of latest rounds reports are used for calculating avg execution performance, default is 50, Will override the 'EXEC_RECORD_SIZE' in env variables
- `--exec-record-size`, Option for specifying the count of latest rounds reports used for calculating avg execution performances, default is 50, Will override the 'EXEC_RECORD_SIZE' in env variables
- `-w` or `--wallet-count`, Number of wallet to submit transactions with, requirs `--mnemonic`. Will override the 'WALLET_COUNT' in env variables
- `-t` or `--topup-amount`, The initial topup amount of excess wallets, requirs `--mnemonic`. Will override the 'TOPUP_AMOUNT' in env variables
- `-V` or `--version`, output the version number
Expand Down
2 changes: 1 addition & 1 deletion example.env
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ SELF_FUND_ORDERS=
# Specifies the routing mode 'multi' or 'single' or 'full', default is 'single'
ROUTE="single"

# Option for specifying the count of latest rounds reports are used for calculating avg execution performance, default is 50
# Option for specifying the count of latest rounds reports used for calculating avg execution performances, default is 50
EXEC_RECORD_SIZE=


Expand Down
32 changes: 26 additions & 6 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ const getOptions = async (argv: any, version?: string) => {
)
.option(
"--exec-record-size <integer>",
"Option for specifying the count of latest rounds reports are used for calculating avg execution performance, default is 50, Will override the 'EXEC_RECORD_SIZE' in env variables",
"Option for specifying the count of latest rounds reports used for calculating avg execution performances, default is 50, Will override the 'EXEC_RECORD_SIZE' in env variables",
)
.description(
[
Expand Down Expand Up @@ -251,7 +251,12 @@ export const arbRound = async (
if (!ordersDetails.length) {
span.setStatus({ code: SpanStatusCode.OK, message: "found no orders" });
span.end();
return { txs: [], oppCount: 0, successCount: 0, avgGasCost: undefined };
return {
txs: [],
oppCount: 0,
successCount: 0,
avgGasCost: undefined,
};
}
} catch (e: any) {
const snapshot = errorSnapshot("", e);
Expand All @@ -260,7 +265,12 @@ export const arbRound = async (
span.setAttribute("didClear", false);
span.setAttribute("foundOpp", false);
span.end();
return { txs: [], oppCount: 0, successCount: 0, avgGasCost: undefined };
return {
txs: [],
oppCount: 0,
successCount: 0,
avgGasCost: undefined,
};
}

try {
Expand Down Expand Up @@ -311,7 +321,12 @@ export const arbRound = async (
span.setAttribute("didClear", false);
span.setAttribute("foundOpp", false);
span.end();
return { txs: [], oppCount: 0, successCount: 0, avgGasCost: undefined };
return {
txs: [],
oppCount: 0,
successCount: 0,
avgGasCost: undefined,
};
}
} catch (e: any) {
const snapshot = errorSnapshot("Unexpected error occured", e);
Expand All @@ -321,7 +336,12 @@ export const arbRound = async (
span.setAttribute("didClear", false);
span.setAttribute("foundOpp", false);
span.end();
return { txs: [], oppCount: 0, successCount: 0, avgGasCost: undefined };
return {
txs: [],
oppCount: 0,
successCount: 0,
avgGasCost: undefined,
};
}
});
};
Expand Down Expand Up @@ -605,7 +625,7 @@ export const main = async (argv: any, version?: string) => {
roundSpan.setAttribute("didClear", false);
}

// record opps stdvs
// record round's opps difference from stdvs lower bound
const oppsCountStdvs = handleOppsRecord(
options.execRecordSize,
previousRoundsRecords,
Expand Down
2 changes: 2 additions & 0 deletions src/processOrders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,7 @@ export async function processPair(args: {
buyToken: orderPairObject.buyToken,
sellToken: orderPairObject.sellToken,
actualGasCost: ethers.utils.formatUnits(actualGasCost),
clearedOrders: orderPairObject.takeOrders.map((v) => v.id),
successfull: false,
};
result.reason = ProcessPairHaltReason.TxMineFailed;
Expand All @@ -758,6 +759,7 @@ export async function processPair(args: {
tokenPair: pair,
buyToken: orderPairObject.buyToken,
sellToken: orderPairObject.sellToken,
clearedOrders: orderPairObject.takeOrders.map((v) => v.id),
successfull: false,
};
if (actualGasCost) {
Expand Down
1 change: 1 addition & 0 deletions test/processPair.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,7 @@ describe("Test process pair", async function () {
sellToken: orderPairObject.sellToken,
txUrl: scannerUrl + "/tx/" + txHash,
actualGasCost: formatUnits(effectiveGasPrice.mul(gasUsed)),
clearedOrders: [orderPairObject.takeOrders[0].id],
successfull: false,
},
reason: ProcessPairHaltReason.TxMineFailed,
Expand Down

0 comments on commit aaaba91

Please sign in to comment.