Skip to content

Commit

Permalink
Merge pull request #294 from lfglabs-dev/fix/nimbora-rewards
Browse files Browse the repository at this point in the history
fix: nimbora rewards
  • Loading branch information
Marchand-Nicolas authored Oct 25, 2024
2 parents 09d2f0b + 6701aa6 commit 6c8c067
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/endpoints/defi/rewards.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ async fn fetch_zklend_rewards(
.filter(|reward| !reward.claimed)
.map(|reward| CommonReward {
amount: reward.amount.value,
displayed_amount: reward.amount.value,
proof: reward.proof,
reward_id: Some(reward.claim_id),
claim_contract: reward.claim_contract,
Expand Down Expand Up @@ -191,6 +192,7 @@ async fn fetch_nostra_rewards(
{
Some(CommonReward {
amount: doc.reward,
displayed_amount: doc.reward,
proof: doc.proofs,
reward_id: None,
claim_contract: distributor,
Expand Down Expand Up @@ -245,7 +247,8 @@ async fn fetch_nimbora_rewards(
return Ok(vec![]);
}
let reward = CommonReward {
amount: amount - claimed_amount,
amount: amount,
displayed_amount: amount - claimed_amount,
proof: result.proof,
reward_id: None,
token_symbol: strk_symbol.clone(),
Expand Down Expand Up @@ -301,6 +304,7 @@ async fn fetch_ekubo_rewards(
{
Some(CommonReward {
amount: reward.claim.amount,
displayed_amount: reward.claim.amount,
proof: reward.proof,
reward_id: Some(reward.claim.id),
claim_contract: reward.contract_address,
Expand Down Expand Up @@ -369,7 +373,7 @@ fn extract_rewards(common_rewards: &[CommonReward]) -> Vec<DefiReward> {
common_rewards
.iter()
.map(|reward| DefiReward {
amount: reward.amount,
amount: reward.displayed_amount,
token_symbol: reward.token_symbol.clone(),
})
.collect()
Expand Down
1 change: 1 addition & 0 deletions src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,7 @@ pub enum RewardSource {
#[derive(Serialize, Deserialize, Debug)]
pub struct CommonReward {
pub amount: FieldElement,
pub displayed_amount: FieldElement,
pub proof: Vec<String>,
pub reward_id: Option<u64>,
pub claim_contract: FieldElement,
Expand Down

0 comments on commit 6c8c067

Please sign in to comment.