- Run
bun install
to install all the dependencies - Create a
.env
file base on the .env.example file file, and set the required variables depending which script you are going to run.
Set the following environment variables required for running all the scripts, on each network.
ETH_RPC_URL
ARBITRUM_RPC_URL
SEPOLIA_RPC_URL
ARBITRUM_SEPOLIA_RPC_URL
ETHERSCAN_API_KEY
ARBISCAN_API_KEY
Make sure everything is setup properly by running the following scripts removing the --broadcast --verify
. This will
only simulate the deployment.
Both gateways are deployed using a CREATE3Factory
in order to make their addresses equal in both L1 and L2 networks.
Make sure to use the same CREATE3_FACTORY
, GATEWAY_SALT
and DEPLOYER_PK
values for running both scripts.
Notice that the values used for GATEWAY_SALT
can be used only once on each network.
L1XERC20Gateway Required environment variables:
GATEWAY_SALT
: Salt used for deploying the contract throughCREATE3Factory
. IMPORTANT: make sure to use the same address forL2XERC20Gateway
DEPLOYER_PK
: Your deployer address private key. IMPORTANT: make sure to use the same address forL2XERC20Gateway
CREATE3_FACTORY
: Address of theCREATE3Factory
. IMPORTANT: make sure to use the same address forL2XERC20Gateway
L1_GATEWAY_OWNER
: Gateway's owner addressL1_ARBITRUM_ROUTER
: Use0xcE18836b233C83325Cc8848CA4487e94C6288264
for deploying on SepoliaL1_ARBITRUM_INBOX
: Use0xaAe29B0366299461418F5324a79Afc425BE5ae21
for deploying on Sepolia
Sepolia
$ yarn deploy:gateway:sepolia
Ethereum Mainnet
$ yarn deploy:gateway
L2XER20Gateway Required environment variables:
GATEWAY_SALT
: Salt used for deploying the contract throughCREATE3Factory
. IMPORTANT: make sure to use the same address forL1XERC20Gateway
DEPLOYER_PK
: Your deployer address private key. IMPORTANT: make sure to use the same address forL1XERC20Gateway
CREATE3_FACTORY
: Address of theCREATE3Factory
. IMPORTANT: make sure to use the same address forL1XERC20Gateway
L1_GATEWAY
: Address resulting from runningdeploy:gateway:sepolia
L2_ARBITRUM_ROUTER
: Use0xcE18836b233C83325Cc8848CA4487e94C6288264
for deploying on Arbitrum Sepolia
Arbitrum Sepolia
$ yarn deploy:gateway:arb:sepolia
Arbitrum One
$ yarn deploy:gateway:arb
Both gateways are deployed using a CREATE3Factory
in order to make their addresses equal in both L1 and L2 networks.
Make sure to use the same CREATE3_FACTORY
, GATEWAY_SALT
and DEPLOYER_PK
values for running both scripts.
Notice that the values used for GATEWAY_SALT
can be used only once on each network.
L1LockboxGateway Required environment variables:
GATEWAY_SALT
: Salt used for deploying the contract throughCREATE3Factory
. IMPORTANT: make sure to use the same address forL2XERC20Gateway
DEPLOYER_PK
: Your deployer address private key. IMPORTANT: make sure to use the same address forL2XERC20Gateway
CREATE3_FACTORY
: Address of theCREATE3Factory
. IMPORTANT: make sure to use the same address forL2XERC20Gateway
L1_GATEWAY_OWNER
: Gateway's owner addressXERC20_LOCKBOX
: Address of the XERC20LockboxL1_ARBITRUM_ROUTER
: Use0xcE18836b233C83325Cc8848CA4487e94C6288264
for deploying on SepoliaL1_ARBITRUM_INBOX
: Use0xaAe29B0366299461418F5324a79Afc425BE5ae21
for deploying on Sepolia
Sepolia
$ yarn deploy:lockboxGateway:sepolia
Ethereum Mainnet
$ yarn deploy:lockboxGateway
L2LockboxGateway Required environment variables:
GATEWAY_SALT
: Salt used for deploying the contract throughCREATE3Factory
. IMPORTANT: make sure to use the same address forL1XERC20Gateway
DEPLOYER_PK
: Your deployer address private key. IMPORTANT: make sure to use the same address forL1XERC20Gateway
CREATE3_FACTORY
: Address of theCREATE3Factory
. IMPORTANT: make sure to use the same address forL1XERC20Gateway
L1_GATEWAY
: Address resulting from runningdeploy:gateway:sepolia
L2_ARBITRUM_ROUTER
: Use0xcE18836b233C83325Cc8848CA4487e94C6288264
for deploying on Arbitrum SepoliaL1_ERC20
: Address of the ERC20 on L1L2_XERC20
: Address of the XERC20 on L1
Arbitrum Sepolia
$ yarn deploy:lockboxGateway:arb:sepolia
Arbitrum One
$ yarn deploy:lockboxGateway:arb
XERC20
The XERC20 token is deployed using a XERC20Factory
contract. In order to have the token deployed on the same address on
both networks you must to use the same DEPLOYER_PK
, XERC20_FACTORY
, XERC20_NAME
and XERC20_SYMBOL
values for
running bot scripts.
Required environment variables:
DEPLOYER_PK
: Your deployer address private key. IMPORTANT: make sure to use the same address forXERC20 L2
XERC20_FACTORY
: The address of theXERC20Factory
. IMPORTANT: make sure to use the same address forXERC20 L2
XERC20_NAME
: The token nameXERC20_SYMBOL
: The token symbolXERC20_BURN_MINT_LIMITS
: OPTIONAL Burn and mint limits separated by,
to use for each bridgeXERC20_BRIDGES
: OPTIONAL Address of bridges separated by,
Sepolia
$ yarn deploy:token:sepolia
Arbitrum Sepolia
$ yarn deploy:token:arb:sepolia
Ethereum Mainnet
$ yarn deploy:token:sepolia
Arbitrum One
$ yarn deploy:token:arb:sepolia
L1XERC20Adapter
Required environment variables:
DEPLOYER_PK
: Your deployer address private key.L1_ADAPTER_OWNER
: Adapter's owner addressL1_XERC20
: The XERC20 address this adapter is being deployed for.L1_GATEWAY
: Address resulting from runningdeploy:gateway:sepolia
.
Sepolia
$ yarn deploy:adapter:sepolia
Ethereum Mainnet
$ yarn deploy:adapter
This step is required in order to:
- Set the relation between the adapter and gateway within the router
- Register the token on L2 gateway
Required environment variables:
L1_ADAPTER_OWNER_PK
: Owner ofL1XERC20Adapter
address private keySEND_VALUE
: Total amount of ETH to send for paymentL1_ADAPTER
: AddressL1XERC20Adapter
L2_XERC20
: The XERC20 address on L2.MAX_SUBMISSION_COST_FOR_GATEWAY
: Base submission cost L2 retryable ticket for gatewayMAX_SUBMISSION_COST_FOR_ROUTER
: Base submission cost L2 retryable ticket for routerMAX_GAS_FOR_GATEWAY
: Max gas for L2 retryable execution for gateway messageMAX_GAS_FOR_ROUTER
: Max gas for L2 retryable execution for router messageGAS_PRICE_BID
: Gas price for L2 retryable ticketVALUE_FOR_GATEWAY
: ETH value to transfer to the gatewayVALUE_FOR_ROUTER
: ETH value to transfer to the gateway
Sepolia
$ yarn run:register:sepolia
Ethereum Mainnet
$ yarn run:register