diff --git a/backend/src/routes/livepeer.js b/backend/src/routes/livepeer.js
index ed1741d..978c0d1 100644
--- a/backend/src/routes/livepeer.js
+++ b/backend/src/routes/livepeer.js
@@ -65,13 +65,11 @@ const defaultOrch = "0x847791cbf03be716a7fe9dc8c9affe17bd49ae5e";
// Will contain addr, lastGet, and obj of any requested O's
let orchestratorCache = [];
-// Listen to smart contract emitters. Resync with DB every 5 minutes
-const timeoutEvents = 300000;
+// Listen to smart contract emitters. Only re-syncs on boot!
let eventsCache = [];
let latestMissedDuringSync = 0;
let lastBlockDataAdded = 0;
let syncCache = [];
-let eventsGet = 0;
// Set to true to drop the entire collection on boot and get all events
const fullSync = false;
// https://arbiscan.io/address/0x35Bcf3c30594191d53231E4FF333E8A770453e40#events
@@ -367,19 +365,6 @@ apiRouter.get("/quotes", async (req, res) => {
// Exports list of smart contract events
apiRouter.get("/getEvents", async (req, res) => {
try {
- const now = new Date().getTime();
- // Update cmc once their data has expired
- if (now - eventsGet > timeoutEvents) {
- eventsCache = await Event.find({}, {
- address: 1,
- transactionHash: 1,
- transactionUrl: 1,
- name: 1,
- data: 1,
- _id: 0
- });
- eventsGet = now;
- }
res.send(eventsCache);
} catch (err) {
res.status(400).send(err);
diff --git a/src/BlockViewer.js b/src/BlockViewer.js
new file mode 100644
index 0000000..2e9df55
--- /dev/null
+++ b/src/BlockViewer.js
@@ -0,0 +1,13 @@
+import React from "react";
+
+const Block = (obj) => {
+ return (
+
+
+ Block {obj.block}
+
+
+ )
+}
+
+export default Block;
\ No newline at end of file
diff --git a/src/actions/livepeer.js b/src/actions/livepeer.js
index 5eadae2..8c34912 100644
--- a/src/actions/livepeer.js
+++ b/src/actions/livepeer.js
@@ -63,6 +63,7 @@ export const getEvents = () => async dispatch => {
let txCounter = 0;
let currentTx = "";
let currentUrl = "";
+ let currentBlock = 0;
// Current Event we are processing
let eventType = ""; // Named type: Withdraw, Update, Claim, Reward, Activate, Unbond, Stake
let eventDescription = ""; // Descriptive text, also containing Amount, AmountOther and When
@@ -88,6 +89,7 @@ export const getEvents = () => async dispatch => {
if (currentTx === "") {
currentTx = eventObj.transactionHash;
currentUrl = eventObj.transactionUrl;
+ currentBlock = eventObj.blockNumber;
}
// New transaction found
if (currentTx !== eventObj.transactionHash) {
@@ -155,7 +157,8 @@ export const getEvents = () => async dispatch => {
eventTo,
eventColour,
transactionHash: currentTx,
- transactionUrl: currentUrl
+ transactionUrl: currentUrl,
+ transactionBlock: currentBlock
});
}
@@ -180,11 +183,15 @@ export const getEvents = () => async dispatch => {
txCounter++;
currentTx = eventObj.transactionHash;
currentUrl = eventObj.transactionUrl;
+ currentBlock = eventObj.blockNumber;
}
// Always split off WithdrawStake as a separate Withdraw Event
if (eventObj.name === "WithdrawStake") {
const amount = parseFloat(eventObj.data.amount) / 1000000000000000000;
- const txt = " withdrew a " + amount + " LPT stake in round " + eventObj.data.withdrawRound;
+ if (amount < thresholdFees){
+ continue;
+ }
+ const txt = " withdrew a " + amount.toFixed(2) + " LPT stake in round " + eventObj.data.withdrawRound;
finalEventList.push({
eventType: "Withdraw",
eventDescription: txt,
@@ -193,11 +200,15 @@ export const getEvents = () => async dispatch => {
eventTo: "",
eventColour: withdrawStakeColour,
transactionHash: currentTx,
- transactionUrl: currentUrl
+ transactionUrl: currentUrl,
+ transactionBlock: currentBlock
});
} else if (eventObj.name === "WithdrawFees") {
const amount = parseFloat(eventObj.data.amount) / 1000000000000000000;
- const txt = " withdrew " + amount + " LPT earned fees";
+ if (amount < thresholdFees){
+ continue;
+ }
+ const txt = " withdrew " + amount.toFixed(2) + " LPT earned fees";
finalEventList.push({
eventType: "Withdraw",
eventDescription: txt,
@@ -206,7 +217,8 @@ export const getEvents = () => async dispatch => {
eventTo: "",
eventColour: withdrawStakeColour,
transactionHash: currentTx,
- transactionUrl: currentUrl
+ transactionUrl: currentUrl,
+ transactionBlock: currentBlock
});
}
// Always split off TranscoderUpdate as a separate Update Event
@@ -223,7 +235,8 @@ export const getEvents = () => async dispatch => {
eventTo: "",
eventColour: updateColour,
transactionHash: currentTx,
- transactionUrl: currentUrl
+ transactionUrl: currentUrl,
+ transactionBlock: currentBlock
});
}
// Always split off EarningsClaimed as a separate Claim Event
@@ -253,7 +266,8 @@ export const getEvents = () => async dispatch => {
eventTo: "",
eventColour: claimColour,
transactionHash: currentTx,
- transactionUrl: currentUrl
+ transactionUrl: currentUrl,
+ transactionBlock: currentBlock
});
}
// Always split off Reward as a separate Reward Event
@@ -272,7 +286,8 @@ export const getEvents = () => async dispatch => {
eventTo: "",
eventColour: rewardColour,
transactionHash: currentTx,
- transactionUrl: currentUrl
+ transactionUrl: currentUrl,
+ transactionBlock: currentBlock
});
}
// Extract useful info from other types of Event
diff --git a/src/eventButton.js b/src/eventButton.js
index d1cd716..967ea9d 100644
--- a/src/eventButton.js
+++ b/src/eventButton.js
@@ -3,6 +3,7 @@ import {
getOrchestratorInfo
} from "./actions/livepeer";
import { useDispatch } from 'react-redux';
+import Block from "./BlockViewer";
/// Displays a single event. Sets selected Orchestrator info in the redux store
@@ -40,26 +41,36 @@ const EventButton = (obj) => {
{eventTo}
}
+
+ let blockNumber;
+ if (obj.isFirstOfBlock) {
+ blockNumber =
+
+ }
+
return (
-
-
-
-
-
-
-
-
-
- {eventCaller}
+
+ {blockNumber}
+
+
+
+
+
+
+
+
+
+ {eventCaller}
+
-
-
-
- {obj.eventObj.eventDescription}
-
- {eventRightAddr}
-
-
+
+
+ {obj.eventObj.eventDescription}
+
+ {eventRightAddr}
+
+
+
)
}
diff --git a/src/eventViewer.js b/src/eventViewer.js
index 5bea5ee..bff103a 100644
--- a/src/eventViewer.js
+++ b/src/eventViewer.js
@@ -41,6 +41,7 @@ const EventViewer = (obj) => {
let unbondActivatedColour;
unbondActivatedColour = unbondActivated ? unbondColour : greyColour;
+ let prevBlock = 0;
return (
@@ -129,10 +130,19 @@ const EventViewer = (obj) => {
if (unfiltered < maxShown) {
unfiltered++;
- return
+ if (prevBlock === eventObj.transactionBlock) {
+ return
+ } else {
+ prevBlock = eventObj.transactionBlock;
+ return
+ }
}
})}
diff --git a/src/orchestratorViewer.js b/src/orchestratorViewer.js
index 94063e1..7c7068f 100644
--- a/src/orchestratorViewer.js
+++ b/src/orchestratorViewer.js
@@ -113,7 +113,7 @@ const Orchestrator = (obj) => {
return (
-
+
{parseFloat(delObj.bondedAmount).toFixed(2)} LPT since round {delObj.startRound}