Skip to content

Commit 5a4950c

Browse files
committed
fix: uniswapv3 subcommand
1 parent f8cba91 commit 5a4950c

File tree

3 files changed

+30
-5
lines changed

3 files changed

+30
-5
lines changed

cmd/loadtest/loadtestUsage.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
The `loadtest` tool is meant to generate various types of load against RPC end points. It leverages the [`ethclient`](https://pkg.go.dev/github.com/ethereum/go-ethereum/ethclient) library Go Ethereum to interact with the blockchain.x
1+
The `loadtest` tool is meant to generate various types of load against RPC end points. It leverages the [`ethclient`](https://pkg.go.dev/github.com/ethereum/go-ethereum/ethclient) library Go Ethereum to interact with the blockchain.
22

33
```bash
44
$ polycli wallet inspect --mnemonic "code code code code code code code code code code code quality" --addresses 1
@@ -15,12 +15,17 @@ The `--mode` flag is important for this command.
1515
amounts. Each transaction is a single transfer.
1616
- `7`/`erc721` will run an ERC721 mint test which will mint an NFT
1717
over and over again.
18-
- `i`/`inc`/`increment` will call the increment function repeatedly on
18+
- `inc`/`increment` will call the increment function repeatedly on
1919
the load test contract. It's a minimal example of a contract call
2020
that will require an update to a contract's storage.
2121
- `s`/`store` is used to store random data in the smart contract
2222
storage. The amount of data stored per transaction is controlled
2323
with the `store-data-size` flag.
24+
- `b`/`blob` will send EIP-4844 blob transactions. Use `--blob-fee-cap`
25+
to set the maximum blob fee per chunk.
26+
- `cc`/`contract-call` will call a specific contract function. Requires
27+
`--contract-address` and `--calldata` flags. Use `--contract-call-payable`
28+
if the function is payable.
2429
- `R`/`recall` will attempt to replay all of the transactions from the
2530
previous blocks. You can use `--recall-blocks` to specify how many
2631
previous blocks should be used to seed transaction history. It's
@@ -34,6 +39,10 @@ The `--mode` flag is important for this command.
3439
full blockchain networks. The approach is similar to `recall` mode
3540
where we'll fetch some recent blocks and then use that data to
3641
generate a variety of calls to the RPC server.
42+
- `v3`/`uniswapv3` will deploy UniswapV3 contracts and perform token
43+
swaps. This mode can also be run as a subcommand (`polycli loadtest
44+
uniswapv3`) which provides additional flags for specifying
45+
pre-deployed contract addresses, pool fees, and swap amounts.
3746

3847
The default private key is: `42b6e34dc21598a807dc19d7784c71b2a7a01f6480dc6f58258f78e539f1a1fa`. We can use `wallet inspect` to get more information about this address, in particular its `ETHAddress` if you want to check balance or pre-mine value for this particular account.
3948

doc/polycli_loadtest.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ polycli loadtest [flags]
1919

2020
## Usage
2121

22-
The `loadtest` tool is meant to generate various types of load against RPC end points. It leverages the [`ethclient`](https://pkg.go.dev/github.com/ethereum/go-ethereum/ethclient) library Go Ethereum to interact with the blockchain.x
22+
The `loadtest` tool is meant to generate various types of load against RPC end points. It leverages the [`ethclient`](https://pkg.go.dev/github.com/ethereum/go-ethereum/ethclient) library Go Ethereum to interact with the blockchain.
2323

2424
```bash
2525
$ polycli wallet inspect --mnemonic "code code code code code code code code code code code quality" --addresses 1
@@ -36,12 +36,17 @@ The `--mode` flag is important for this command.
3636
amounts. Each transaction is a single transfer.
3737
- `7`/`erc721` will run an ERC721 mint test which will mint an NFT
3838
over and over again.
39-
- `i`/`inc`/`increment` will call the increment function repeatedly on
39+
- `inc`/`increment` will call the increment function repeatedly on
4040
the load test contract. It's a minimal example of a contract call
4141
that will require an update to a contract's storage.
4242
- `s`/`store` is used to store random data in the smart contract
4343
storage. The amount of data stored per transaction is controlled
4444
with the `store-data-size` flag.
45+
- `b`/`blob` will send EIP-4844 blob transactions. Use `--blob-fee-cap`
46+
to set the maximum blob fee per chunk.
47+
- `cc`/`contract-call` will call a specific contract function. Requires
48+
`--contract-address` and `--calldata` flags. Use `--contract-call-payable`
49+
if the function is payable.
4550
- `R`/`recall` will attempt to replay all of the transactions from the
4651
previous blocks. You can use `--recall-blocks` to specify how many
4752
previous blocks should be used to seed transaction history. It's
@@ -55,6 +60,10 @@ The `--mode` flag is important for this command.
5560
full blockchain networks. The approach is similar to `recall` mode
5661
where we'll fetch some recent blocks and then use that data to
5762
generate a variety of calls to the RPC server.
63+
- `v3`/`uniswapv3` will deploy UniswapV3 contracts and perform token
64+
swaps. This mode can also be run as a subcommand (`polycli loadtest
65+
uniswapv3`) which provides additional flags for specifying
66+
pre-deployed contract addresses, pool fees, and swap amounts.
5867

5968
The default private key is: `42b6e34dc21598a807dc19d7784c71b2a7a01f6480dc6f58258f78e539f1a1fa`. We can use `wallet inspect` to get more information about this address, in particular its `ETHAddress` if you want to check balance or pre-mine value for this particular account.
6069

loadtest/runner.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,14 @@ func (r *Runner) deployContracts(ctx context.Context, tops *bind.TransactOpts) e
986986
}
987987

988988
// Initialize UniswapV3 if needed
989-
if config.HasMode(config.ModeUniswapV3, r.cfg.ParsedModes) && r.cfg.UniswapV3 != nil {
989+
if config.HasMode(config.ModeUniswapV3, r.cfg.ParsedModes) {
990+
// Use default config if not provided (e.g., when using --mode uniswapv3 on root command)
991+
if r.cfg.UniswapV3 == nil {
992+
r.cfg.UniswapV3 = &config.UniswapV3Config{
993+
PoolFees: float64(uniswapv3.StandardTier),
994+
SwapAmountInput: uniswapv3.SwapAmountInput.Uint64(),
995+
}
996+
}
990997
log.Info().Msg("Initializing UniswapV3 contracts...")
991998
uniswapAddresses := uniswapv3.UniswapV3Addresses{
992999
FactoryV3: common.HexToAddress(r.cfg.UniswapV3.FactoryV3),

0 commit comments

Comments
 (0)