Skip to content

Commit

Permalink
Update reward_index to store promotion reward in db
Browse files Browse the repository at this point in the history
  • Loading branch information
bbalser committed Oct 30, 2024
1 parent a0148bf commit 6d953c1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TYPE reward_type ADD VALUE 'mobile_promotion';
30 changes: 8 additions & 22 deletions reward_index/src/indexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ pub enum RewardType {
MobileServiceProvider,
MobileUnallocated,
IotUnallocated,
MobilePromotion,
}

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
Expand Down Expand Up @@ -185,28 +186,13 @@ impl Indexer {
},
r.amount,
))),
// Some(MobileReward::PromotionReward(PromotionReward {
// entity: Some(Entity::SubscriberId(subscriber_id)),
// service_provider_amount,
// matched_amount,
// })) => Ok(Some((
// RewardKey {
// key: bs58::encode(&subscriber_id).into_string(),
// reward_type: RewardType::MobileSubscriber,
// },
// service_provider_amount + matched_amount,
// ))),
// Some(MobileReward::PromotionReward(PromotionReward {
// entity: Some(Entity::GatewayKey(gateway_key)),
// service_provider_amount,
// matched_amount,
// })) => Ok(Some((
// RewardKey {
// key: PublicKeyBinary::from(gateway_key).to_string(),
// reward_type: RewardType::MobileGateway,
// },
// service_provider_amount + matched_amount,
// ))),
Some(MobileReward::PromotionReward(promotion)) => Ok(Some((
RewardKey {
key: promotion.entity,
reward_type: RewardType::MobilePromotion,
},
promotion.service_provider_amount + promotion.matched_amount,
))),
_ => bail!("got an invalid reward share"),
}
}
Expand Down

0 comments on commit 6d953c1

Please sign in to comment.