Skip to content

Commit 1af76ea

Browse files
authored
Merge pull request #431 from helium/andymck/sub-dao-epoch-support
add subdao epoch info related msg support and hip138 requirements
2 parents f79c34f + e486a24 commit 1af76ea

File tree

6 files changed

+74
-2
lines changed

6 files changed

+74
-2
lines changed

build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const SERVICES: &[&str] = &[
1616
"src/service/downlink.proto",
1717
"src/service/multi_buy.proto",
1818
"src/service/packet_verifier.proto",
19+
"src/service/sub_dao.proto",
1920
];
2021

2122
const MESSAGES: &[&str] = &[

src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ pub mod services {
1515
ServiceProvider, ServiceProviderPromotions,
1616
};
1717

18+
pub mod sub_dao {
19+
include!(concat!(env!("OUT_DIR"), "/helium.sub_dao.rs"));
20+
pub use sub_dao_client::SubDaoClient;
21+
pub use sub_dao_server::{SubDao, SubDaoServer};
22+
}
23+
1824
pub mod iot_config {
1925
include!(concat!(env!("OUT_DIR"), "/helium.iot_config.rs"));
2026
pub use admin_client as config_admin_client;

src/reward_manifest.proto

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,17 @@ package helium;
55
import "decimal.proto";
66
import "service_provider.proto";
77

8+
enum mobile_reward_token {
9+
mobile_reward_token_mobile = 0;
10+
mobile_reward_token_hnt = 1;
11+
}
12+
813
message mobile_reward_data {
914
Decimal poc_bones_per_reward_share = 1;
1015
Decimal boosted_poc_bones_per_reward_share = 2;
1116
repeated service_provider_promotions service_provider_promotions = 3;
17+
// HIP-138: Reward output was changed from Subdao Tokens to HNT
18+
mobile_reward_token token = 4;
1219
}
1320

1421
message service_provider_promotions {
@@ -30,10 +37,17 @@ message service_provider_promotions {
3037
repeated promotion promotions = 3;
3138
}
3239

40+
enum iot_reward_token {
41+
iot_reward_token_iot = 0;
42+
iot_reward_token_hnt = 1;
43+
}
44+
3345
message iot_reward_data {
3446
Decimal poc_bones_per_beacon_reward_share = 1;
3547
Decimal poc_bones_per_witness_reward_share = 2;
3648
Decimal dc_bones_per_share = 3;
49+
// HIP-138: Reward output was changed from Subdao Tokens to HNT
50+
iot_reward_token token = 4;
3751
}
3852

3953
message reward_manifest {
@@ -46,4 +60,11 @@ message reward_manifest {
4660
mobile_reward_data mobile_reward_data = 4;
4761
iot_reward_data iot_reward_data = 5;
4862
}
63+
// the epoch of the reward share
64+
uint64 epoch = 6;
65+
// Price of the token at time rewards were calculated
66+
// MOBILE is @ 10^6
67+
// IOT is @ 10^6
68+
// HNT is @ 10^8
69+
uint64 price = 7;
4970
}

src/service/mobile_config.proto

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package helium.mobile_config;
55
import "hex_boosting.proto";
66
import "service_provider.proto";
77
import "reward_manifest.proto";
8-
98
// ------------------------------------------------------------------
109
// Message Definitions
1110
// ------------------------------------------------------------------

src/service/poc_mobile.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ message gateway_reward {
698698
uint64 dc_transfer_reward = 2;
699699
/// count of rewardable bytes transfered
700700
uint64 rewardable_bytes = 3;
701-
/// Price of MOBILE @ 10^6 used when calculating rewards
701+
/// Price of HNT @ 10^8 used when calculating rewards
702702
uint64 price = 4;
703703
}
704704

src/service/sub_dao.proto

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
syntax = "proto3";
2+
3+
package helium.sub_dao;
4+
5+
message sub_dao_epoch_reward_info {
6+
// The epoch of the reward info
7+
uint64 epoch = 1;
8+
// The on-chain identity of the epoch
9+
string epoch_address = 2;
10+
// The on-chain identity of the subdao
11+
string sub_dao_address = 3;
12+
// The total HNT rewards emitted for the sub dao and epoch minus the
13+
// delegation rewards
14+
uint64 hnt_rewards_issued = 4;
15+
// The total HNT delegation rewards emitted for the sub dao and epoch
16+
uint64 delegation_rewards_issued = 5;
17+
// timestamp in seconds when the rewards were issued
18+
uint64 rewards_issued_at = 6;
19+
}
20+
21+
message sub_dao_epoch_reward_info_req_v1 {
22+
// The on-chain identity of the subdao to lookup
23+
string sub_dao_address = 1;
24+
// The epoch for the specified subdao to look up
25+
uint64 epoch = 2;
26+
// pubkey binary of the signing keypair
27+
bytes signer = 3;
28+
bytes signature = 4;
29+
}
30+
31+
message sub_dao_epoch_reward_info_res_v1 {
32+
// The reward info for the specified subdao & epoch
33+
sub_dao_epoch_reward_info info = 1;
34+
// unix epoch timestamp in seconds
35+
uint64 timestamp = 2;
36+
// pubkey binary of the signing keypair
37+
bytes signer = 3;
38+
bytes signature = 4;
39+
}
40+
41+
service sub_dao {
42+
// Get reward info for the specified subdao & epoch
43+
rpc info(sub_dao_epoch_reward_info_req_v1)
44+
returns (sub_dao_epoch_reward_info_res_v1);
45+
}

0 commit comments

Comments
 (0)