Skip to content
Merged
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
3 changes: 2 additions & 1 deletion packages/rs-dpp/src/block/finalized_epoch_info/getters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use crate::block::finalized_epoch_info::FinalizedEpochInfo;
use crate::fee::Credits;
use crate::prelude::{BlockHeight, BlockHeightInterval, CoreBlockHeight, TimestampMillis};
use platform_value::Identifier;
use std::collections::BTreeMap;

impl FinalizedEpochInfoGettersV0 for FinalizedEpochInfo {
fn first_block_time(&self) -> TimestampMillis {
Expand Down Expand Up @@ -59,7 +60,7 @@ impl FinalizedEpochInfoGettersV0 for FinalizedEpochInfo {
}
}

fn block_proposers(&self) -> &Vec<(Identifier, u64)> {
fn block_proposers(&self) -> &BTreeMap<Identifier, u64> {
match self {
FinalizedEpochInfo::V0(v0) => v0.block_proposers(),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::block::finalized_epoch_info::v0::FinalizedEpochInfoV0;
use crate::fee::Credits;
use crate::prelude::{BlockHeight, BlockHeightInterval, CoreBlockHeight, TimestampMillis};
use platform_value::Identifier;
use std::collections::BTreeMap;

/// Trait for accessing fields of `FinalizedEpochInfoV0`.
pub trait FinalizedEpochInfoGettersV0 {
Expand Down Expand Up @@ -33,7 +34,7 @@ pub trait FinalizedEpochInfoGettersV0 {
fn core_block_rewards(&self) -> Credits;

/// Returns a reference to the block proposers map.
fn block_proposers(&self) -> &Vec<(Identifier, u64)>;
fn block_proposers(&self) -> &BTreeMap<Identifier, u64>;

/// Returns the fee multiplier (permille).
fn fee_multiplier_permille(&self) -> u64;
Expand Down Expand Up @@ -79,7 +80,7 @@ impl FinalizedEpochInfoGettersV0 for FinalizedEpochInfoV0 {
self.core_block_rewards
}

fn block_proposers(&self) -> &Vec<(Identifier, u64)> {
fn block_proposers(&self) -> &BTreeMap<Identifier, u64> {
&self.block_proposers
}

Expand Down
3 changes: 2 additions & 1 deletion packages/rs-dpp/src/block/finalized_epoch_info/v0/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use crate::prelude::{BlockHeight, BlockHeightInterval, CoreBlockHeight, Timestam
use bincode::{Decode, Encode};
use platform_value::Identifier;
use serde::{Deserialize, Serialize};
use std::collections::BTreeMap;

/// Finalized Epoch information
#[derive(Clone, Debug, PartialEq, Encode, Decode, Serialize, Deserialize)]
Expand All @@ -28,7 +29,7 @@ pub struct FinalizedEpochInfoV0 {
/// Total rewards given from core subsidy
pub core_block_rewards: Credits,
/// Block proposers
pub block_proposers: Vec<(Identifier, u64)>,
pub block_proposers: BTreeMap<Identifier, u64>,
/// Fee multiplier that you would divide by 1000 to get float value
pub fee_multiplier_permille: u64,
/// Protocol version
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
pub mod v0;

use crate::data_contract::associated_token::token_configuration::accessors::v0::{
TokenConfigurationV0Getters, TokenConfigurationV0Setters,
};
use crate::data_contract::associated_token::token_configuration_convention::accessors::v0::TokenConfigurationConventionV0Getters;
use crate::data_contract::associated_token::token_configuration_convention::TokenConfigurationConvention;
use crate::data_contract::associated_token::token_configuration_localization::TokenConfigurationLocalization;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use crate::data_contract::associated_token::token_configuration_localization::accessors::v0::TokenConfigurationLocalizationV0Getters;
use crate::data_contract::associated_token::token_configuration_localization::v0::TokenConfigurationLocalizationV0;
use bincode::Encode;
use derive_more::From;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,10 @@ pub enum TokenDistributionInfo {
/// Contains the scheduled timestamp and the recipient’s identifier.
PreProgrammed(TimestampMillis, Identifier),

/// A perpetual token distribution with previous and next moments.
/// A perpetual token distribution with moment for distribution.
/// The moment is the beginning of the perpetual distribution cycle
/// Includes the last and next distribution times and the resolved recipient.
Perpetual(
RewardDistributionMoment,
RewardDistributionMoment,
TokenDistributionResolvedRecipient,
),
Perpetual(RewardDistributionMoment, TokenDistributionResolvedRecipient),
}

impl From<TokenDistributionInfo> for TokenDistributionTypeWithResolvedRecipient {
Expand All @@ -63,7 +60,7 @@ impl From<TokenDistributionInfo> for TokenDistributionTypeWithResolvedRecipient
TokenDistributionInfo::PreProgrammed(_, recipient) => {
TokenDistributionTypeWithResolvedRecipient::PreProgrammed(recipient)
}
TokenDistributionInfo::Perpetual(_, _, recipient) => {
TokenDistributionInfo::Perpetual(_, recipient) => {
TokenDistributionTypeWithResolvedRecipient::Perpetual(recipient)
}
}
Expand All @@ -76,7 +73,7 @@ impl From<&TokenDistributionInfo> for TokenDistributionTypeWithResolvedRecipient
TokenDistributionInfo::PreProgrammed(_, recipient) => {
TokenDistributionTypeWithResolvedRecipient::PreProgrammed(*recipient)
}
TokenDistributionInfo::Perpetual(_, _, recipient) => {
TokenDistributionInfo::Perpetual(_, recipient) => {
TokenDistributionTypeWithResolvedRecipient::Perpetual(recipient.clone())
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ impl Encode for DistributionFunction {
DistributionFunction::Linear {
a,
d,
s,
b,
start_step: s,
starting_amount: b,
min_value,
max_value,
} => {
Expand All @@ -60,7 +60,7 @@ impl Encode for DistributionFunction {
m,
n,
o,
s,
start_moment: s,
b,
min_value,
max_value,
Expand All @@ -82,7 +82,7 @@ impl Encode for DistributionFunction {
m,
n,
o,
s,
start_moment: s,
c,
min_value,
max_value,
Expand All @@ -104,7 +104,7 @@ impl Encode for DistributionFunction {
m,
n,
o,
s,
start_moment: s,
b,
min_value,
max_value,
Expand All @@ -126,7 +126,7 @@ impl Encode for DistributionFunction {
m,
n,
o,
s,
start_moment: s,
b,
min_value,
max_value,
Expand Down Expand Up @@ -192,8 +192,8 @@ impl Decode for DistributionFunction {
Ok(Self::Linear {
a,
d,
s,
b,
start_step: s,
starting_amount: b,
min_value,
max_value,
})
Expand All @@ -214,7 +214,7 @@ impl Decode for DistributionFunction {
m,
n,
o,
s,
start_moment: s,
b,
min_value,
max_value,
Expand All @@ -236,7 +236,7 @@ impl Decode for DistributionFunction {
m,
n,
o,
s,
start_moment: s,
c,
min_value,
max_value,
Expand All @@ -258,7 +258,7 @@ impl Decode for DistributionFunction {
m,
n,
o,
s,
start_moment: s,
b,
min_value,
max_value,
Expand All @@ -280,7 +280,7 @@ impl Decode for DistributionFunction {
m,
n,
o,
s,
start_moment: s,
b,
min_value,
max_value,
Expand Down Expand Up @@ -338,8 +338,8 @@ impl<'de> BorrowDecode<'de> for DistributionFunction {
Ok(Self::Linear {
a,
d,
s,
b,
start_step: s,
starting_amount: b,
min_value,
max_value,
})
Expand All @@ -360,7 +360,7 @@ impl<'de> BorrowDecode<'de> for DistributionFunction {
m,
n,
o,
s,
start_moment: s,
b,
min_value,
max_value,
Expand All @@ -382,7 +382,7 @@ impl<'de> BorrowDecode<'de> for DistributionFunction {
m,
n,
o,
s,
start_moment: s,
c,
min_value,
max_value,
Expand All @@ -404,7 +404,7 @@ impl<'de> BorrowDecode<'de> for DistributionFunction {
m,
n,
o,
s,
start_moment: s,
b,
min_value,
max_value,
Expand All @@ -426,7 +426,7 @@ impl<'de> BorrowDecode<'de> for DistributionFunction {
m,
n,
o,
s,
start_moment: s,
b,
min_value,
max_value,
Expand Down
Loading
Loading