This repo contains all the necessary steps to:
- Transfer Funds from PreFunded Key on L1 to your wallet.
- Deploy Contracts on L1.
- Deposit Assets to L2.
- Withdraw Assets from L2.
First follow the instructions here to setup a local CDK node. It will setup a local L1 (geth) and a local L2 (CDK Validium Node), alongside the DAC and the Bridge Service.
Once you ensure that the local L1 and L2 are running, you can run the following commands to ping the local L1 and L2.
git clone https://github.com/integrations-Polygon/cdk-demo.git
cd cdk-demo
Create a .env file with these values:
ROOT_USER=<your_wallet_address>
CHILD_USER=<your_wallet_address>
ROOT_KEY=<your_wallets_key>
CHILD_KEY=<your_wallets_key>
ROOT_BRIDGE=0x4C739372258826995C302CD655beE12689B97d3F
CHILD_BRIDGE=0xff0ee8ea08cef5cb4322777f5cc3e8a584b8a4a0
ROOT_ERC20=<root_erc20_token_address>
CHILD_ERC20=<child_erc20_token_address>
ROOT_RPC=http://localhost:8545
CHILD_RPC=http://localhost:8123
node scripts/0_check_network.js
node scripts/1_transfer_funds.js
node scripts/2_deploy_erc20.js
Update the .env file with the ROOT_BRIDGE address
ROOT_ERC20=<process_here>
node scripts/3_deposit_bridge.js
node scripts/4_withdraw_bridge.js