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..ba8a021 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()); @@ -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![ 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]