From bce21fc7552a0a8913c9514678b3f64363ee02ff Mon Sep 17 00:00:00 2001 From: Iris Date: Tue, 26 Mar 2024 12:22:07 +0100 Subject: [PATCH 1/2] fix: min_expiry_date in pipeline from config file --- .gitignore | 3 ++- bot/src/config.rs | 1 + bot/src/pipelines.rs | 2 +- config.template.toml | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index c083dc5..ec45b92 100644 --- a/.gitignore +++ b/.gitignore @@ -68,4 +68,5 @@ Cargo.lock # MSVC Windows builds of rustc generate these, which store debugging information *.pdb -config.testnet.toml \ No newline at end of file +config.testnet.toml +config/ \ No newline at end of file diff --git a/bot/src/config.rs b/bot/src/config.rs index 7a73711..9b19009 100644 --- a/bot/src/config.rs +++ b/bot/src/config.rs @@ -35,6 +35,7 @@ pub_struct!(Clone, Deserialize; MyAccount { pub_struct!(Clone, Deserialize; Renewals { delay: u64, + expiry_days: i64, }); pub_struct!(Clone, Deserialize; IndexerServer { diff --git a/bot/src/pipelines.rs b/bot/src/pipelines.rs index 6a66724..c63d0cc 100644 --- a/bot/src/pipelines.rs +++ b/bot/src/pipelines.rs @@ -16,7 +16,7 @@ pub async fn get_auto_renewal_data( state: &Arc, ) -> Result> { let auto_renews_collection = state.db.collection::("auto_renew_flows"); - let min_expiry_date = Utc::now() + Duration::days(400); + let min_expiry_date = Utc::now() + Duration::days(config.renewals.expiry_days); let erc20_addr = to_hex(config.contract.erc20); let auto_renew_contract = FieldElement::to_string(&config.contract.renewal); println!("timestamp: {}", min_expiry_date.timestamp()); diff --git a/config.template.toml b/config.template.toml index 360eda5..4c624ec 100644 --- a/config.template.toml +++ b/config.template.toml @@ -18,6 +18,7 @@ address = "0x123" [renewals] delay = 86400 # 24 hours +expiry_days = 30 # number of days before expiry to renew [indexer_server] port = [8005, 8007, 8008] From 666432206c251aa2b80d9b6c3230d485c30b1cef Mon Sep 17 00:00:00 2001 From: Iris Date: Tue, 26 Mar 2024 12:22:53 +0100 Subject: [PATCH 2/2] fix: get_auto_renewal_altcoins_data pipeline expiry date --- bot/src/pipelines.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/src/pipelines.rs b/bot/src/pipelines.rs index c63d0cc..ba8a021 100644 --- a/bot/src/pipelines.rs +++ b/bot/src/pipelines.rs @@ -110,7 +110,7 @@ pub async fn get_auto_renewal_altcoins_data( state: &Arc, ) -> Result> { let auto_renews_collection = state.db.collection::("auto_renew_flows_altcoins"); - let min_expiry_date = Utc::now() + Duration::days(400); // todo : change to 30 days + let min_expiry_date = Utc::now() + Duration::days(config.renewals.expiry_days); // Define aggregate pipeline let pipeline = vec![