Compare commits

...

3 Commits

Author SHA1 Message Date
durch 3f9bfb4bb4 Put circulating supply back as Option 2022-06-15 00:03:13 +02:00
Mark Sinclair e6a00ad8d4 Merge pull request #1363 from nymtech/feature/reorder-delegation-table-columns
reorder delegation table columns
2022-06-14 18:40:14 +01:00
fmtabbara f6f0e68fac reorder delegation table columns 2022-06-14 16:52:45 +01:00
4 changed files with 28 additions and 19 deletions
@@ -105,8 +105,8 @@ pub struct EpochRewardParams {
epoch_reward_pool: Uint128,
rewarded_set_size: Uint128,
active_set_size: Uint128,
#[serde(alias = "circulating_supply")]
staking_supply: Uint128,
circulating_supply: Option<Uint128>,
staking_supply: Option<Uint128>,
sybil_resistance_percent: u8,
active_set_work_factor: u8,
}
@@ -124,7 +124,8 @@ impl EpochRewardParams {
epoch_reward_pool: Uint128::new(epoch_reward_pool),
rewarded_set_size: Uint128::new(rewarded_set_size),
active_set_size: Uint128::new(active_set_size),
staking_supply: Uint128::new(staking_supply),
circulating_supply: None,
staking_supply: Some(Uint128::new(staking_supply)),
sybil_resistance_percent,
active_set_work_factor,
}
@@ -137,7 +138,8 @@ impl EpochRewardParams {
pub fn new_empty() -> Self {
EpochRewardParams {
epoch_reward_pool: Uint128::new(0),
staking_supply: Uint128::new(0),
staking_supply: Some(Uint128::new(0)),
circulating_supply: None,
sybil_resistance_percent: 0,
rewarded_set_size: Uint128::new(0),
active_set_size: Uint128::new(0),
@@ -154,7 +156,13 @@ impl EpochRewardParams {
}
pub fn staking_supply(&self) -> u128 {
self.staking_supply.u128()
if let Some(s) = self.staking_supply {
s.u128()
} else if let Some(c) = self.circulating_supply {
c.u128()
} else {
0
}
}
pub fn epoch_reward_pool(&self) -> u128 {
@@ -254,7 +262,7 @@ impl RewardParams {
}
pub fn staking_supply(&self) -> u128 {
self.epoch.staking_supply.u128()
self.epoch.staking_supply()
}
pub fn reward_blockstamp(&self) -> u64 {
+2 -2
View File
@@ -1,7 +1,7 @@
use crate::window_toggle;
use tauri::{
AppHandle, CustomMenuItem, Menu,
SystemTray, SystemTrayEvent, SystemTrayMenu, SystemTrayMenuItem, Wry,
AppHandle, CustomMenuItem, Menu, SystemTray, SystemTrayEvent, SystemTrayMenu,
SystemTrayMenuItem, Wry,
};
#[cfg(target_os = "macos")]
use tauri::{CustomMenuItem, MenuItem, Submenu, SystemTray, SystemTrayMenu, SystemTrayMenuItem};
+1 -1
View File
@@ -1,6 +1,6 @@
use futures::channel::mpsc;
use futures::SinkExt;
use log::info;
use futures::channel::mpsc;
use config::NymConfig;
#[cfg(not(feature = "coconut"))]
@@ -38,12 +38,12 @@ interface HeadCell {
const headCells: HeadCell[] = [
{ id: 'node_identity', label: 'Node ID', sortable: true, align: 'left' },
{ id: 'avg_uptime_percent', label: 'Uptime', sortable: true, align: 'center' },
{ id: 'profit_margin_percent', label: 'Profit margin', sortable: true, align: 'center' },
{ id: 'stake_saturation', label: 'Stake saturation', sortable: true, align: 'center' },
{ id: 'delegated_on_iso_datetime', label: 'Delegated on', sortable: true, align: 'center' },
{ id: 'amount', label: 'Delegation', sortable: true, align: 'center' },
{ id: 'accumulated_rewards', label: 'Reward', sortable: true, align: 'center' },
{ id: 'profit_margin_percent', label: 'Profit margin', sortable: true, align: 'center' },
{ id: 'stake_saturation', label: 'Stake saturation', sortable: true, align: 'center' },
{ id: 'avg_uptime_percent', label: 'Uptime', sortable: true, align: 'center' },
];
function descendingComparator<T>(a: T, b: T, orderBy: keyof T) {
@@ -154,6 +154,13 @@ export const DelegationList: React.FC<{
</Link>
</Tooltip>
</TableCell>
<TableCell align="center">{!item.avg_uptime_percent ? '-' : `${item.avg_uptime_percent}%`}</TableCell>
<TableCell align="center">
{!item.profit_margin_percent ? '-' : `${item.profit_margin_percent}%`}
</TableCell>
<TableCell align="center">
{!item.stake_saturation ? '-' : `${Math.round(item.stake_saturation * 100000) / 1000}%`}
</TableCell>
<TableCell align="center">{format(new Date(item.delegated_on_iso_datetime), 'dd/MM/yyyy')}</TableCell>
<TableCell align="center">{`${item.amount.amount} ${item.amount.denom}`}</TableCell>
<TableCell align="center">
@@ -161,13 +168,7 @@ export const DelegationList: React.FC<{
? '-'
: `${item.accumulated_rewards.amount} ${item.accumulated_rewards.denom}`}
</TableCell>
<TableCell align="center">
{!item.profit_margin_percent ? '-' : `${item.profit_margin_percent}%`}
</TableCell>
<TableCell align="center">
{!item.stake_saturation ? '-' : `${Math.round(item.stake_saturation * 100000) / 1000}%`}
</TableCell>
<TableCell align="center">{!item.avg_uptime_percent ? '-' : `${item.avg_uptime_percent}%`}</TableCell>
<TableCell align="right">
{!item.pending_events.length ? (
<DelegationsActionsMenu