Skip to content

Commit

Permalink
add subdao epoch info related msg support
Browse files Browse the repository at this point in the history
  • Loading branch information
andymck committed Dec 3, 2024
1 parent c5c67f5 commit fffce9d
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 2 deletions.
1 change: 1 addition & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const SERVICES: &[&str] = &[
"src/service/downlink.proto",
"src/service/multi_buy.proto",
"src/service/packet_verifier.proto",
"src/service/sub_dao.proto",
];

const MESSAGES: &[&str] = &[
Expand Down
6 changes: 6 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ pub mod services {
ServiceProvider, ServiceProviderPromotions,
};

pub mod sub_dao {
include!(concat!(env!("OUT_DIR"), "/helium.sub_dao.rs"));
pub use sub_dao_client::SubDaoClient;
pub use sub_dao_server::{SubDao, SubDaoServer};
}

pub mod iot_config {
include!(concat!(env!("OUT_DIR"), "/helium.iot_config.rs"));
pub use admin_client as config_admin_client;
Expand Down
4 changes: 4 additions & 0 deletions src/reward_manifest.proto
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,8 @@ message reward_manifest {
mobile_reward_data mobile_reward_data = 4;
iot_reward_data iot_reward_data = 5;
}
// the epoch of the reward share
uint64 epoch = 6;
/// Price of HNT @ 10^8 used when calculating the rewards
uint64 price = 7;
}
1 change: 0 additions & 1 deletion src/service/mobile_config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package helium.mobile_config;
import "hex_boosting.proto";
import "service_provider.proto";
import "reward_manifest.proto";

// ------------------------------------------------------------------
// Message Definitions
// ------------------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions src/service/poc_lora.proto
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ message iot_reward_share {
operational_reward operational_reward = 4;
unallocated_reward unallocated_reward = 5;
}
// the onchain epoch of the reward share
uint64 epoch = 6;
}

message lora_stream_session_offer_v1 { bytes nonce = 1; }
Expand Down
3 changes: 2 additions & 1 deletion src/service/poc_mobile.proto
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,8 @@ message gateway_reward {
uint64 dc_transfer_reward = 2;
/// count of rewardable bytes transfered
uint64 rewardable_bytes = 3;
/// Price of MOBILE @ 10^6 used when calculating rewards
/// Price of HNT @ 10^8 used when calculating rewards
// todo: deprecate this ? replaced with price in manifest
uint64 price = 4;
}

Expand Down
45 changes: 45 additions & 0 deletions src/service/sub_dao.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
syntax = "proto3";

package helium.sub_dao;

message sub_dao_epoch_reward_info {
// The epoch of the reward info
uint64 epoch = 1;
// The on-chain identity of the epoch
string epoch_address = 2;
// The on-chain identity of the subdao
string sub_dao_address = 3;
// The total HNT rewards emitted for the sub dao and epoch minus the
// delegation rewards
uint64 rewards_issued = 4;
// The total HNT delegation rewards emitted for the sub dao and epoch
uint64 delegation_rewards_issued = 5;
// timestamp in seconds when the rewards were issued
uint64 rewards_issued_at = 6;
}

message sub_dao_epoch_reward_info_req_v1 {
// The on-chain identity of the subdao to lookup
string sub_dao_address = 1;
// The epoch for the specified subdao to look up
uint64 epoch = 2;
// pubkey binary of the signing keypair
bytes signer = 3;
bytes signature = 4;
}

message sub_dao_epoch_reward_info_res_v1 {
// The reward info for the specified subdao & epoch
sub_dao_epoch_reward_info info = 1;
// unix epoch timestamp in seconds
uint64 timestamp = 2;
// pubkey binary of the signing keypair
bytes signer = 3;
bytes signature = 4;
}

service sub_dao {
// Get reward info for the specified subdao & epoch
rpc info(sub_dao_epoch_reward_info_req_v1)
returns (sub_dao_epoch_reward_info_res_v1);
}

0 comments on commit fffce9d

Please sign in to comment.