Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add subdao epoch info related msg support #431

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
18 changes: 18 additions & 0 deletions src/reward_manifest.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,17 @@ package helium;
import "decimal.proto";
import "service_provider.proto";

enum mobile_reward_token {
mobile_reward_token_mobile = 0;
mobile_reward_token_hnt = 1;
}

message mobile_reward_data {
Decimal poc_bones_per_reward_share = 1;
Decimal boosted_poc_bones_per_reward_share = 2;
repeated service_provider_promotions service_provider_promotions = 3;
// HIP-138: Reward output was changed from Subdao Tokens to HNT
mobile_reward_token token = 4;
}

message service_provider_promotions {
Expand All @@ -30,10 +37,17 @@ message service_provider_promotions {
repeated promotion promotions = 3;
}

enum iot_reward_token {
iot_reward_token_iot = 0;
iot_reward_token_hnt = 1;
}

message iot_reward_data {
Decimal poc_bones_per_beacon_reward_share = 1;
Decimal poc_bones_per_witness_reward_share = 2;
Decimal dc_bones_per_share = 3;
// HIP-138: Reward output was changed from Subdao Tokens to HNT
iot_reward_token token = 4;
}

message reward_manifest {
Expand All @@ -46,4 +60,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
3 changes: 2 additions & 1 deletion src/service/poc_mobile.proto
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,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 hnt_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);
}
Loading