Skip to content

Commit

Permalink
add just commands for evm transaction data (#12)
Browse files Browse the repository at this point in the history
Co-authored-by: Jordan Oroshiba <[email protected]>
Co-authored-by: Jordan Oroshiba <[email protected]>
  • Loading branch information
3 people authored Jul 21, 2023
1 parent ba50b71 commit 64ca972
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 12 deletions.
21 changes: 10 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ For local dev, make sure the [Astria Dev Cluster](https://github.com/astriaorg/d
Then deploy contracts in the following order:

### weth9

By default, the `just create-weth9` command will pull environment variables from the .env file. If you have deployed your own rollup in the [dev cluster](https://github.com/astriaorg/dev-cluster), you should replace the arguments in the `just` command with the rollup name and chain id you used for that deployment.

```bash
cd packages/weth9
cp .env.example .env
dotenv -- bash -c 'RUST_LOG=debug forge create \
--private-key $PRIVATE_KEY \
--rpc-url $JSON_RPC \
src/Weth9.sol:WETH9'
just create-weth9 <optional-rollupName> <optional-privateKey>
```

Upon completion, the following output will be shown (the addresses will be different):
Expand Down Expand Up @@ -67,18 +67,17 @@ dotenv -- bash -c 'RUST_LOG=debug forge script script/DeployUniswapV3.s.sol:Depl
--broadcast --skip-simulation -vvvvv'
```
### Generate Transactions

By default, the `just generate-transactions` command will pull environment variables from the .env file. If you have deployed your own rollup in the [dev cluster](https://github.com/astriaorg/dev-cluster), you should replace the arguments in the `just` command with the rollup name and chain id you used for that deployment.

```bash
cd packages/evm-test-data
cp .env.example .env
dotenv -- bash -c 'RUST_LOG=debug forge script script/DeployAndCallERC20.s.sol:DeployAndCallERC20 \
--optimizer-runs 2 \
--private-key $PRIVATE_KEY \
--rpc-url $JSON_RPC \
--chain-id 912559 \
--slow \
--broadcast --skip-simulation -vvvvv'
just generate-transactions <optional-rollupName> <optional-chainId> <optional-privateKey>
```



### Running Forge Tests

```bash
Expand Down
4 changes: 4 additions & 0 deletions packages/evm-test-data/.env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# NOTE - it's okay that this is checked in, it's a test/developer account.
# Please do not send real money to this address.
# default private key
PRIVATE_KEY=0x8b3a7999072c9c9314c084044fe705db11714c6c4ed7cddb64da18ea270dd203
#default json rpc
JSON_RPC=http://executor.astria.localdev.me
# default chain id
CHAIN_ID=912559
# LOOP_COUNT is cast to a uint in the script, so it must be a positive integer.
LOOP_COUNT=10
# ADDRESS_COUNT must be a positive integer and greater than 0.
Expand Down
2 changes: 1 addition & 1 deletion packages/evm-test-data/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ out/

# Ignores development broadcast logs
!/broadcast
/broadcast/*/912559/
/broadcast/*/*/
/broadcast/**/dry-run/

# Docs
Expand Down
16 changes: 16 additions & 0 deletions packages/evm-test-data/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
default:
@just --list

set dotenv-load
set fallback

defaultRollupName := ""
defaultNetworkId := ""
defaultPrivateKey := ""
generate-transactions rollupName=defaultRollupName networkId=defaultNetworkId privateKey=defaultPrivateKey:
forge script script/DeployAndCallERC20.s.sol:DeployAndCallERC20 \
--optimizer-runs 2 \
--private-key {{ if privateKey == '' { env_var('PRIVATE_KEY') } else { privateKey } }} \
--rpc-url {{ if rollupName == '' { env_var('JSON_RPC') } else { replace('http://executor.#.localdev.me', '#', rollupName) } }} \
--chain-id {{ if networkId == '' { env_var('CHAIN_ID') } else { networkId } }} \
--broadcast --skip-simulation -vvvvv
12 changes: 12 additions & 0 deletions packages/weth9/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
default:
@just --list

set dotenv-load
set fallback

defaultRollupName := ""
defaultPrivateKey := ""
create-weth9 rollupName=defaultRollupName privateKey=defaultPrivateKey:
forge create src/Weth9.sol:WETH9 \
--private-key {{ if privateKey == '' { env_var('PRIVATE_KEY') } else { privateKey } }} \
--rpc-url {{ if rollupName == '' { env_var('JSON_RPC') } else { replace('http://executor.#.localdev.me', '#', rollupName) } }}

0 comments on commit 64ca972

Please sign in to comment.