diff --git a/backend/src/routes/livepeer.js b/backend/src/routes/livepeer.js index 5ad3245..902c214 100644 --- a/backend/src/routes/livepeer.js +++ b/backend/src/routes/livepeer.js @@ -240,6 +240,7 @@ apiRouter.get("/getEvents", async (req, res) => { }); const parseOrchestrator = async function (reqAddr) { + reqAddr = reqAddr.toLowerCase(); const now = new Date().getTime(); // Default assume it's the first time we request this Orchestrator let wasCached = false; @@ -248,6 +249,8 @@ const parseOrchestrator = async function (reqAddr) { // First get cached object for (var orch of orchestratorCache) { if (orch.addr == reqAddr) { + console.log("found cached obj"); + console.log(orch); wasCached = true; orchestratorObj = orch; break; @@ -256,6 +259,9 @@ const parseOrchestrator = async function (reqAddr) { if (wasCached) { if (now - orch.lastGet < timeoutTheGraph) { needsUpdate = false; + console.log("cached obj is up to date"); + }else{ + console.log("cached obj needs update"); } } if (!wasCached || needsUpdate) { @@ -300,17 +306,23 @@ const parseOrchestrator = async function (reqAddr) { } `; orchestratorObj = JSON.stringify(await request("https://api.thegraph.com/subgraphs/name/livepeer/arbitrum-one", orchQuery)); + console.log("downloaded new obj"); + console.log(orchestratorObj); if (wasCached) { for (var orch of orchestratorCache) { if (orch.addr == requestedOrchestrator) { + console.log("modifying existing obj in cache"); orch = orchestratorObj; break; } } } else { + console.log("pushing this obj to cache"); orchestratorCache.push(orchestratorObj); } } + console.log("returning obj"); + console.log(orchestratorObj); return orchestratorObj; } diff --git a/src/actions/livepeer.js b/src/actions/livepeer.js index 3627484..b6c11ac 100644 --- a/src/actions/livepeer.js +++ b/src/actions/livepeer.js @@ -62,6 +62,7 @@ export const getCurrentOrchestratorInfo = () => async dispatch => { export const getOrchestratorInfo = (orchAddr) => async dispatch => { const response = await apiUtil.getOrchestratorInfo(orchAddr); const data = await response.json(); + console.log(data); if (response.ok) { return dispatch(setOrchestratorInfo(data)); } diff --git a/src/eventButton.js b/src/eventButton.js index 4aa1928..932569c 100644 --- a/src/eventButton.js +++ b/src/eventButton.js @@ -29,9 +29,9 @@ const EventButton = (obj) => { thisData.map(eventObj => { // Bond: contains amount the transaction is about and who is participating if (eventObj.name == "Bond") { - transactionCaller = eventObj.data.delegator; - transactionFrom = eventObj.data.oldDelegate; - transactionTo = eventObj.data.newDelegate; + transactionCaller = eventObj.data.delegator.toLowerCase(); + transactionFrom = eventObj.data.oldDelegate.toLowerCase(); + transactionTo = eventObj.data.newDelegate.toLowerCase(); transactionAmount = parseFloat(eventObj.data.bondedAmount); transactionAdditionalAmount = parseFloat(eventObj.data.additionalAmount); hasBondTransaction = true; @@ -41,7 +41,7 @@ const EventButton = (obj) => { transactionName = "Activated"; transactionWhen = eventObj.data.activationRound; if (!hasBondTransaction) { - transactionCaller = eventObj.data.transcoder; + transactionCaller = eventObj.data.transcoder.toLowerCase(); } thisColour = activationColour; isOnlyBond = false; @@ -49,7 +49,7 @@ const EventButton = (obj) => { // TranscoderActivated: defines transactionName. Defines transactionAmount as X / 1000000000000000000 LPT if (eventObj.name == "Reward") { transactionName = "Reward"; - transactionCaller = eventObj.data.transcoder; + transactionCaller = eventObj.data.transcoder.toLowerCase(); transactionAmount = eventObj.data.amount / 1000000000000000000; thisColour = rewardColour; isOnlyBond = false; @@ -57,7 +57,7 @@ const EventButton = (obj) => { // TranscoderUpdate: defines transactionName. Defines transactionAmount as rewardCut and transactionAdditionalAmount as feeCut if (eventObj.name == "TranscoderUpdate") { transactionName = "Update"; - transactionCaller = eventObj.data.transcoder; + transactionCaller = eventObj.data.transcoder.toLowerCase(); transactionAmount = eventObj.data.rewardCut / 10000; transactionAdditionalAmount = 100 - (eventObj.data.feeShare / 10000); thisColour = updateColour; @@ -66,7 +66,7 @@ const EventButton = (obj) => { // WithdrawStake: defines transactionName. Defines transactionAmount as rewardCut and transactionAdditionalAmount as feeCut if (eventObj.name == "WithdrawStake") { transactionName = "Withdraw"; - transactionCaller = eventObj.data.delegator; + transactionCaller = eventObj.data.delegator.toLowerCase(); transactionAmount = eventObj.data.amount / 1000000000000000000; transactionWhen = eventObj.data.withdrawRound; thisColour = withdrawStakeColour; @@ -84,47 +84,51 @@ const EventButton = (obj) => { if (transactionName == "Reward") { if (transactionAmount - 69 < 1 && transactionAmount - 69 > 0) { eventSpecificInfo = -
called reward worth {transactionAmount.toFixed(2)} LPT. nice
called reward worth {transactionAmount.toFixed(2)} LPT
changed their reward commission to {transactionAmount.toFixed(2)}% and their fee commission to {transactionAdditionalAmount.toFixed(2)}%
staked {(transactionAmount / 1000000000000000000).toFixed(2)} LPT to {transactionTo}
+staked {(transactionAmount / 1000000000000000000).toFixed(2)} LPT to
+changed stake from {transactionFrom} to {transactionTo} of {(transactionAmount / 1000000000000000000).toFixed(2)} LPT
+moved {(transactionAmount / 1000000000000000000).toFixed(2)} LPT stake:
+ +to
+withdrew {(transactionAmount / 1000000000000000000).toFixed(2)} LPT in round {transactionWhen}
{transactionCaller} activated with a self stake of {(transactionAmount / 1000000000000000000).toFixed(2)} LPT and will become active in round {transactionWhen}
+activated with a self stake of {(transactionAmount / 1000000000000000000).toFixed(2)} LPT and will become active in round {transactionWhen}
reactivated and will become active in round {transactionWhen}
{transactionCaller}
- +${lptPrice}
-({lptPriceChange24h}%)
-${ethPrice}
-({ethPriceChange24h}%)
-Earned fees {totalVolumeETH} Eth (${totalVolumeUSD})
Reward Cut {rewardCut}%
@@ -45,27 +57,32 @@ const Orchestrator = (obj) => {Total Stake {totalStake} LPT
-Self stake {selfStake} LPT ({selfStakeRatio}%)
Earned fees {totalVolumeETH} Eth (${totalVolumeUSD})
+{parseFloat(delObj.bondedAmount).toFixed(2)} LPT since round {delObj.startRound}
+{parseFloat(delObj.bondedAmount).toFixed(2)} LPT since round {delObj.startRound}
-