# install dependencies
yarn install --frozen-lockfile
# compile contracts and generate typechain
yarn build
- Network Name: Arbitrum Testnet
- RPC URL: https://rinkeby.arbitrum.io/rpc
- ChainID: 421611
- Symbol: ETH
- Block Explorer URL: https://rinkeby-explorer.arbitrum.io/#/
More info at: https://developer.offchainlabs.com/docs/public_testnet
There are 3 environment variables required in .env
prior to executing commands, which listed in .env.example
:
WALLET_ADDRESS
: Rinkeby wallet addressWALLET_PRIVATE_KEY
: Rinkeby wallet private keyL1_RPC_URL
: L1 ethereum rpc url, e.g., localhost, Alchemy or Infura (Only Rinkeby)L2_RPC_URL
: L2 arbitrum rpc url, e.g., https://rinkeby.arbitrum.io/rpc (testnet)
Command execution needs gas, please first get ETH to the wallet on Rinkeby side.
- Rinkeby Authenticated Faucet
- or anywhere else you know
For Arbitrum side, after getting ETH on Rinkeby, you can deposit ETH via Arbitrum Bridge.
Worker is a process that automatically deposits ERC20 to L2 and withraws that ERC20 back to L1, again and again.
Before running worker, you need to set your environment variables in .env
, mint TKN
by script listed in Commands > ERC20 section, and setup local database (sqlite) via command below:
# creates `local.db` under `worker/db` directory
yarn migration:up
After all settings are done, simply run command below to start a worker:
yarn execute worker
Worker writes logs into worker/worker.log
, get there to see what happen inside the worker.
Commands transfer ETH or tokens back and forth to the same wallet on Rinkeby and Arbitrum.
-
ethBalance
ethBalance
gets L1 and L2 ETH balances.yarn execute scripts/ethBalance.ts
-
tknBalance
tknBalance
gets L1 and L2 TKN balances.yarn execute scripts/tknBalance.ts
-
deposit
deposit
deposits0.1 ETH
from Rinkeby to Arbitrum.yarn execute scripts/deposit.ts
-
withdraw
withdraw
withdraws0.1 ETH
from Arbitrum to Rinkeby.yarn execute scripts/withdraw.ts
-
mint
mint
mints10 TKN
on Rinkeby, which is our ERC20 token for test.yarn execute scripts/mint.ts
-
depositERC20
depositERC20
deposits1 TKN
from Rinkeby to Arbitrum.yarn execute scripts/depositERC20.ts
-
withdrawERC20
withdrawERC20
withdraws0.1 TKN
from Arbitrum to Rinkeby.yarn execute scripts/withdrawERC20.ts
-
executeTransaction
executeTransaction
executes message from L2 to L1.batchNumber
andbatchIndex
are required arguments, which encoded in events emitted fromwithdraw
command.yarn execute scripts/executeTransaction.ts --help Options: --version Show version number [boolean] -n, --batchNumber Batch number including message [number] [required] -i, --batchIndex Message index in batch [number] [required] -h, --help Show help [boolean] yarn execute scripts/executeTransaction.ts -n 47 -i 6
-
redeem
redeem
executes message from L1 to L2.msgNum
is a required argument, which encoded asmessageNum
in events emitted fromdeposit
command.yarn execute scripts/redeem.ts --help Options: --version Show version number [boolean] -m, --msgNum L1 message number [number] [required] -h, --help Show help [boolean] yarn execute scripts/redeem.ts -m 9990
-
arbMessage
arbMessage
queries outgoing (Arbitrum to Rinkeby) message state.batchNumber
andbatchIndex
are required arguments, which encoded in events emitted fromwithdraw
command.yarn execute scripts/arbMessage.ts --help Options: --version Show version number [boolean] -n, --batchNumber Batch number including message [number] [required] -i, --batchIndex Message index in batch [number] [required] -h, --help Show help [boolean] yarn execute scripts/arbMessage.ts -n 47 -i 6
-
arbERC20Address
arbERC20Address
listsTKN
address and contract interface on Arbitrum.yarn execute scripts/arbERC20Address.ts
-
arbERC20Balance
arbERC20Balance
listsTKN
wallet balance and total supply on Arbitrum.yarn execute scripts/arbERC20Balance.ts
-
arbTicketId
arbTicketId
converts message unique id to ticket id.msgNum
is a required argument, which encoded asmessageNum
in events emitted fromdeposit
command.yarn execute scripts/arbTicketId.ts --help Options: --version Show version number [boolean] -m, --msgNum L1 message number [number] [required] -h, --help Show help [boolean] yarn execute scripts/arbTicketId.ts -m 9990
-
setValidators
setValidators
sets validators to rollup contract.yarn execute scripts/setValidators.ts --help Options: --version Show version number [boolean] -r, --rollup Rollup address [string] [required] -v, --validators Validator addresses separated by comma 0x01,0x02 [string] [required] -h, --help Show help [boolean] yarn execute scripts/setValidators.ts -r 0x2b39D5E8b1EFE16Fdb8ceD47c004733e345f4256 -v 0xf356cb4673c64e0928325029c9a628e9d16099a6,0xe6f31ad783a911b4c77d0c8429898aca788b9a9d