Skip to content

Commit

Permalink
Merge branch 'main' into fix/spam-nonce
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroXbrock committed Sep 29, 2023
2 parents f530504 + dd63f72 commit 20d7be6
Show file tree
Hide file tree
Showing 7 changed files with 495 additions and 217 deletions.
10 changes: 6 additions & 4 deletions cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $ npm install -g mevflood
$ mevflood COMMAND
running command...
$ mevflood (--version)
mevflood/0.0.6 darwin-x64 node-v16.16.0
mevflood/0.0.8 linux-x64 node-v20.2.0
$ mevflood --help [COMMAND]
USAGE
$ mevflood COMMAND
Expand Down Expand Up @@ -72,7 +72,7 @@ DESCRIPTION
Deploy smart contracts and provision liquidity on UniV2 pairs.
```

_See code: [dist/commands/init/index.ts](https://github.com/flashbots/mev-flood/blob/v0.0.6/dist/commands/init/index.ts)_
_See code: [dist/commands/init/index.ts](https://github.com/flashbots/mev-flood/blob/v0.0.8/dist/commands/init/index.ts)_

## `mevflood spam`

Expand All @@ -81,14 +81,16 @@ Send a constant stream of UniV2 swaps.
```
USAGE
$ mevflood spam [-r <value>] [-k <value>] [-u <value>] [-t <value>] [-p <value>] [-l <value>] [--revert]
[-s <value>]
FLAGS
-k, --privateKey=<value> [default: 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80] Private
key used to send transactions and deploy contracts.
-l, --loadFile=<value> Load the deployment details from a file.
-p, --secondsPerBundle=<value> [default: 12] Seconds to wait before sending another bundle.
-r, --rpcUrl=<value> [default: http://localhost:8545] HTTP JSON-RPC endpoint.
-t, --txsPerBundle=<value> [default: 2] Number of transactions to include in each bundle.
-s, --sendTo=<value> [default: mempool] Where to send transactions. (flashbots, mempool, mevshare, 0, 1, 2)
-t, --txsPerBundle=<value> [default: 1] Number of transactions to include in each bundle.
-u, --userKey=<value> [default: 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d] Private
key for the user wallet used to send transactions
--revert Send reverting transactions.
Expand All @@ -97,5 +99,5 @@ DESCRIPTION
Send a constant stream of UniV2 swaps.
```

_See code: [dist/commands/spam/index.ts](https://github.com/flashbots/mev-flood/blob/v0.0.6/dist/commands/spam/index.ts)_
_See code: [dist/commands/spam/index.ts](https://github.com/flashbots/mev-flood/blob/v0.0.8/dist/commands/spam/index.ts)_
<!-- commandsstop -->
5 changes: 3 additions & 2 deletions cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mevflood",
"version": "0.0.6",
"version": "0.0.8",
"description": "mev-flood cli simulates mev activity",
"author": "zeroXbrock",
"bin": {
Expand All @@ -20,7 +20,8 @@
"@oclif/core": "^2",
"@oclif/plugin-help": "^5",
"ethers": "^5",
"ethersV6": "npm:ethers@^6.3.0"
"ethersV6": "npm:ethers@^6.3.0",
"mev-flood": "../core"
},
"devDependencies": {
"@oclif/test": "^2.3.22",
Expand Down
11 changes: 9 additions & 2 deletions cli/src/commands/spam/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default class Spam extends Command {
char: 't',
description: 'Number of transactions to include in each bundle.',
required: false,
default: 2,
default: 1,
}),
secondsPerBundle: Flags.integer({
char: 'p',
Expand All @@ -34,6 +34,12 @@ export default class Spam extends Command {
required: false,
default: false,
}),
sendTo: Flags.string({
char: 's',
description: 'Where to send transactions. (' + Object.values(SendRoute).map(k => k.toString().toLowerCase()).filter(v => v.length > 2 /* lazy way to get rid of numbers without parsing strings into ints */).reduce((a, b) => a + ', ' + b) + ')',
required: false,
default: 'mempool',
}),
}

async run(): Promise<void> {
Expand All @@ -45,10 +51,11 @@ export default class Spam extends Command {
const flood = new MevFlood(wallet, provider, deployment)
this.log(`connected to ${flags.rpcUrl} with wallet ${wallet.address}`)
const txStrategy = flags.revert ? TxStrategy.UniV2Reverting : TxStrategy.UniV2
const sendTo = flags.sendTo.toLowerCase()

await spam.spamLoop(flood, wallet, {
txsPerBundle: flags.txsPerBundle,
sendRoute: SendRoute.Mempool,
sendRoute: sendTo === 'flashbots' ? SendRoute.Flashbots : (sendTo === 'mevshare' ? SendRoute.MevShare : SendRoute.Mempool),
secondsPerBundle: flags.secondsPerBundle,
txStrategy,
})
Expand Down
Loading

0 comments on commit 20d7be6

Please sign in to comment.