diff --git a/build.rs b/build.rs index b5c2cda4..c55f956b 100644 --- a/build.rs +++ b/build.rs @@ -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] = &[ diff --git a/src/lib.rs b/src/lib.rs index 0984b9e7..6c512944 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -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; diff --git a/src/reward_manifest.proto b/src/reward_manifest.proto index de04b002..c093496b 100644 --- a/src/reward_manifest.proto +++ b/src/reward_manifest.proto @@ -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 { @@ -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 { @@ -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; } diff --git a/src/service/mobile_config.proto b/src/service/mobile_config.proto index 865c2376..d6821e11 100644 --- a/src/service/mobile_config.proto +++ b/src/service/mobile_config.proto @@ -5,7 +5,6 @@ package helium.mobile_config; import "hex_boosting.proto"; import "service_provider.proto"; import "reward_manifest.proto"; - // ------------------------------------------------------------------ // Message Definitions // ------------------------------------------------------------------ diff --git a/src/service/poc_mobile.proto b/src/service/poc_mobile.proto index 7fc27a85..6b1d29aa 100644 --- a/src/service/poc_mobile.proto +++ b/src/service/poc_mobile.proto @@ -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; } diff --git a/src/service/sub_dao.proto b/src/service/sub_dao.proto new file mode 100644 index 00000000..63beadb3 --- /dev/null +++ b/src/service/sub_dao.proto @@ -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); +}