- name: Start L1 and L2 stacks hosts: "{{ target_host }}" environment: PATH: "{{ ansible_env.PATH }}:/home/{{ansible_user}}/bin" vars_files: - vars.yml vars: l1_rpc: "http://fixturenet-eth-geth-1:8545" l2_rpc: "http://op-geth:8545" deployment_context: "1212" account: "0xe6CE22afe802CAf5fF7d3845cec8c736ecc8d61F" eth_value: "1ether" fixturenet_optimism_dir: "{{ nitro_directory }}/fixturenet-optimism-deployment" fixturenet_eth_dir: "{{ nitro_directory }}/fixturenet-eth-deployment" tasks: - name: Start fixturenet-eth-deployment command: laconic-so deployment --dir fixturenet-eth-deployment start args: chdir: "{{ nitro_directory }}" - name: Start fixturenet-optimism-deployment command: laconic-so deployment --dir fixturenet-optimism-deployment start args: chdir: "{{ nitro_directory }}" - name: Get the funded accounts from L1 command: curl 127.0.0.1:9898/accounts.csv register: accounts_csv - debug: msg: "{{ accounts_csv.stdout }}" - name: Read the L1StandardBridgeProxy address from the L1 deployment records command: > laconic-so deployment --dir {{ fixturenet_optimism_dir }} exec op-node "cat /l1-deployment/{{ deployment_context }}-deploy.json | jq -r .L1StandardBridgeProxy" register: bridge_address - debug: msg: "L1StandardBridgeProxy Address: {{ bridge_address.stdout }}" - name: Get the funded account's private key from the L2 deployment command: > laconic-so deployment --dir {{ fixturenet_optimism_dir }} exec op-node "jq -r '.AdminKey' /l2-accounts/accounts.json" register: account_pk - debug: msg: "Private Key: {{ account_pk.stdout }}" - name: Send ETH from L1 to the bridge contract on L2 command: > laconic-so deployment --dir {{ fixturenet_eth_dir }} exec foundry "cast send --from {{ account }} --value {{ eth_value }} {{ bridge_address.stdout }} --rpc-url {{ l1_rpc }} --private-key {{ account_pk.stdout }}" register: send_eth - debug: msg: "Send ETH Command Output: {{ send_eth.stdout }}" - name: Wait for the bridge to complete pause: seconds: 20 - name: Check balance on L2 command: > laconic-so deployment --dir {{ fixturenet_eth_dir }} exec foundry "cast balance {{ account }} --rpc-url {{ l2_rpc }}" register: l2_balance - debug: msg: "L2 Balance: {{ l2_balance.stdout }}" - name: Copy over spec file for nitro contracts deployment template: src: "./templates/specs/nitro-contracts-spec.yml.j2" dest: "{{ nitro_directory }}/nitro-contracts-spec.yml" vars: GETH_DEPLOYER_PK: '{{ account_pk.stdout }}' - name: Check if deployment exists for nitro contracts stat: path: "{{ nitro_directory }}/nitro-contracts-deployment" register: nitro_contracts_deployment - name: Create a deployment for nitro contracts command: laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-contracts deploy create --spec-file nitro-contracts-spec.yml --deployment-dir nitro-contracts-deployment args: chdir: "{{ nitro_directory }}" when: not nitro_contracts_deployment.stat.exists - name: Start deployment for nitro-contracts command: laconic-so deployment --dir nitro-contracts-deployment start args: chdir: "{{ nitro_directory }}" - name: Wait for the contracts to be deployed wait_for: path: "{{ nitro_directory }}/nitro-contracts-deployment/data/nitro_deployment/nitro-addresses.json" timeout: 60 - name: Export NA_ADDRESS shell: laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"1212\"[0].contracts.NitroAdjudicator.address' /app/deployment/nitro-addresses.json" args: chdir: "{{ nitro_directory }}" register: NA_ADDRESS - debug: msg: "NA_ADDRESS: {{ NA_ADDRESS.stdout }}" - name: Export CA_ADDRESS shell: laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"1212\"[0].contracts.ConsensusApp.address' /app/deployment/nitro-addresses.json" args: chdir: "{{ nitro_directory }}" register: CA_ADDRESS - debug: msg: "CA_ADDRESS: {{ CA_ADDRESS.stdout }}" - name: Export VPA_ADDRESS shell: laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"1212\"[0].contracts.VirtualPaymentApp.address' /app/deployment/nitro-addresses.json" args: chdir: "{{ nitro_directory }}" register: VPA_ADDRESS - debug: msg: "VPA_ADDRESS: {{ VPA_ADDRESS.stdout }}" - name: Export L1_ASSET_ADDRESS shell: laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"1212\"[0].contracts.Token.address' /app/deployment/nitro-addresses.json" args: chdir: "{{ nitro_directory }}" register: L1_ASSET_ADDRESS - debug: msg: "L1_ASSET_ADDRESS: {{ L1_ASSET_ADDRESS.stdout }}" - name: Copy over spec file for bridge deployment template: src: "./templates/specs/bridge-nitro-spec.yml.j2" dest: "{{ nitro_directory }}/bridge-nitro-spec.yml" vars: GETH_DEPLOYER_PK: '{{ account_pk.stdout }}' OPTIMISM_DEPLOYER_PK: '{{ account_pk.stdout }}' - name: Check if deployment exists for bridge node stat: path: "{{ nitro_directory }}/bridge-deployment" register: bridge_deployment - name: Create a deployment for the bridge node command: laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/bridge deploy create --spec-file bridge-nitro-spec.yml --deployment-dir bridge-deployment args: chdir: "{{ nitro_directory }}" when: not bridge_deployment.stat.exists - name: Start the nitro bridge command: laconic-so deployment --dir bridge-deployment start args: chdir: "{{ nitro_directory }}" - name: Set Alice's chain address set_fact: A_CHAIN_ADDRESS: "0xe22AD83A0dE117bA0d03d5E94Eb4E0d80a69C62a" - name: Set Charlie's chain address set_fact: C_CHAIN_ADDRESS: "0xf1ac8Dd1f6D6F5c0dA99097c57ebF50CD99Ce293" - name: Send tokens to Alice shell: > laconic-so deployment --dir bridge-deployment exec l2-nitro-contracts "cd packages/nitro-protocol && yarn hardhat transfer --contract {{ L1_ASSET_ADDRESS.stdout }} --to {{ A_CHAIN_ADDRESS }} --amount 1000 --network geth" args: chdir: "{{ nitro_directory }}" - name: Send tokens to Charlie shell: > laconic-so deployment --dir bridge-deployment exec l2-nitro-contracts "cd packages/nitro-protocol && yarn hardhat transfer --contract {{ L1_ASSET_ADDRESS.stdout }} --to {{ C_CHAIN_ADDRESS }} --amount 1000 --network geth" args: chdir: "{{ nitro_directory }}" - name: Export BRIDGE_ADDRESS shell: laconic-so deployment --dir bridge-deployment exec nitro-bridge "jq -r '.\"42069\"[0].contracts.Bridge.address' /app/deployment/nitro-addresses.json" args: chdir: "{{ nitro_directory }}" register: BRIDGE_ADDRESS - debug: msg: "BRIDGE_ADDRESS: {{ BRIDGE_ADDRESS.stdout }}" - name: Set Private keys set_fact: A_PRIVATE_KEY: "0x9aebbd42f3044295411e3631fcb6aa834ed5373a6d3bf368bfa09e5b74f4f6d1" C_PRIVATE_KEY: "0x19242258fc60ec7488db0163b20ed1c32f2d27dc49e4d427a461e20a6656de20" - name: Copy spec file for L1 Alice template: src: "./templates/configs/l1alice-config.env.j2" dest: "{{ nitro_directory }}/l1alice-nitro-deployment/config.env" - name: Copy spec file for L1 Charlie template: src: "./templates/configs/l1charlie-config.env.j2" dest: "{{ nitro_directory }}/l1charlie-nitro-deployment/config.env" - name: Copy spec file for L2 Alice template: src: "./templates/configs/l2alice-config.env.j2" dest: "{{ nitro_directory }}/l2alice-nitro-deployment/config.env" - name: Copy spec file for L2 Charlie template: src: "./templates/configs/l2charlie-config.env.j2" dest: "{{ nitro_directory }}/l2charlie-nitro-deployment/config.env" - name: Start deployment for L1 Alice shell: laconic-so deployment --dir l1alice-nitro-deployment start args: chdir: "{{ nitro_directory }}" - name: Start deployment for L1 Charlie shell: laconic-so deployment --dir l1charlie-nitro-deployment start args: chdir: "{{ nitro_directory }}" - name: Start deployment for L2 Alice shell: laconic-so deployment --dir l2alice-nitro-deployment start args: chdir: "{{ nitro_directory }}" - name: Start deployment for L2 Charlie shell: laconic-so deployment --dir l2charlie-nitro-deployment start args: chdir: "{{ nitro_directory }}"