diff --git a/backend/src/api/mining/mining.ts b/backend/src/api/mining/mining.ts index 1283a1846..e190492b8 100644 --- a/backend/src/api/mining/mining.ts +++ b/backend/src/api/mining/mining.ts @@ -106,6 +106,7 @@ class Mining { emptyBlocks: emptyBlocksCount.length > 0 ? emptyBlocksCount[0]['count'] : 0, slug: poolInfo.slug, avgMatchRate: poolInfo.avgMatchRate !== null ? Math.round(100 * poolInfo.avgMatchRate) / 100 : null, + avgFeeDelta: poolInfo.avgFeeDelta, }; poolsStats.push(poolStat); }); diff --git a/backend/src/mempool.interfaces.ts b/backend/src/mempool.interfaces.ts index 3edd84cde..13c74160a 100644 --- a/backend/src/mempool.interfaces.ts +++ b/backend/src/mempool.interfaces.ts @@ -19,6 +19,7 @@ export interface PoolInfo { blockCount: number; slug: string; avgMatchRate: number | null; + avgFeeDelta: number | null; } export interface PoolStats extends PoolInfo { diff --git a/backend/src/repositories/PoolsRepository.ts b/backend/src/repositories/PoolsRepository.ts index 293fd5e39..899712266 100644 --- a/backend/src/repositories/PoolsRepository.ts +++ b/backend/src/repositories/PoolsRepository.ts @@ -39,7 +39,8 @@ class PoolsRepository { pools.name AS name, pools.link AS link, slug, - AVG(blocks_audits.match_rate) AS avgMatchRate + AVG(blocks_audits.match_rate) AS avgMatchRate, + AVG((CAST(blocks.fees as SIGNED) - CAST(blocks_audits.expected_fees as SIGNED)) / NULLIF(CAST(blocks_audits.expected_fees as SIGNED), 0)) AS avgFeeDelta FROM blocks JOIN pools on pools.id = pool_id LEFT JOIN blocks_audits ON blocks_audits.height = blocks.height diff --git a/frontend/src/app/components/pool-ranking/pool-ranking.component.html b/frontend/src/app/components/pool-ranking/pool-ranking.component.html index 7b7fbfae0..6ffcbf485 100644 --- a/frontend/src/app/components/pool-ranking/pool-ranking.component.html +++ b/frontend/src/app/components/pool-ranking/pool-ranking.component.html @@ -94,7 +94,8 @@ Blocks Avg Health - Empty blocks + Avg Block Fees + Empty blocks @@ -121,7 +122,15 @@ Unknown - {{ pool.emptyBlocks }} ({{ pool.emptyBlockRatio }}%) + + + {{ pool.avgFeeDelta > 0 ? '+' : '' }}{{ (pool.avgFeeDelta * 100) | amountShortener: 2 }}% + + + - + + + {{ pool.emptyBlocks }} ({{ pool.emptyBlockRatio }}%) diff --git a/frontend/src/app/components/pool-ranking/pool-ranking.component.scss b/frontend/src/app/components/pool-ranking/pool-ranking.component.scss index fc58909f8..b82264503 100644 --- a/frontend/src/app/components/pool-ranking/pool-ranking.component.scss +++ b/frontend/src/app/components/pool-ranking/pool-ranking.component.scss @@ -110,4 +110,15 @@ .disabled { pointer-events: none; opacity: 0.5; -} \ No newline at end of file +} + +td { + .difference { + &.positive { + color: rgb(66, 183, 71); + } + &.negative { + color: rgb(183, 66, 66); + } + } +} diff --git a/frontend/src/app/interfaces/node-api.interface.ts b/frontend/src/app/interfaces/node-api.interface.ts index 648eb38ea..68c45b3b2 100644 --- a/frontend/src/app/interfaces/node-api.interface.ts +++ b/frontend/src/app/interfaces/node-api.interface.ts @@ -91,6 +91,7 @@ export interface SinglePoolStats { logo: string; slug: string; avgMatchRate: number; + avgFeeDelta: number; } export interface PoolsStats { blockCount: number;