diff --git a/src/endpoints/quest_boost/get_claim_params.rs b/src/endpoints/quest_boost/get_claim_params.rs index f90885d0..8959551b 100644 --- a/src/endpoints/quest_boost/get_claim_params.rs +++ b/src/endpoints/quest_boost/get_claim_params.rs @@ -37,9 +37,11 @@ pub async fn handler( let boost: Document = res.unwrap(); let num_of_winners = boost.get("num_of_winners").unwrap().as_i32().unwrap(); - let amount = boost.get("amount").unwrap().as_i32().unwrap() as u32 / num_of_winners as u32; + let decimals = boost.get("token_decimals").unwrap().as_i32().unwrap(); + let amount: u128 = boost.get("amount").unwrap().as_i32().unwrap() as u128 * 10u128.pow(decimals as u32); + let modified_amount = amount / num_of_winners as u128; let token = boost.get("token").unwrap().as_str().unwrap(); - + let winner_list = boost.get("winner").unwrap().as_array().unwrap(); let bson_value: Bson = Bson::String(address.clone()); @@ -51,7 +53,7 @@ pub async fn handler( let hashed = pedersen_hash( &FieldElement::from(boost_id), &pedersen_hash( - &FieldElement::from(amount), + &FieldElement::from(modified_amount), &pedersen_hash( &FieldElement::from(0 as u32), &pedersen_hash( diff --git a/src/models.rs b/src/models.rs index 7db43df3..652d8852 100644 --- a/src/models.rs +++ b/src/models.rs @@ -165,6 +165,7 @@ pub_struct!(Debug, Serialize, Deserialize; BoostTable { name: String, hidden: bool, num_of_winners: i64, + token_decimals: i64, }); pub_struct!(Debug, Serialize, Deserialize; NftBalance {