From 420096fdffd01bb92492e0a24148f995cb4f54af Mon Sep 17 00:00:00 2001 From: Iris Date: Mon, 18 Sep 2023 10:23:03 +0200 Subject: [PATCH] feat: update verify_added_liquidity endpoint --- config.template.toml | 3 +-- src/config.rs | 3 +-- src/endpoints/quests/ekubo/verify_added_liquidity.rs | 12 +++++------- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/config.template.toml b/config.template.toml index 4e3e41d4..1592ded2 100644 --- a/config.template.toml +++ b/config.template.toml @@ -24,8 +24,7 @@ pairs = ["0xXXXXXXXXXXXX"] [quests.zklend] contract = "0xXXXXXXXXXXXX" [quests.ekubo] -utils_contract = "0xXXXXXXXXXXXX" -pairs = ["0xXXXXXXXXXXXX"] +contract = "0xXXXXXXXXXXXX" [twitter] oauth2_clientid = "xxxxxx" diff --git a/src/config.rs b/src/config.rs index e841e2bf..8ff9e7a3 100644 --- a/src/config.rs +++ b/src/config.rs @@ -50,8 +50,7 @@ pub_struct!(Clone, Deserialize; Jediswap { }); pub_struct!(Clone, Deserialize; Ekubo { - utils_contract: FieldElement, - pairs : Vec, + contract: FieldElement, }); pub_struct!(Clone, Deserialize; Quests { diff --git a/src/endpoints/quests/ekubo/verify_added_liquidity.rs b/src/endpoints/quests/ekubo/verify_added_liquidity.rs index 72427270..03ee2ae5 100644 --- a/src/endpoints/quests/ekubo/verify_added_liquidity.rs +++ b/src/endpoints/quests/ekubo/verify_added_liquidity.rs @@ -23,17 +23,15 @@ pub async fn handler( ) -> impl IntoResponse { let task_id = 38; let addr = &query.addr; - let mut calldata = vec![addr.clone(), state.conf.quests.sithswap.pairs.len().into()]; - calldata.append(&mut state.conf.quests.ekubo.pairs.clone()); - // get starkname from address + // check if user has provider liquidity let call_result = state .provider .call_contract( CallFunction { - contract_address: state.conf.quests.ekubo.utils_contract, - entry_point_selector: selector!("sum_balances"), - calldata, + contract_address: state.conf.quests.ekubo.contract, + entry_point_selector: selector!("balanceOf"), + calldata: vec![*addr], }, BlockId::Latest, ) @@ -42,7 +40,7 @@ pub async fn handler( match call_result { Ok(result) => { if result.result[0] == FieldElement::ZERO { - get_error("You didn't deposit liquidity.".to_string()) + get_error("You didn't provided any liquidity on Ekubo.".to_string()) } else { match state.upsert_completed_task(query.addr, task_id).await { Ok(_) => (StatusCode::OK, Json(json!({"res": true}))).into_response(),