mirror of
https://github.com/stronk-dev/LivepeerEvents.git
synced 2025-07-05 10:45:10 +02:00
Small cleanup
This commit is contained in:
parent
a36125a842
commit
50dea0e3e8
@ -249,8 +249,6 @@ 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;
|
||||
@ -259,9 +257,6 @@ 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) {
|
||||
@ -306,23 +301,17 @@ 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;
|
||||
}
|
||||
|
||||
@ -335,7 +324,6 @@ apiRouter.get("/getOrchestrator", async (req, res) => {
|
||||
const reqObj = await parseOrchestrator(reqOrch);
|
||||
res.send(reqObj);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
res.status(400).send(err);
|
||||
}
|
||||
});
|
||||
@ -345,7 +333,6 @@ apiRouter.get("/getOrchestrator/:orch", async (req, res) => {
|
||||
const reqObj = await parseOrchestrator(req.params.orch);
|
||||
res.send(reqObj);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
res.status(400).send(err);
|
||||
}
|
||||
});
|
||||
|
@ -1,9 +1,3 @@
|
||||
{/* Ability to receive and clear errors as dispatch actions
|
||||
Requires this in files where errors can be received:
|
||||
const mapStateToProps = ({ errors }) => ({
|
||||
errors
|
||||
});
|
||||
*/}
|
||||
export const RECEIVE_ERRORS = "RECEIVE_ERRORS";
|
||||
export const RECEIVE_NOTIFICATIONS = "RECEIVE_NOTIFICATIONS";
|
||||
export const CLEAR_ERRORS = "CLEAR_ERRORS";
|
||||
|
@ -62,7 +62,6 @@ 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));
|
||||
}
|
||||
|
@ -9,9 +9,9 @@ const stakeColour = "rgba(71, 23, 122, 0.3)";
|
||||
const EventButton = (obj) => {
|
||||
// Data shared among all events in this transaction
|
||||
const thisURL = obj.transactionUrl;
|
||||
const thisTransaction = obj.transactionHash;
|
||||
//const thisTransaction = obj.transactionHash;
|
||||
const thisData = obj.events;
|
||||
const thisIndex = obj.idx;
|
||||
//const thisIndex = obj.idx;
|
||||
// Abstraction of all events in this transaction
|
||||
let transactionName = "";
|
||||
let transactionCaller = "";
|
||||
@ -28,7 +28,7 @@ const EventButton = (obj) => {
|
||||
// Which we will fill in by going over all of the events once
|
||||
thisData.map(eventObj => {
|
||||
// Bond: contains amount the transaction is about and who is participating
|
||||
if (eventObj.name == "Bond") {
|
||||
if (eventObj.name === "Bond") {
|
||||
transactionCaller = eventObj.data.delegator.toLowerCase();
|
||||
transactionFrom = eventObj.data.oldDelegate.toLowerCase();
|
||||
transactionTo = eventObj.data.newDelegate.toLowerCase();
|
||||
@ -37,7 +37,7 @@ const EventButton = (obj) => {
|
||||
hasBondTransaction = true;
|
||||
}
|
||||
// TranscoderActivated: defines transactionName. Defines transactionAmount as X * 7e-18 LPT
|
||||
if (eventObj.name == "TranscoderActivated") {
|
||||
if (eventObj.name === "TranscoderActivated") {
|
||||
transactionName = "Activated";
|
||||
transactionWhen = eventObj.data.activationRound;
|
||||
if (!hasBondTransaction) {
|
||||
@ -47,7 +47,7 @@ const EventButton = (obj) => {
|
||||
isOnlyBond = false;
|
||||
}
|
||||
// TranscoderActivated: defines transactionName. Defines transactionAmount as X / 1000000000000000000 LPT
|
||||
if (eventObj.name == "Reward") {
|
||||
if (eventObj.name === "Reward") {
|
||||
transactionName = "Reward";
|
||||
transactionCaller = eventObj.data.transcoder.toLowerCase();
|
||||
transactionAmount = eventObj.data.amount / 1000000000000000000;
|
||||
@ -55,7 +55,7 @@ const EventButton = (obj) => {
|
||||
isOnlyBond = false;
|
||||
}
|
||||
// TranscoderUpdate: defines transactionName. Defines transactionAmount as rewardCut and transactionAdditionalAmount as feeCut
|
||||
if (eventObj.name == "TranscoderUpdate") {
|
||||
if (eventObj.name === "TranscoderUpdate") {
|
||||
transactionName = "Update";
|
||||
transactionCaller = eventObj.data.transcoder.toLowerCase();
|
||||
transactionAmount = eventObj.data.rewardCut / 10000;
|
||||
@ -64,7 +64,7 @@ const EventButton = (obj) => {
|
||||
isOnlyBond = false;
|
||||
}
|
||||
// WithdrawStake: defines transactionName. Defines transactionAmount as rewardCut and transactionAdditionalAmount as feeCut
|
||||
if (eventObj.name == "WithdrawStake") {
|
||||
if (eventObj.name === "WithdrawStake") {
|
||||
transactionName = "Withdraw";
|
||||
transactionCaller = eventObj.data.delegator.toLowerCase();
|
||||
transactionAmount = eventObj.data.amount / 1000000000000000000;
|
||||
@ -81,7 +81,7 @@ const EventButton = (obj) => {
|
||||
}
|
||||
|
||||
let eventSpecificInfo;
|
||||
if (transactionName == "Reward") {
|
||||
if (transactionName === "Reward") {
|
||||
if (transactionAmount - 69 < 1 && transactionAmount - 69 > 0) {
|
||||
eventSpecificInfo =
|
||||
<div className="rowAlignLeft">
|
||||
@ -93,12 +93,12 @@ const EventButton = (obj) => {
|
||||
<p>called reward worth {transactionAmount.toFixed(2)} LPT</p>
|
||||
</div>
|
||||
}
|
||||
} else if (transactionName == "Update") {
|
||||
} else if (transactionName === "Update") {
|
||||
eventSpecificInfo =
|
||||
<div className="rowAlignLeft">
|
||||
<p>changed their reward commission to {transactionAmount.toFixed(2)}% and their fee commission to {transactionAdditionalAmount.toFixed(2)}%</p>
|
||||
</div>
|
||||
} else if (transactionName == "Stake") {
|
||||
} else if (transactionName === "Stake") {
|
||||
if (transactionFrom == "0x0000000000000000000000000000000000000000") {
|
||||
eventSpecificInfo =
|
||||
<div className="rowAlignLeft">
|
||||
@ -114,12 +114,12 @@ const EventButton = (obj) => {
|
||||
<button className="selectOrch" onClick={() => {obj.setOrchFunction(transactionTo)}} >{transactionTo}</button>
|
||||
</div>
|
||||
}
|
||||
} else if (transactionName == "Withdraw") {
|
||||
} else if (transactionName === "Withdraw") {
|
||||
eventSpecificInfo =
|
||||
<div className="rowAlignLeft">
|
||||
<p> withdrew {(transactionAmount / 1000000000000000000).toFixed(2)} LPT in round {transactionWhen}</p>
|
||||
</div>
|
||||
} else if (transactionName == "Activated") {
|
||||
} else if (transactionName === "Activated") {
|
||||
if (hasBondTransaction) {
|
||||
eventSpecificInfo =
|
||||
<div className="rowAlignLeft">
|
||||
|
@ -20,8 +20,8 @@ const EventViewer = (obj) => {
|
||||
<div className="overflow-content" style={{ cursor: 'grab' }}>
|
||||
{obj.events.slice(0).reverse().map((eventObj, idx) => {
|
||||
// Filter
|
||||
if (eventObj.name == "WithdrawFees" || eventObj.name == "TransferBond"
|
||||
|| eventObj.name == "Rebond" || eventObj.name == "Unbond" || eventObj.name == "EarningsClaimed"){
|
||||
if (eventObj.name === "WithdrawFees" || eventObj.name === "TransferBond"
|
||||
|| eventObj.name === "Rebond" || eventObj.name === "Unbond" || eventObj.name === "EarningsClaimed"){
|
||||
return;
|
||||
}
|
||||
// New transaction found
|
||||
|
@ -47,26 +47,20 @@ const Orchestrator = (obj) => {
|
||||
{thisID}
|
||||
</a>
|
||||
</div>
|
||||
<div className="rowAlignLeft">
|
||||
<p>Earned fees {totalVolumeETH} Eth (${totalVolumeUSD})</p>
|
||||
</div>
|
||||
<div className="rowAlignLeft">
|
||||
<p>Reward Cut {rewardCut}%</p>
|
||||
<p>Fee Cut {feeCut}%</p>
|
||||
</div>
|
||||
<div className="rowAlignLeft">
|
||||
<p>Total Stake {totalStake} LPT</p>
|
||||
<p>Self stake {selfStake} LPT ({selfStakeRatio}%)</p>
|
||||
</div>
|
||||
<p>Earned fees {totalVolumeETH} Eth (${totalVolumeUSD})</p>
|
||||
<p>Reward Cut {rewardCut}%</p>
|
||||
<p>Fee Cut {feeCut}%</p>
|
||||
<p>Total Stake {totalStake} LPT</p>
|
||||
<p>Self stake {selfStake} LPT ({selfStakeRatio}%)</p>
|
||||
</div>
|
||||
<div className="rowAlignLeft">
|
||||
<div className="strokeSmollLeft">
|
||||
<div className="content-wrapper">
|
||||
<ScrollContainer className="overflow-container" hideScrollbars={false}>
|
||||
<div className="overflow-content" style={{ cursor: 'grab', height: '300px' }}>
|
||||
{
|
||||
delegators.map((delObj, idx) => {
|
||||
return (
|
||||
<div className="rowAlignLeft">
|
||||
<div className="rowAlignLeft" key={"delegator"+idx}>
|
||||
<a href={"https://explorer.livepeer.org/accounts/" + delObj.id}>
|
||||
<img alt="" src="livepeer.png" width="30" height="30" />{delObj.id.substr(0, 6) + ".."}</a>
|
||||
<div className="strokeSmollLeft">
|
||||
@ -85,14 +79,12 @@ const Orchestrator = (obj) => {
|
||||
}
|
||||
return (
|
||||
<div className="hostInfo" style={{ height: '100%', width: '100%', display: 'flex' }}>
|
||||
<div style={{ flexDirection: 'strokeSmollLeft', display: "flex", height: '100%', width: '100%' }}>
|
||||
<div className="rowAlignLeft">
|
||||
<img alt="" src="livepeer.png" width="30" height="30" />
|
||||
<h3>Orchestrator Info</h3>
|
||||
</div>
|
||||
<div className="rowAlignLeft">
|
||||
<p>Click on an orchestrator in the list below!</p>
|
||||
</div>
|
||||
<div className="rowAlignLeft">
|
||||
<img alt="" src="livepeer.png" width="30" height="30" />
|
||||
<h3>Orchestrator Info</h3>
|
||||
</div>
|
||||
<div className="rowAlignLeft">
|
||||
<p>Click on an orchestrator in the list below!</p>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
@ -59,7 +59,6 @@ p {
|
||||
/* width */
|
||||
::-webkit-scrollbar {
|
||||
width: 10px;
|
||||
box-shadow: 0px 0px 8px 4px rgba(8, 7, 56, 0.692);
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user