diff --git a/confiq.toml b/confiq.toml deleted file mode 100644 index b580acc2..00000000 --- a/confiq.toml +++ /dev/null @@ -1,125 +0,0 @@ -[server] -port = 8080 - -[database] -name = "starkship_server" -connection_string = "xxxxxx" - -[auth] -secret_key = "secret_key" -expiry_duration = 0 - -[watchtower] -endpoint = "https://api.watchtower.starknet.id/service/add_message" -app_id = "XXXXXXXXXXXXXXXXX" -token = "XXXXXXXXXXXXXXXXX" -enabled = true -[watchtower.types] -info = "goerli/info" -warning = "goerli/warning" -severe = "goerli/severe" - -[discover] -pairs_api_endpoint = "XXXXXXXX" -lending_api_endpoint = "XXXXXXXX" -derivates_api_endpoint = "XXXXXXXX" -alt_protocols_api_endpoint = "XXXXXXXX" - -[rhino] -api_endpoint="XXXXXXXXXXXX" - -[pyramid] -api_endpoint="XXXXXXXXXXXX" - -[nft_contract] -address = "0xFFFFFFFFFFFF" -private_key = "1" - -[starknetid_contracts] -naming_contract = "0xFFFFFFFFFFFF" -verifier_contracts = [ "0xFFFFFFFFFFFF" ] -identity_contract = "0xFFFFFFFFFFFF" - -[rango] -api_endpoint="XXXXXXXXXXXXXXXXX" -api_key="XXXXXXXXXXXXXXXXX" - -[quests] -utils_contract = "0x012" -[quests.sithswap] -utils_contract = "0xFFFFFFFFFFFF" -pairs = ["0xFFFFFFFFFFFF"] -[quests.jediswap] -utils_contract = "0xFFFFFFFFFFFF" -pairs = ["0xFFFFFFFFFFFF"] -[quests.carbonable] -contract = "0x014c6533fec6fd168189b49150907db533e8be3a2e69b0657ae4ec6459a94668" -[quests.hashstack] -contract = "0x0" -token_address = "0x0" -[quests.zklend] -contract = "0xFFFFFFFFFFFF" -utils_contract = "0xFFFFFFFFFFFF" -pairs = ["0xFFFFFFFFFFFF"] -[quests.ekubo] -contract = "0xFFFFFFFFFFFF" -[quests.myswap] -contract = "0xFFFFFFFFFFFF" -[quests.braavos] -api_key_user = "xxxxxx" -api_key_claimed_mission = "xxxxxx" -[quests.element] -api_key = "xxxxxx" -[quests.nostra] -utils_contract = "0xFFFFFFFFFFFF" -pairs = ["0xFFFFFFFFFFFF"] -staking_contract="0xFFFFFFFFFFFF" -[quests.haiko] -api_endpoint = "xxxxxx" -[quests.nimbora] -contract = "0xFFFFFFFFFFFF" -[quests.bountive] -contract = "0xFFFFFFFFFFFF" -[quests.sithswap_2] -api_endpoint = "xxxxxxx" - -[rewards] -[rewards.nimbora] -contract = "0x07ed46700bd12bb1ee8a33a8594791003f9710a1ab18edd958aed86a8f82d3d1" -[rewards.vesu] -contract = "0x0387f3eb1d98632fbe3440a9f1385aec9d87b6172491d3dd81f1c35a7c61048f" - -[tokens] -[tokens.strk] -contract = "0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d" -symbol = "STRK" -decimals = 18 - -[twitter] -oauth2_clientid = "xxxxxx" -oauth2_secret = "xxxxxx" - -[discord] -oauth2_clientid = "xxxxxx" -oauth2_secret = "xxxxxx" - -[variables] -app_link = "https://starknet.quest" -api_link = "https://api.starknet.quest" -is_testnet = false -rpc_url = "xxxxx" - -[starkscan] -api_key = "xxxxxx" - -[achievements] -[achievements.braavos] -contract = "0x00057c4b510d66eb1188a7173f31cccee47b9736d40185da8144377b896d5ff3" -[achievements.argent] -contract = "0x01b22f7a9d18754c994ae0ee9adb4628d414232e3ebd748c386ac286f86c3066" -[achievements.carbonable] -contract = "0x0541b5dd5fae206ceccaf4eeb0642e4c04d456c5bc296eab047c9414bdad4f09" - -[quest_boost] -private_key = "0xFFFFFFFFFFFF" -update_interval = 600 diff --git a/src/endpoints/admin/quest/get_quest_participants.rs b/src/endpoints/admin/quest/get_quest_participants.rs index f8210a3a..05df8977 100644 --- a/src/endpoints/admin/quest/get_quest_participants.rs +++ b/src/endpoints/admin/quest/get_quest_participants.rs @@ -8,12 +8,11 @@ use axum::{ response::{IntoResponse, Json}, }; use axum_auto_routes::route; -use futures::{StreamExt, TryStreamExt}; +use futures::StreamExt; use mongodb::bson::doc; use serde::Deserialize; use serde_json::json; -use crate::endpoints::admin::user; use crate::middleware::auth::auth_middleware; use crate::{ models::{AppState, CompletedTaskDocument, QuestTaskDocument}, @@ -92,4 +91,4 @@ pub async fn get_quest_participants_handler( let participants_json = json!({ "participants": participants }); (StatusCode::OK, Json(participants_json)).into_response() -} \ No newline at end of file +} diff --git a/src/endpoints/admin/quest/mod.rs b/src/endpoints/admin/quest/mod.rs index c722874d..514940a8 100644 --- a/src/endpoints/admin/quest/mod.rs +++ b/src/endpoints/admin/quest/mod.rs @@ -1,6 +1,6 @@ pub mod create_quest; mod get_quest; +pub mod get_quest_participants; pub mod get_quests; pub mod get_tasks; pub mod update_quest; -pub mod get_quest_participants; diff --git a/src/endpoints/admin/quiz/create_question.rs b/src/endpoints/admin/quiz/create_question.rs index a279985a..d103d1df 100644 --- a/src/endpoints/admin/quiz/create_question.rs +++ b/src/endpoints/admin/quiz/create_question.rs @@ -65,7 +65,8 @@ pub async fn handler( let mut state_last_id = state.last_question_id.lock().await; - let next_quiz_question_id = get_next_question_id(&quiz_questions_collection, state_last_id.clone()).await; + let next_quiz_question_id = + get_next_question_id(&quiz_questions_collection, state_last_id.clone()).await; *state_last_id = next_quiz_question_id; diff --git a/src/endpoints/admin/quiz/delete_question.rs b/src/endpoints/admin/quiz/delete_question.rs index 7039f600..4e4a3f4a 100644 --- a/src/endpoints/admin/quiz/delete_question.rs +++ b/src/endpoints/admin/quiz/delete_question.rs @@ -65,7 +65,10 @@ pub async fn handler( "id": &body.id, }; - return match quiz_questions_collection.delete_one(question_filter, None).await { + return match quiz_questions_collection + .delete_one(question_filter, None) + .await + { Ok(_) => ( StatusCode::OK, Json(json!({"message": "deleted successfully"})), @@ -73,4 +76,4 @@ pub async fn handler( .into_response(), Err(_e) => get_error("error deleting question".to_string()), }; -} \ No newline at end of file +} diff --git a/src/endpoints/admin/quiz/mod.rs b/src/endpoints/admin/quiz/mod.rs index df1f8777..27fcc69c 100644 --- a/src/endpoints/admin/quiz/mod.rs +++ b/src/endpoints/admin/quiz/mod.rs @@ -1,6 +1,6 @@ pub mod create_question; pub mod create_quiz; +pub mod delete_question; pub mod get_quiz; pub mod update_question; pub mod update_quiz; -pub mod delete_question; \ No newline at end of file diff --git a/src/endpoints/defi/mod.rs b/src/endpoints/defi/mod.rs index bad87da0..a5977669 100644 --- a/src/endpoints/defi/mod.rs +++ b/src/endpoints/defi/mod.rs @@ -1 +1 @@ -pub mod rewards; \ No newline at end of file +pub mod rewards; diff --git a/src/endpoints/get_boosted_quests.rs b/src/endpoints/get_boosted_quests.rs index 74b04cc4..fd292426 100644 --- a/src/endpoints/get_boosted_quests.rs +++ b/src/endpoints/get_boosted_quests.rs @@ -1,10 +1,10 @@ use crate::{models::AppState, utils::get_error}; use axum::{extract::State, response::IntoResponse, Json}; +use axum::http::StatusCode; use axum_auto_routes::route; use futures::TryStreamExt; use mongodb::bson::{doc, Document}; -use axum::http::StatusCode; use std::sync::Arc; #[route(get, "/get_boosted_quests")] diff --git a/src/endpoints/get_completed_quests.rs b/src/endpoints/get_completed_quests.rs index 2e39cac7..7a0e32fd 100644 --- a/src/endpoints/get_completed_quests.rs +++ b/src/endpoints/get_completed_quests.rs @@ -5,10 +5,10 @@ use axum::{ Json, }; +use axum::http::StatusCode; use axum_auto_routes::route; use futures::TryStreamExt; use mongodb::bson::{doc, Document}; -use axum::http::StatusCode; use serde::{Deserialize, Serialize}; use starknet::core::types::FieldElement; use std::sync::Arc; diff --git a/src/endpoints/get_quest_participants.rs b/src/endpoints/get_quest_participants.rs index 2e11b2e3..4ae8f29c 100644 --- a/src/endpoints/get_quest_participants.rs +++ b/src/endpoints/get_quest_participants.rs @@ -5,10 +5,10 @@ use axum::{ Json, }; +use axum::http::StatusCode; use axum_auto_routes::route; use futures::StreamExt; use mongodb::bson::{doc, Document}; -use axum::http::StatusCode; use serde::{Deserialize, Serialize}; use std::sync::Arc; diff --git a/src/endpoints/get_trending_quests.rs b/src/endpoints/get_trending_quests.rs index 6095702c..706a0583 100644 --- a/src/endpoints/get_trending_quests.rs +++ b/src/endpoints/get_trending_quests.rs @@ -2,6 +2,7 @@ use crate::{ models::{AppState, QuestDocument}, utils::get_error, }; +use axum::http::StatusCode; use axum::{ extract::{Query, State}, response::IntoResponse, @@ -10,7 +11,6 @@ use axum::{ use axum_auto_routes::route; use futures::StreamExt; use mongodb::bson::{doc, from_document}; -use axum::http::StatusCode; use serde::{Deserialize, Serialize}; use starknet::core::types::FieldElement; use std::sync::Arc; diff --git a/src/endpoints/has_completed_quest.rs b/src/endpoints/has_completed_quest.rs index e2beff87..9f6c3c4d 100644 --- a/src/endpoints/has_completed_quest.rs +++ b/src/endpoints/has_completed_quest.rs @@ -5,10 +5,10 @@ use axum::{ Json, }; +use axum::http::StatusCode; use axum_auto_routes::route; use futures::TryStreamExt; use mongodb::bson::{doc, Document}; -use axum::http::StatusCode; use serde::{Deserialize, Serialize}; use starknet::core::types::FieldElement; use std::sync::Arc; diff --git a/src/endpoints/leaderboard/get_ranking.rs b/src/endpoints/leaderboard/get_ranking.rs index 2c0ea9d9..b66abe45 100644 --- a/src/endpoints/leaderboard/get_ranking.rs +++ b/src/endpoints/leaderboard/get_ranking.rs @@ -41,12 +41,12 @@ use axum::{ use axum_auto_routes::route; use crate::utils::get_timestamp_from_days; +use axum::http::StatusCode; use axum::http::{header, Response}; use chrono::Utc; use futures::TryStreamExt; use mongodb::bson::{doc, Document}; use mongodb::Collection; -use axum::http::StatusCode; use serde::{Deserialize, Serialize}; use std::sync::Arc; diff --git a/src/endpoints/leaderboard/get_static_info.rs b/src/endpoints/leaderboard/get_static_info.rs index 0a04f7f8..ea95bc7b 100644 --- a/src/endpoints/leaderboard/get_static_info.rs +++ b/src/endpoints/leaderboard/get_static_info.rs @@ -16,11 +16,11 @@ use axum_auto_routes::route; use crate::utils::get_timestamp_from_days; use axum::http::header; +use axum::http::StatusCode; use axum::response::Response; use chrono::Utc; use futures::TryStreamExt; use mongodb::bson::{doc, Document}; -use axum::http::StatusCode; use serde::{Deserialize, Serialize}; use std::sync::Arc; diff --git a/src/endpoints/mod.rs b/src/endpoints/mod.rs index 58c8d42d..7bcf59be 100644 --- a/src/endpoints/mod.rs +++ b/src/endpoints/mod.rs @@ -1,6 +1,7 @@ pub mod achievements; pub mod admin; pub mod analytics; +pub mod defi; pub mod discover; pub mod get_boosted_quests; pub mod get_completed_quests; @@ -17,4 +18,3 @@ pub mod leaderboard; pub mod quest_boost; pub mod quests; pub mod unique_page_visit; -pub mod defi; diff --git a/src/endpoints/quest_boost/get_claim_params.rs b/src/endpoints/quest_boost/get_claim_params.rs index 937aef26..e15e98e6 100644 --- a/src/endpoints/quest_boost/get_claim_params.rs +++ b/src/endpoints/quest_boost/get_claim_params.rs @@ -8,8 +8,8 @@ use axum_auto_routes::route; use std::str::FromStr; use crate::utils::to_hex; -use mongodb::bson::{doc, Bson, Document}; use axum::http::StatusCode; +use mongodb::bson::{doc, Bson, Document}; use serde::{Deserialize, Serialize}; use serde_json::json; use starknet::core::crypto::ecdsa_sign; diff --git a/src/endpoints/quest_boost/get_completed_boosts.rs b/src/endpoints/quest_boost/get_completed_boosts.rs index 1c3b8daf..bc69bfc1 100644 --- a/src/endpoints/quest_boost/get_completed_boosts.rs +++ b/src/endpoints/quest_boost/get_completed_boosts.rs @@ -5,10 +5,10 @@ use axum::{ Json, }; +use axum::http::StatusCode; use axum_auto_routes::route; use futures::TryStreamExt; use mongodb::bson::{doc, Document}; -use axum::http::StatusCode; use serde::{Deserialize, Serialize}; use starknet::core::types::FieldElement; use std::sync::Arc; diff --git a/src/endpoints/quests/claimable.rs b/src/endpoints/quests/claimable.rs index 9059342c..f2c81650 100644 --- a/src/endpoints/quests/claimable.rs +++ b/src/endpoints/quests/claimable.rs @@ -7,10 +7,10 @@ use axum::{ use crate::models::{Reward, RewardResponse}; use crate::utils::get_nft; +use axum::http::StatusCode; use axum_auto_routes::route; use futures::TryStreamExt; use mongodb::bson::{doc, Document}; -use axum::http::StatusCode; use serde::{Deserialize, Serialize}; use starknet::core::types::FieldElement; use starknet::signers::{LocalWallet, SigningKey}; diff --git a/src/logger.rs b/src/logger.rs index 973609f8..b1bb4409 100644 --- a/src/logger.rs +++ b/src/logger.rs @@ -1,5 +1,4 @@ use chrono::Utc; -use reqwest; use serde_derive::Serialize; use std::borrow::Cow; use std::sync::Arc; diff --git a/src/models.rs b/src/models.rs index dc111057..15960872 100644 --- a/src/models.rs +++ b/src/models.rs @@ -105,9 +105,9 @@ pub_struct!(Deserialize; CompletedTasks { #[derive(Debug, Serialize, Deserialize)] pub struct CompletedTaskDocument { - address: String, - task_id: u32, - timestamp: i64, + pub address: String, + pub task_id: u32, + pub timestamp: i64, } #[derive(Clone, Debug, Deserialize, Serialize)] @@ -519,4 +519,4 @@ pub struct DefiReward { pub_struct!(Deserialize; GetQuestParticipantsParams { quest_id: i64, -}); \ No newline at end of file +});