Skip to content

Commit

Permalink
Merge pull request #424 from helium/mj/sp-promotions-v2
Browse files Browse the repository at this point in the history
Update Service Provider Promotions for updated flow
  • Loading branch information
michaeldjeffrey authored Oct 29, 2024
2 parents ad18fa2 + 47d19aa commit 0452523
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 72 deletions.
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub mod services {
use crate::{
BlockchainRegionParamsV1, BlockchainTokenTypeV1, BlockchainTxn, BoostedHexInfoV1, DataRate,
Decimal, EntropyReportV1, GatewayStakingMode, MapperAttach, Region, RoutingAddress,
ServiceProvider,
ServiceProvider, ServiceProviderPromotions,
};

pub mod iot_config {
Expand Down
18 changes: 15 additions & 3 deletions src/reward_manifest.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,26 @@ import "service_provider.proto";
message mobile_reward_data {
Decimal poc_bones_per_reward_share = 1;
Decimal boosted_poc_bones_per_reward_share = 2;
// repeated service_provider_allocation sp_allocations = 3;
repeated service_provider_promotions service_provider_promotions = 3;
}

message service_provider_allocation {
message service_provider_promotions {
message promotion {
// Name of the Promotion NFT
string entity = 1;
// Unix timestamp in seconds of the start of the promotion
uint64 start_ts = 2;
// Unix timestamp in seconds of the end of the promotion
uint64 end_ts = 3;
// Shares used when distributing promotion incentive allocation
uint32 shares = 4;
}

service_provider service_provider = 1;
// The percentage of the SP rewards that are allocated to the incentive fun,
// The percentage of the SP rewards that are allocated to the incentive fund,
// in basis points
uint32 incentive_escrow_fund_bps = 2;
repeated promotion promotions = 3;
}

message iot_reward_data {
Expand Down
17 changes: 17 additions & 0 deletions src/service/mobile_config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ syntax = "proto3";
package helium.mobile_config;

import "hex_boosting.proto";
import "service_provider.proto";
import "reward_manifest.proto";

// ------------------------------------------------------------------
// Message Definitions
Expand Down Expand Up @@ -247,6 +249,19 @@ message boosted_hex_info_stream_res_v1 {
bytes signature = 4;
}

message carrier_incentive_promotion_list_req_v1 {
// unix epoch timestamp in seconds
uint64 timestamp = 1;
bytes signer = 2;
bytes signature = 3;
}

message carrier_incentive_promotion_list_res_v1 {
bytes signer = 1;
bytes signature = 2;
repeated service_provider_promotions service_provider_promotions = 3;
}

// ------------------------------------------------------------------
// Service Definitions
// ------------------------------------------------------------------
Expand All @@ -271,6 +286,8 @@ service carrier_service {
// Retrieve an entity key for the specified helium pubkey
rpc key_to_entity(carrier_key_to_entity_req_v1)
returns (carrier_key_to_entity_res_v1);
rpc list_incentive_promotions(carrier_incentive_promotion_list_req_v1)
returns (carrier_incentive_promotion_list_res_v1);
}

service authorization {
Expand Down
59 changes: 5 additions & 54 deletions src/service/poc_mobile.proto
Original file line number Diff line number Diff line change
Expand Up @@ -280,48 +280,6 @@ message verified_subscriber_location_ingest_report_v1 {
uint64 timestamp = 3;
}

message promotion_reward_req_v1 {
// Entity to be rewarded
oneof entity {
// Subscriber reward
bytes subscriber_id = 1;
// Gateway reward
bytes gateway_key = 2;
}
// Shares rewarded to the subscriber
uint64 shares = 3;
// Timestamp in seconds since the unix epoch
uint64 timestamp = 4;
// Pubkey of the carrier for which the entity is attached
bytes carrier_pub_key = 5;
// Signed payload of the request
bytes signature = 6;
}

message promotion_reward_resp_v1 { string id = 1; }

message promotion_reward_ingest_report_v1 {
// Timestamp in milliseconds since the unix epoch
uint64 received_timestamp = 1;
promotion_reward_req_v1 report = 2;
}

enum promotion_reward_status {
promotion_reward_status_valid = 0;
promotion_reward_status_invalid_subscriber_id = 1;
promotion_reward_status_invalid_gateway_key = 2;
promotion_reward_status_invalid_carrier_key = 3;
}

message verified_promotion_reward_v1 {
promotion_reward_ingest_report_v1 report = 1;
// Status of the report
promotion_reward_status status = 2;
// Timestamp at which verification was determined, in milliseconds since
// the unix epoch
uint64 timestamp = 3;
}

service poc_mobile {
rpc submit_speedtest(speedtest_req_v1) returns (speedtest_resp_v1);
rpc submit_cell_heartbeat(cell_heartbeat_req_v1)
Expand All @@ -345,8 +303,6 @@ service poc_mobile {
rpc submit_subscriber_verified_mapping_event(
subscriber_verified_mapping_event_req_v1)
returns (subscriber_verified_mapping_event_res_v1);
rpc submit_promotion_reward(promotion_reward_req_v1)
returns (promotion_reward_resp_v1);
}

message file_info {
Expand Down Expand Up @@ -615,17 +571,12 @@ message subscriber_reward {
}

message promotion_reward {
// Entity given the reward
oneof entity {
// Subscriber reward
bytes subscriber_id = 1;
// Gateway reward
bytes gateway_key = 2;
}
// Name of the promotion NFT
string entity = 1;
// Amount in bones given by the service provider
uint64 service_provider_amount = 3;
uint64 service_provider_amount = 2;
// Amount in bones matched by the network
uint64 matched_amount = 4;
uint64 matched_amount = 3;
}

message service_provider_reward {
Expand Down Expand Up @@ -666,7 +617,7 @@ message mobile_reward_share {
service_provider_reward service_provider_reward = 6;
unallocated_reward unallocated_reward = 7;
radio_reward_v2 radio_reward_v2 = 8;
// promotion_reward promotion_reward = 9;
promotion_reward promotion_reward = 9;
}
}

Expand Down
14 changes: 0 additions & 14 deletions src/service_provider.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,3 @@ 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 0452523

Please sign in to comment.