From 31c41b267303aa287170e7abb2a45414287097ab Mon Sep 17 00:00:00 2001 From: Marco van Dijk Date: Thu, 21 Apr 2022 19:27:03 +0200 Subject: [PATCH] fixes --- backend/src/routes/livepeer.js | 66 ++++---- src/actions/livepeer.js | 10 +- src/components/WinnerMonth.js | 271 ++++++++++++++++++--------------- src/components/WinnerStat.js | 108 +++++++++---- src/components/eventButton.js | 35 +++-- src/components/eventViewer.js | 11 +- src/pages/loadingScreen.js | 7 +- src/pages/stats.js | 5 +- src/style.css | 9 ++ 9 files changed, 311 insertions(+), 211 deletions(-) diff --git a/backend/src/routes/livepeer.js b/backend/src/routes/livepeer.js index 7a3ca69..f88364e 100644 --- a/backend/src/routes/livepeer.js +++ b/backend/src/routes/livepeer.js @@ -39,6 +39,8 @@ const fs = require('fs'); // Used for the livepeer thegraph API import { request, gql } from 'graphql-request'; import MonthlyStat from "../models/monthlyStat"; +import CommissionDataPoint from "../models/CommissionDataPoint"; +import TotalStakeDataPoint from "../models/TotalStakeDataPoint"; // Gets ETH, LPT and other coin info let CoinMarketCap = require('coinmarketcap-api'); @@ -270,7 +272,7 @@ const updateMonthlyReward = async function (blockTime, amount) { var dateObj = new Date(0); dateObj.setUTCSeconds(blockTime); // Determine year, month and name - const thisMonth = dateObj.getMonth() ; + const thisMonth = dateObj.getMonth(); const thisYear = dateObj.getFullYear(); console.log("Updating monthly Reward stats for " + thisYear + "-" + thisMonth); if (!CONF_DISABLE_DB) { @@ -303,7 +305,7 @@ const updateMonthlyClaim = async function (blockTime, fees, rewards) { var dateObj = new Date(0); dateObj.setUTCSeconds(blockTime); // Determine year, month and name - const thisMonth = dateObj.getMonth() ; + const thisMonth = dateObj.getMonth(); const thisYear = dateObj.getFullYear(); console.log("Updating monthly Claim stats for " + thisYear + "-" + thisMonth); if (!CONF_DISABLE_DB) { @@ -338,7 +340,7 @@ const updateMonthlyWithdrawStake = async function (blockTime, amount) { var dateObj = new Date(0); dateObj.setUTCSeconds(blockTime); // Determine year, month and name - const thisMonth = dateObj.getMonth() ; + const thisMonth = dateObj.getMonth(); const thisYear = dateObj.getFullYear(); console.log("Updating monthly WithdrawStake stats for " + thisYear + "-" + thisMonth); if (!CONF_DISABLE_DB) { @@ -371,7 +373,7 @@ const updateMonthlyWithdrawFees = async function (blockTime, amount) { var dateObj = new Date(0); dateObj.setUTCSeconds(blockTime); // Determine year, month and name - const thisMonth = dateObj.getMonth() ; + const thisMonth = dateObj.getMonth(); const thisYear = dateObj.getFullYear(); console.log("Updating monthly WithdrawFees stats for " + thisYear + "-" + thisMonth); if (!CONF_DISABLE_DB) { @@ -404,7 +406,7 @@ const updateMonthlyNewDelegator = async function (blockTime, amount) { var dateObj = new Date(0); dateObj.setUTCSeconds(blockTime); // Determine year, month and name - const thisMonth = dateObj.getMonth() ; + const thisMonth = dateObj.getMonth(); const thisYear = dateObj.getFullYear(); console.log("Updating monthly new Delegator stats for " + thisYear + "-" + thisMonth); if (!CONF_DISABLE_DB) { @@ -437,7 +439,7 @@ const updateMonthlyUnbond = async function (blockTime, amount) { var dateObj = new Date(0); dateObj.setUTCSeconds(blockTime); // Determine year, month and name - const thisMonth = dateObj.getMonth() ; + const thisMonth = dateObj.getMonth(); const thisYear = dateObj.getFullYear(); console.log("Updating monthly new Unbond stats for " + thisYear + "-" + thisMonth); if (!CONF_DISABLE_DB) { @@ -501,7 +503,7 @@ const updateMonthlyActivation = async function (blockTime, amount) { var dateObj = new Date(0); dateObj.setUTCSeconds(blockTime); // Determine year, month and name - const thisMonth = dateObj.getMonth() ; + const thisMonth = dateObj.getMonth(); const thisYear = dateObj.getFullYear(); console.log("Updating monthly new activation stats for " + thisYear + "-" + thisMonth); if (!CONF_DISABLE_DB) { @@ -534,7 +536,7 @@ const updateMonthlyMoveStake = async function (blockTime, amount) { var dateObj = new Date(0); dateObj.setUTCSeconds(blockTime); // Determine year, month and name - const thisMonth = dateObj.getMonth() ; + const thisMonth = dateObj.getMonth(); const thisYear = dateObj.getFullYear(); console.log("Updating monthly stake movement stats for " + thisYear + "-" + thisMonth); if (!CONF_DISABLE_DB) { @@ -567,7 +569,7 @@ const updateMonthlyTicketReceived = async function (blockTime, amount, from, to) var dateObj = new Date(0); dateObj.setUTCSeconds(blockTime); // Determine year, month and name - const thisMonth = dateObj.getMonth() ; + const thisMonth = dateObj.getMonth(); const thisYear = dateObj.getFullYear(); console.log("Updating monthly ticket received stats for " + thisYear + "-" + thisMonth); if (!CONF_DISABLE_DB) { @@ -685,7 +687,7 @@ const updateMonthlyTicketRedeemed = async function (blockTime, amount, address) var dateObj = new Date(0); dateObj.setUTCSeconds(blockTime); // Determine year, month and name - const thisMonth = dateObj.getMonth() ; + const thisMonth = dateObj.getMonth(); const thisYear = dateObj.getFullYear(); console.log("Updating monthly ticket redeemed stats for " + thisYear + "-" + thisMonth); if (!CONF_DISABLE_DB) { @@ -1087,7 +1089,11 @@ const syncEvents = function (toBlock) { let size = events.length; console.log("Parsing " + size + " events"); if (!size) { - lastBlockEvents = toBlock; + if (toBlock == 'latest') { + lastBlockEvents = latestBlockInChain; + } else { + lastBlockEvents = toBlock; + } } for (const event of events) { if (event.blockNumber > lastBlockEvents) { @@ -1141,7 +1147,11 @@ const syncTickets = function (toBlock) { let size = events.length; console.log("Parsing " + size + " tickets"); if (!size) { - lastBlockTickets = toBlock; + if (toBlock == 'latest') { + lastBlockTickets = latestBlockInChain; + } else { + lastBlockTickets = toBlock; + } } for (const event of events) { if (event.blockNumber > lastBlockTickets) { @@ -1247,6 +1257,8 @@ const initSync = async function () { address: 1, fees: 1, rewards: 1, + startRound: 1, + endRound: 1, transactionHash: 1, blockNumber: 1, blockTime: 1, @@ -1373,6 +1385,7 @@ const handleSync = async function () { console.log("Latest L2 Eth block changed to " + latestBlockInChain); } else { // If there are no new blocks, wait for 10 seconds before retrying + console.log("No new blocks. Sleeping for 10 seconds..."); await sleep(10000); continue; } @@ -1381,15 +1394,15 @@ const handleSync = async function () { // Batch requests when sync is large, mark if we are going to reach latestBlockInChain in this round let getFinalTickets = false; let toTickets = 'latest'; - if (latestBlock - lastBlockTickets > 100000) { - toTickets = lastBlockTickets + 100000; + if (latestBlock - lastBlockTickets > 1000000) { + toTickets = lastBlockTickets + 1000000; } else { getFinalTickets = true; } let getFinalEvents = false; let toEvents = 'latest'; - if (latestBlock - lastBlockEvents > 100000) { - toEvents = lastBlockEvents + 100000; + if (latestBlock - lastBlockEvents > 1000000) { + toEvents = lastBlockEvents + 1000000; } else { getFinalEvents = true; } @@ -1404,8 +1417,8 @@ const handleSync = async function () { } else if (!getFinalEvents) { // Start next batch for events toEvents = 'latest'; - if (latestBlock - lastBlockEvents > 100000) { - toEvents = lastBlockEvents + 100000; + if (latestBlock - lastBlockEvents > 1000000) { + toEvents = lastBlockEvents + 1000000; } else { getFinalEvents = true; } @@ -1416,8 +1429,8 @@ const handleSync = async function () { } else if (!getFinalTickets) { // Start next batch for tickets toTickets = 'latest'; - if (latestBlock - lastBlockTickets > 100000) { - toTickets = lastBlockTickets + 100000; + if (latestBlock - lastBlockTickets > 1000000) { + toTickets = lastBlockTickets + 1000000; } else { getFinalTickets = true; } @@ -1635,7 +1648,7 @@ const mutateNewCommissionRates = async function (address, feeCommission, rewardC feeCommission = (100 - (feeCommission / 10000)).toFixed(2); // Create new data point if (!CONF_DISABLE_DB) { - const dbObj = new Event({ + const dbObj = new CommissionDataPoint({ address: address, feeCommission: feeCommission, rewardCommission: rewardCommission, @@ -1698,7 +1711,7 @@ const mutateNewGlobalStake = async function (address, globalStake) { const thisYear = dateObj.getFullYear(); // Create new data point if (!CONF_DISABLE_DB) { - const dbObj = new Event({ + const dbObj = new TotalStakeDataPoint({ address: address, totalStake: globalStake, timestamp: now @@ -2486,12 +2499,10 @@ const mutateTestScoresToDB = async function (scoreObj, month, year) { } // Immediately mutate Monthly statistics object const doc = await MonthlyStat.findOneAndUpdate({ - year: thisYear, - month: thisMonth + year: year, + month: month }, { - $set: { - testScores: scoreObj - } + testScores: scoreObj }, { upsert: true, new: true, @@ -2525,6 +2536,7 @@ const getScoreAtMonthYear = async function (month, year) { const endTime = parseInt(Date.parse(endString) / 1000) // Else get it and cache it const url = "https://leaderboard-serverless.vercel.app/api/aggregated_stats?since=" + startTime + "&until=" + endTime; + console.log("Getting new Orchestrator scores for " + year + "-" + month + " @ " + url); await https.get(url, (res) => { let body = ""; res.on("data", (chunk) => { diff --git a/src/actions/livepeer.js b/src/actions/livepeer.js index c39cb13..964939a 100644 --- a/src/actions/livepeer.js +++ b/src/actions/livepeer.js @@ -176,7 +176,7 @@ export const getOrchestratorInfo = (orchAddr) => async dispatch => { }; export const setCachedOrch = (orchObj) => async dispatch => { - return dispatch(setOrchestratorInfo(orchObj)); + return dispatch(setOrchestratorInfo(orchObj)); }; export const clearOrchestrator = () => async dispatch => { @@ -219,8 +219,12 @@ export const getThreeBoxInfo = async (addr) => { const response = apiUtil.getThreeBox(addr); }; -export const getOrchestratorScores = (year, month) => async dispatch => { - const response = apiUtil.getOrchestratorScores(year, month); +export const getOrchestratorScores = async (year, month) => { + const response = await apiUtil.getOrchestratorScores(year, month); + const data = await response.json(); + if (response.ok) { + return data; + } }; export const getAllOrchScores = () => async dispatch => { diff --git a/src/components/WinnerMonth.js b/src/components/WinnerMonth.js index d0ebc05..4105c38 100644 --- a/src/components/WinnerMonth.js +++ b/src/components/WinnerMonth.js @@ -1,5 +1,5 @@ import React, { useState, useEffect } from 'react' -import { useSelector, useDispatch } from 'react-redux'; +import { useSelector } from 'react-redux'; import { VictoryPie } from 'victory'; import Winner from '../components/WinnerStat'; import { @@ -8,29 +8,18 @@ import { const WinnerMonth = (obj) => { const livepeer = useSelector((state) => state.livepeerstate); - const dispatch = useDispatch(); const [thisScores, setThisScores] = useState(null); - useEffect(() => { - const now = new Date().getTime(); - let wasInCache = false; - // See if it is cached - for (const thisScore of obj.data.testScores) { - if (thisScore.year === obj.data.year && thisScore.month === obj.data.month) { - // Check timeout - if (now - thisScore.timestamp < 360000) { - wasInCache = true; - } - if (!thisScores) { - setThisScores(thisScore); - } + useEffect(async () => { + if (!obj.data.testScores) { + const freshScore = await getOrchestratorScores(obj.data.year, obj.data.month); + if (freshScore) { + setThisScores(freshScore); } + } else { + setThisScores(obj.data.testScores); } - if (!wasInCache) { - dispatch(getOrchestratorScores(obj.year, obj.month)); - dispatch(getAllMonthlyStats()); - } - }, []); + }, [obj.data.testScores]); const getName = (address) => { let thisDomain = null; @@ -70,12 +59,15 @@ const WinnerMonth = (obj) => { // Show all orchs (if latestTotalStake exists) or show only those in winningTicketsReceived let orchList; + let ticketList = obj.data.winningTicketsReceived || []; + let commissionList = obj.data.latestCommission || []; + let stakeList = obj.data.latestTotalStake || []; // Pies for stake overview, if have stake data for that month saved let stakeObj; let totalStakeSum = 0; if (obj.data.latestTotalStake && obj.data.latestTotalStake.length) { - orchList = obj.data.latestTotalStake; + orchList = [...obj.data.latestTotalStake]; let pieList = []; let otherSum = 0; let ticketIdx = obj.data.latestTotalStake.length - 1; @@ -106,39 +98,63 @@ const WinnerMonth = (obj) => { stakeObj =

Stake Distribution

-
- -
+
; } else { - orchList = obj.data.winningTicketsReceived; + orchList = [...obj.data.winningTicketsReceived]; } + let sortedList = []; + if (orchList.length) { + // Sort this months data + while (orchList.length) { + let ticketIdx2 = orchList.length - 1; + let largestIdx = 0; + let largestValue = 0; + // Find current O with most ticket wins in Eth + while (ticketIdx2 >= 0) { + const currentOrch = orchList[ticketIdx2]; + const thisVal = (currentOrch.sum || currentOrch.totalStake); + if (thisVal > largestValue) { + largestIdx = ticketIdx2; + largestValue = thisVal; + } + ticketIdx2 -= 1; + } + // Push current biggest list + sortedList.push(orchList[largestIdx]); + // Remove from list + orchList.splice(largestIdx, 1); + } + } + + // Pies for earnings overview let earningsObj; if (obj.data.winningTicketsReceived && obj.data.winningTicketsReceived.length) { @@ -163,130 +179,139 @@ const WinnerMonth = (obj) => { sum: otherSum }); - stakeObj =
-

Stake Distribution

-
- -
+ earningsObj =
+

Earnings Distribution

+
; } return ( -
- {stakeObj} - {earningsObj} +
{obj.data.reactivationCount ? -
-

{obj.data.reactivationCount} Orchestrator reactivated

+
+

🔌 {obj.data.reactivationCount} Orchestrators reactivated

: null } {obj.data.activationCount ? -
-

{obj.data.activationCount} Orchestrator activated with an initial stake of {obj.data.activationInitialSum} LPT

+
+

🔧 {obj.data.activationCount} Orchestrator joined with an initial stake of {obj.data.activationInitialSum.toFixed(2)} LPT

: null } {obj.data.unbondCount ? -
-

{obj.data.unbondCount} delegators unbonded {obj.data.unbondStakeSum} LPT

+
+

📉 {obj.data.unbondCount} delegators unbonded {obj.data.unbondStakeSum.toFixed(2)} LPT

: null } {obj.data.rewardCount ? -
-

{obj.data.rewardCount} reward calls were made worth {obj.data.rewardAmountSum} LPT

+
+

⌛ {obj.data.rewardCount} reward calls were made worth {obj.data.rewardAmountSum.toFixed(2)} LPT

: null } {obj.data.claimCount ? -
-

{obj.data.claimCount} reward claims were made worth {obj.data.claimRewardSum} LPT and {obj.data.claimFeeSum} ETH

+
+

💸 {obj.data.claimRewardSum.toFixed(2)} LPT and {obj.data.claimFeeSum.toFixed(2)} ETH rewards were claimed by {obj.data.claimCount} delegators

: null } {obj.data.withdrawStakeCount ? -
-

{obj.data.withdrawStakeCount} withdraw stake calls were made worth {obj.data.withdrawStakeAmountSum} LPT

+
+

🏦 {obj.data.withdrawStakeAmountSum.toFixed(2)} LPT worth of staking rewards were withdrawn by {obj.data.withdrawStakeCount} delegators

: null } {obj.data.withdrawFeesCount ? -
-

{obj.data.withdrawFeesCount} withdraw fees calls were made worth {obj.data.withdrawFeesAmountSum} ETH

+
+

🏦 {obj.data.withdrawFeesAmountSum.toFixed(2)} ETH worth of transcoding fees were withdrawn by {obj.data.withdrawFeesCount} delegators

: null } {obj.data.bondCount ? -
-

{obj.data.bondCount} delegators delegated their first stake worth {obj.data.bondStakeSum} LPT

+
+

📈 {obj.data.bondCount} accounts delegated for the first time for a total of {obj.data.bondStakeSum.toFixed(2)} LPT

: null } {obj.data.moveStakeCount ? -
-

Stake got moved around {obj.data.moveStakeCount} times worth {obj.data.moveStakeSum} LPT

+
+

🔄 {obj.data.moveStakeSum.toFixed(2)} LPT stake got moved around in {obj.data.moveStakeCount} transactions

: null } {obj.data.winningTicketsReceivedCount ? -
-

{obj.data.winningTicketsReceivedCount} winning tickets were sent out worth {obj.data.winningTicketsReceivedSum} ETH

+
+

🎫 {obj.data.winningTicketsReceivedCount} winning tickets were sent out worth {obj.data.winningTicketsReceivedSum.toFixed(2)} ETH

: null } {obj.data.winningTicketsRedeemedCount ? -
-

{obj.data.winningTicketsRedeemedCount} winning tickets were redeemed worth {obj.data.winningTicketsRedeemedSum} ETH

+
+

🎟️ {obj.data.winningTicketsRedeemedCount} winning tickets were redeemed worth {obj.data.winningTicketsRedeemedSum.toFixed(2)} ETH

: null } +
+ {stakeObj} + {earningsObj}
{ - orchList.map(function (orch, i) { + sortedList.map(function (orch, i) { let thisCommission = null; let thisStake = null; let thisEarnings = null; - for (const obj in obj.data.winningTicketsReceived) { - if (obj.address == orch.address){ + + for (const obj of ticketList) { + if (obj.address == orch.address) { thisEarnings = obj; } } - for (const obj in obj.data.latestCommission) { - if (obj.address == orch.address){ + for (const obj of commissionList) { + if (obj.address == orch.address) { thisCommission = obj; } } - for (const obj in obj.data.latestTotalStake) { - if (obj.address == orch.address){ + for (const obj of stakeList) { + if (obj.address == orch.address) { thisStake = obj; } } - return () + let thisScore = null; + if (thisScores) { + thisScore = thisScores.scores[orch.address]; + } + return ( +
+ +
+
+ ) }) }
diff --git a/src/components/WinnerStat.js b/src/components/WinnerStat.js index f0fabf6..235e510 100644 --- a/src/components/WinnerStat.js +++ b/src/components/WinnerStat.js @@ -6,17 +6,47 @@ import { CircularProgressbar } from 'react-circular-progressbar'; import 'react-circular-progressbar/dist/styles.css'; const Winner = (obj) => { + const [thisScore, setThisScore] = useState(0); const [opened, setOpened] = useState(false); useEffect(() => { let score = 0; + let count = 0; if (obj.thisScore) { - score = (obj.thisScore["FRA"].score + obj.thisScore["LAX"].score + obj.thisScore["LON"].score + obj.thisScore["MDW"].score + obj.thisScore["NYC"].score + obj.thisScore["PRG"].score + obj.thisScore["SIN"].score) / 7; + if (obj.thisScore["FRA"]) { + count++; + score += obj.thisScore["FRA"].score; + } + if (obj.thisScore["LAX"]) { + count++; + score += obj.thisScore["LAX"].score; + } + if (obj.thisScore["LON"]) { + count++; + score += obj.thisScore["LON"].score; + } + if (obj.thisScore["MDW"]) { + count++; + score += obj.thisScore["MDW"].score; + } + if (obj.thisScore["NYC"]) { + count++; + score += obj.thisScore["NYC"].score; + } + if (obj.thisScore["PRG"]) { + count++; + score += obj.thisScore["PRG"].score; + } + if (obj.thisScore["SIN"]) { + count++; + score += obj.thisScore["SIN"].score; + } + score /= count; if (obj.thisScore != score) { - setobj.thisScore(score); + setThisScore(score); } } - }, [obj.stats]); + }, [obj.thisScore]); let scoreObj = null; if (obj.thisScore) { @@ -26,11 +56,11 @@ const Winner = (obj) => { onClose={() => setOpened(false)} target={
setOpened((o) => !o)} > - { position="right" withArrow > - + } return ( -
-
-
-
-
-
-

{obj.thisEarnings.sum.toFixed(4)} Eth

-
-
- ({((obj.thisEarnings.sum / obj.totalEarnings) * 100).toFixed(2)} %) +
+
+
+
+ {scoreObj}
- {obj.thisStake ? -
+
+ {obj.thisEarnings ?
-

{obj.thisStake.totalStake.toFixed(4)} LPT

+

Fees

+
+
+

{obj.thisEarnings.sum.toFixed(4)} Eth

- ({((obj.thisStake.totalStake / obj.totalStake) * 100).toFixed(2)} %) + ({((obj.thisEarnings.sum / obj.totalEarnings) * 100).toFixed(2)} %)
: null - } - {obj.thisCommission ? -
-
- {obj.thisCommission.rewardCommission.toFixed(2)}% Reward -
-
- {obj.thisCommission.feeCommission.toFixed(2)}% Fee -
-
: null - } - {scoreObj} + } + {obj.thisStake ? +
+
+

Stake

+
+
+

{obj.thisStake.totalStake.toFixed(4)} LPT

+
+
+ ({((obj.thisStake.totalStake / obj.totalStake) * 100).toFixed(2)} %) +
+
: null + } + {obj.thisCommission ? +
+
+

Commission

+
+
+ {obj.thisCommission.rewardCommission.toFixed(2)}% Reward +
+
+ {obj.thisCommission.feeCommission.toFixed(2)}% Fee +
+
: null + } +
) } diff --git a/src/components/eventButton.js b/src/components/eventButton.js index 5729349..4c223c7 100644 --- a/src/components/eventButton.js +++ b/src/components/eventButton.js @@ -39,7 +39,7 @@ const EventButton = (obj) => { } else if (obj.type == "claim") { eventCaller = obj.eventObj.address; eventDescription = @@ -47,9 +47,8 @@ const EventButton = (obj) => { } else if (obj.type == "withdrawStake") { eventCaller = obj.eventObj.address; eventDescription = eventColour = withdrawStakeColour; } else if (obj.type == "withdrawFees") { @@ -98,40 +97,40 @@ const EventButton = (obj) => { eventTo = obj.eventObj.to; if (eventFrom === "0x0000000000000000000000000000000000000000") { eventFrom = ""; - eventDescription = } else if (eventFrom === eventTo) { eventFrom = ""; - eventDescription = } else { - eventDescription = } eventColour = stakeColour; } - if (obj.eventObj.eventFrom === "0x0000000000000000000000000000000000000000") { - obj.eventObj.eventFrom = ""; + if (eventFrom === "0x0000000000000000000000000000000000000000") { + eventFrom = ""; } - if (obj.eventObj.eventTo === "0x0000000000000000000000000000000000000000") { - obj.eventObj.eventTo = ""; + if (eventTo === "0x0000000000000000000000000000000000000000") { + eventTo = ""; } - if (obj.eventObj.eventTo || obj.eventObj.eventFrom || obj.eventObj.eventCaller) { - if (obj.eventObj.eventTo) { + if (eventTo || eventFrom || eventCaller) { + if (eventTo) { eventTo = - + } - if (obj.eventObj.eventFrom) { + if (eventFrom) { eventFrom = - + } - if (obj.eventObj.eventCaller) { + if (eventCaller) { eventCaller = - + } } diff --git a/src/components/eventViewer.js b/src/components/eventViewer.js index 227d4bf..94f7a47 100644 --- a/src/components/eventViewer.js +++ b/src/components/eventViewer.js @@ -34,7 +34,9 @@ const EventViewer = (obj) => { let filtered = 0; let hidden = 0; let prevBlock = 0; - let limitShown = obj.events.length + obj.tickets.length; + let limitShown = obj.updateEvents.length + obj.rewardEvents.length + obj.claimEvents.length + + obj.withdrawStakeEvents.length + obj.withdrawFeesEvents.length + obj.activateEvents.length + + obj.stakeEvents.length + obj.unbondEvents.length + obj.transferTicketEvents.length + obj.redeemTicketEvents.length; let filterActivatedColour; filterActivatedColour = filterActivated ? activationColour : greyColour; @@ -429,7 +431,7 @@ const EventViewer = (obj) => { if (unfiltered < obj.maxAmount) { unfiltered++; - if (prevBlock === thisEvent.transactionBlock) { + if (prevBlock === thisEvent.blockNumber) { eventList.push( { setSearchTerm={obj.setSearchTerm} />); } else { - prevBlock = thisEvent.transactionBlock; + prevBlock = thisEvent.blockNumber; eventList.push(); } @@ -501,6 +503,7 @@ const EventViewer = (obj) => { hideScrollbars={false} onEndScroll={updateOnScroll} ref={listInnerRef}>
+
{eventList}
{showMoreButton} diff --git a/src/pages/loadingScreen.js b/src/pages/loadingScreen.js index a237a78..b393925 100644 --- a/src/pages/loadingScreen.js +++ b/src/pages/loadingScreen.js @@ -4,9 +4,12 @@ import { getVisitorStats } from "../actions/user"; import { - getQuotes, getBlockchainData, getEvents, getCurrentOrchestratorInfo, getTickets, + getQuotes, getBlockchainData, getCurrentOrchestratorInfo, getAllEnsDomains, getAllEnsInfo, getAllThreeBoxInfo, getAllOrchScores, getAllOrchInfo, - getAllDelInfo, getAllMonthlyStats + getAllDelInfo, getAllMonthlyStats, getAllUpdateEvents, getAllRewardEvents, + getAllClaimEvents, getAllWithdrawStakeEvents, getAllWithdrawFeesEvents, + getAllTransferTicketEvents, getAllRedeemTicketEvents, getAllActivateEvents, + getAllUnbondEvents, getAllStakeEvents, } from "../actions/livepeer"; import { login } from "../actions/session"; diff --git a/src/pages/stats.js b/src/pages/stats.js index 7af072c..ea5ea62 100644 --- a/src/pages/stats.js +++ b/src/pages/stats.js @@ -58,7 +58,7 @@ const Stats = (obj) => { contentInner: { padding: 0 }, }}> { - livepeer.monthlyStats.map(function (data) { + livepeer.monthlyStats.slice(0).reverse().map(function (data, i) { let thisMonth = ""; let monthAsNum = data.month; if (monthAsNum == 0) { @@ -91,10 +91,11 @@ const Stats = (obj) => { + key={"accord" + i + data.year + "-" + data.month + "-" + data.total}> ) diff --git a/src/style.css b/src/style.css index fbe9772..10d8b33 100644 --- a/src/style.css +++ b/src/style.css @@ -200,6 +200,15 @@ svg { text-shadow: 0.5px 0.5px 0.8px #5a5663; } +.darkTextSmoll { + margin: 0; + padding: 0; + color: rgba(0, 0, 0, 0.875); + text-shadow: 0.5px 0.5px 0.8px #5a5663; + font-weight: normal; + font-size: small; +} + .hostInfo { cursor: default; text-align: start;