Skip to content

Commit

Permalink
Merge branch 'starknet-id:testnet' into routing_change
Browse files Browse the repository at this point in the history
  • Loading branch information
PoulavBhowmick03 authored Aug 24, 2024
2 parents 5f92452 + b224caa commit 6cfb5e1
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 1,073 deletions.
1,071 changes: 0 additions & 1,071 deletions config.template.toml

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ pub_struct!(Clone, Deserialize; Config {
quests: Quests,
twitter: Twitter,
discord: Discord,
quizzes: HashMap<String, Quiz>,
starkscan: Starkscan,
achievements: Achievements,
quest_boost: QuestBoost,
Expand Down
1 change: 1 addition & 0 deletions src/endpoints/admin/balance/create_balance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ pub async fn handler(
desc: body.desc.clone(),
verify_redirect: None,
href: body.href.clone(),
total_amount: None,
quest_id: body.quest_id,
id: next_id,
cta: body.cta.clone(),
Expand Down
1 change: 1 addition & 0 deletions src/endpoints/admin/custom/create_custom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ pub async fn handler(
verify_redirect: Some(body.href.clone()),
href: body.href.clone(),
quest_id: body.quest_id,
total_amount: None,
id: next_id,
cta: body.cta.clone(),
verify_endpoint: body.api.clone(),
Expand Down
1 change: 1 addition & 0 deletions src/endpoints/admin/discord/create_discord.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ pub async fn handler(
href: body.invite_link.clone(),
quest_id: body.quest_id.clone(),
id: next_id,
total_amount: None,
cta: "Join now!".to_string(),
verify_endpoint: "quests/discord_fw_callback".to_string(),
verify_endpoint_type: "oauth_discord".to_string(),
Expand Down
1 change: 1 addition & 0 deletions src/endpoints/admin/domain/create_domain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ pub async fn handler(
let new_document = QuestTaskDocument {
name: body.name.clone(),
desc: body.desc.clone(),
total_amount: None,
href: "https://app.starknet.id/".to_string(),
quest_id: body.quest_id.clone(),
id: next_id,
Expand Down
1 change: 1 addition & 0 deletions src/endpoints/admin/quiz/create_quiz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ pub async fn handler(
name: body.name.clone(),
desc: body.desc.clone(),
href: body.help_link.clone(),
total_amount: None,
cta: body.cta.clone(),
quest_id: body.quest_id.clone(),
id: next_id.clone(),
Expand Down
1 change: 1 addition & 0 deletions src/endpoints/admin/twitter/create_twitter_fw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ pub async fn handler(
let new_document = QuestTaskDocument {
name: body.name.clone(),
desc: body.desc.clone(),
total_amount: None,
verify_redirect: Some(format!(
"https://twitter.com/intent/user?screen_name={}",
body.username.clone()
Expand Down
1 change: 1 addition & 0 deletions src/endpoints/admin/twitter/create_twitter_rw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ pub async fn handler(
let new_document = QuestTaskDocument {
name: body.name.clone(),
desc: body.desc.clone(),
total_amount: None,
verify_redirect: Some(body.post_link.clone()),
href: body.post_link.clone(),
quest_id: body.quest_id.clone(),
Expand Down
7 changes: 6 additions & 1 deletion src/endpoints/quests/verify_balance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,14 @@ pub async fn handler(
)
.await;

let required_amount = task.total_amount.unwrap_or_else(||
FieldElement::from_dec_str("3000000000000000").unwrap()
);

match call_result {
Ok(result) => {
if result[0] < FieldElement::from_dec_str("3000000000000000").unwrap() {
// if result[0] < FieldElement::from_dec_str("3000000000000000").unwrap() {
if result[0] < required_amount {
get_error("You didn't invest (enough).".to_string())
} else {
match state.upsert_completed_task(query.addr, task_id).await {
Expand Down
1 change: 1 addition & 0 deletions src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ pub struct QuestTaskDocument {
pub name: String,
pub desc: String,
pub cta: String,
pub total_amount: Option<FieldElement>,
pub verify_endpoint: String,
pub href: String,
pub verify_endpoint_type: String,
Expand Down

0 comments on commit 6cfb5e1

Please sign in to comment.