Skip to content

Commit

Permalink
Add service provider promotion fund
Browse files Browse the repository at this point in the history
Also adds strum so we can target enums who's variants we want to iterate
over.
This way, we don't have to hardcode a vec of service providers whenever
one is added to proto.
  • Loading branch information
michaeldjeffrey committed Sep 13, 2024
1 parent 72905c9 commit 734bd1e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ bytes = { workspace = true }
prost = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
strum = { version = "0.26.3", features = ["derive"] }
strum_macros = "0.26.4"

[build-dependencies]
tonic-build = { workspace = true, optional = true }
Expand Down
4 changes: 4 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ macro_rules! config {
($config:expr) => {
$config
.type_attribute(".", "#[derive(serde::Serialize, serde::Deserialize)]")
.enum_attribute(
".helium.service_provider",
"#[derive(strum_macros::EnumIter)]",
)
.field_attribute(
".helium.tagged_spreading.region_spreading",
"#[serde(with = \"serde_region_spreading\" )]",
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ include!(concat!(env!("OUT_DIR"), "/helium.rs"));

pub use blockchain_txn::Txn;
pub use prost::{DecodeError, EncodeError, Message};
pub use strum::IntoEnumIterator;

#[cfg(feature = "services")]
pub mod services {
Expand Down
14 changes: 14 additions & 0 deletions src/service_provider.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,17 @@ package helium;
enum service_provider {
helium_mobile = 0;
}

message service_provider_promotion_fund_v1 {
/// The timestamp for this report in milliseconds since unix epoch
uint64 timestamp = 1;

/// Service Provider that is allocating funds for promotions
service_provider service_provider = 2;

/// Percentage of Rewards allocated for promotions
/// stored in Basis Points
///
/// https://www.investopedia.com/terms/b/basispoint.asp
uint32 bps = 3;
}

0 comments on commit 734bd1e

Please sign in to comment.