diff --git a/Dockerfile b/Dockerfile index 9efeeb7..7bf0f4a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -57,7 +57,7 @@ COPY ./src ./src # Build for release RUN rm -rf ./target/x86_64-unknown-linux-musl/release/deps/karnot_bridge_deploy* RUN cargo build --target x86_64-unknown-linux-musl --release -RUN touch addresses.json +RUN mkdir data && touch data/addresses.json ENV RUST_LOG=debug diff --git a/Readme.md b/Readme.md index 8bd9220..43f95d3 100644 --- a/Readme.md +++ b/Readme.md @@ -54,6 +54,8 @@ cargo build --release RUST_LOG=debug cargo run -- --help ``` +**IMP 🚨** : It will store all the addresses in [data/addresses.json](data/addresses.json) + ### Docker 🐳 1. You need to set up the .env file first. Fill all @@ -72,7 +74,9 @@ RUST_LOG=debug cargo run -- --help 3. Run the image ```shell # If both the networks are running locally - docker run -it --net=host karnot-bridge-deploy-app + docker compose -f docker-compose-local.yml up # If you are hosting on already deployed networks - docker run -it karnot-bridge-deploy-app + docker compose up ``` + +**IMP 🚨** : It will store all the addresses in [data/addresses.json](data/addresses.json) diff --git a/docker-compose-local.yml b/docker-compose-local.yml new file mode 100644 index 0000000..1a4d3fc --- /dev/null +++ b/docker-compose-local.yml @@ -0,0 +1,23 @@ +version: "3.8" +services: + app: + build: + context: . + args: + APP_CHAIN_ID: ${APP_CHAIN_ID} + ETH_CHAIN_ID: ${ETH_CHAIN_ID} + ETH_PRIV_KEY: ${ETH_PRIV_KEY} + ETH_RPC: ${ETH_RPC} + FEE_TOKEN_ADDRESS: ${FEE_TOKEN_ADDRESS} + L1_DEPLOYER_ADDRESS: ${L1_DEPLOYER_ADDRESS} + L1_WAIT_TIME: ${L1_WAIT_TIME} + L2_DEPLOYER_ADDRESS: ${L2_DEPLOYER_ADDRESS} + ROLLUP_PRIV_KEY: ${ROLLUP_PRIV_KEY} + SN_OS_CONFIG_HASH_VERSION: ${SN_OS_CONFIG_HASH_VERSION} + SN_OS_PROGRAM_HASH: ${SN_OS_PROGRAM_HASH} + CROSS_CHAIN_WAIT_TIME: ${CROSS_CHAIN_WAIT_TIME} + volumes: + - type: bind + source: ./data + target: /karnot-bridge-deploy/data/ + network_mode: host diff --git a/docker-compose.yml b/docker-compose.yml index 3403a98..f7fb724 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,4 +17,6 @@ services: SN_OS_PROGRAM_HASH: ${SN_OS_PROGRAM_HASH} CROSS_CHAIN_WAIT_TIME: ${CROSS_CHAIN_WAIT_TIME} volumes: - - ./addresses.json:/karnot-bridge-deploy/addresses.json:rw + - type: bind + source: ./data + target: /karnot-bridge-deploy/data/ diff --git a/eth_event.sh b/eth_event.sh deleted file mode 100755 index 72e4abd..0000000 --- a/eth_event.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -while true; - do curl http://localhost:8545 -X POST -H "Content-Type: application/json" --data '{"method":"eth_getLogs","params":[{"address": "0xe7f1725e7734ce288f8367e1bb143e90bb3f0512"}],"id":1,"jsonrpc":"2.0"}'; - sleep 1; -done diff --git a/src/main.rs b/src/main.rs index 5248e0e..f7de098 100644 --- a/src/main.rs +++ b/src/main.rs @@ -58,8 +58,7 @@ pub async fn deploy_bridges(config: &CliArgs) { let clients = Config::init(config).await; let core_contract_client = StarknetSovereignContract::deploy(&clients).await; log::debug!("Core address [📦] : {:?}", core_contract_client.address()); - save_to_json("l1_core_contract_address", &JsonValueType::EthAddress(core_contract_client.address().clone())) - .unwrap(); + save_to_json("l1_core_contract_address", &JsonValueType::EthAddress(core_contract_client.address())).unwrap(); let (program_hash, config_hash) = get_bridge_init_configs(config); core_contract_client.initialize_core_contract(0u64.into(), 0u64.into(), program_hash, config_hash).await; log::debug!("Bridge init for goerli successful [✅]"); diff --git a/src/utils/mod.rs b/src/utils/mod.rs index 37933ea..3c5ee21 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -76,7 +76,7 @@ pub enum JsonValueType { } pub fn save_to_json(key: &str, value: &JsonValueType) -> Result<(), io::Error> { - let file_path: &str = "./addresses.json"; + let file_path: &str = "./data/addresses.json"; let data = fs::read_to_string(file_path); let mut json: Map = match data { Ok(content) => serde_json::from_str(&content).unwrap_or_else(|_| Map::new()),