Skip to content

Commit

Permalink
Bug/maxfee index overflow (#42)
Browse files Browse the repository at this point in the history
* bug: index max fee assignment overflow

* chore/update examples with MAX_PATH_HOPS
  • Loading branch information
SirTLB authored Feb 15, 2023
1 parent c547c8f commit ed059be
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .env.juno.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ PROFIT_THRESHOLD="10000"
# LOGGING ENVIRONMENT VARIABLES
# SLACK_TOKEN =
# SLACK_CHANNEL =

MAX_PATH_HOPS="4"
# # SKIP SPECIFIC ENVIRONMENT VARIABLES
USE_SKIP = "1"
SKIP_URL= "http://juno-1-api.skip.money"
Expand Down
2 changes: 1 addition & 1 deletion .env.terra.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ WALLET_MNEMONIC="" ##change this
USE_MEMPOOL="1"
GAS_USAGE_PER_HOP="700000" #defines the gas usage per hop, 2 hop arb pays 1400000 gas, 3 hop will pay 2100000 etc
PROFIT_THRESHOLD="5000"

MAX_PATH_HOPS="4"

##LOGGING ENVIRONMENT VARIABLES, optional
#SLACK_TOKEN = ""
Expand Down
4 changes: 3 additions & 1 deletion src/core/types/arbitrageloops/mempoolLoop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ export class MempoolLoop {

const TX_FEE =
this.botConfig.txFees.get(arbTrade.path.pools.length) ??
Array.from(this.botConfig.txFees.values())[this.botConfig.txFees.size];

Array.from(this.botConfig.txFees.values())[this.botConfig.gasFees.size - 1];


// sign, encode and broadcast the transaction
const txRaw = await this.botClients.SigningCWClient.sign(
Expand Down
3 changes: 2 additions & 1 deletion src/core/types/arbitrageloops/skipLoop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ export class SkipLoop extends MempoolLoop {
//if gas fee cannot be found in the botconfig based on pathlengths, pick highest available
const TX_FEE =
this.botConfig.txFees.get(arbTrade.path.pools.length) ??
Array.from(this.botConfig.txFees.values())[this.botConfig.txFees.size];
Array.from(this.botConfig.txFees.values())[this.botConfig.gasFees.size - 1];

const txRaw: TxRaw = await this.botClients.SigningCWClient.sign(
this.account.address,
msgs,
Expand Down

0 comments on commit ed059be

Please sign in to comment.