Skip to content

Commit

Permalink
Show MEV and any other validations we are doing
Browse files Browse the repository at this point in the history
  • Loading branch information
0xJohnnyGault committed Jul 31, 2024
1 parent 9beea18 commit 4e8d129
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion public/ggavax.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ <h3 class="text-center">ggAVAX Delegations</h3>
</div>
<br />
<div class="container w-95 border border-5 rounded pb-3">
<h3 class="text-center">ggAVAX MEV</h3>
<h3 class="text-center">ggAVAX Validations (MEV, etc)</h3>
<div id="mev" class="text-center"><div class="loader">Loading...</div></div>
</div>
<br />
Expand Down
10 changes: 7 additions & 3 deletions public/js/ggavax.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ggAVAX {
}

async fetchCurrentMEV() {
const startTimestamp = Math.floor(Date.now() / 1000) - 15 * 24 * 60 * 60;
const startTimestamp = Math.floor(Date.now() / 1000) - 45 * 24 * 60 * 60;
const endTimestamp = Math.floor(Date.now() / 1000);
const url = (nextPageParamAndToken) =>
`https://glacier-api.avax.network/v1/networks/mainnet/blockchains/p-chain/transactions:listStaking?addresses=avax10f8305248c0wsfsdempdtpx7lpkc30vwzl9y9q&txTypes=AddValidatorTx&txTypes=AddPermissionlessValidatorTx&startTimestamp=${startTimestamp}&endTimestamp=${endTimestamp}&pageSize=100${nextPageParamAndToken}`;
Expand All @@ -37,8 +37,12 @@ class ggAVAX {
i++;
} while (nextPageParamAndToken && i < 10);

// MEV Nodes run 337 hours
this.currentMEV = txs.filter((t) => t.endTimestamp - t.startTimestamp <= 337 * 60 * 60);
// exclude all nodes that are minipools (15 day duration)
this.currentMEV = txs.filter((t) => {
const dur = t.endTimestamp - t.startTimestamp;
const isMinipool = dur >= 1295000 && dur <= 1296000;
return !isMinipool;
});
return this.currentMEV;
}

Expand Down
10 changes: 6 additions & 4 deletions public/js/tabulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ const ggAVAXDef = {
clipboardCopyRowRange: "selected",
columns: [
{ width: 20, formatter: "responsiveCollapse", headerSort: false },
{ title: "Started", field: "startTimestamp", formatter: formatUnixTime },
{ title: "Node", field: "nodeId", formatter: formatNodeIdLink },
{ title: "Amount", field: "amountStaked", formatter: formatGlacierAmount },
{ title: "Reward", field: "estimatedReward", formatter: formatAvaxAmount },
{ title: "Period Ends", field: "endTimestamp", formatter: formatDurationHumanUntil },
{ title: "Amount", field: "amountStaked", formatter: formatGlacierAmount, width: 50 },
{ title: "Reward", field: "estimatedReward", formatter: formatAvaxAmount, width: 40 },
{ title: "Started", field: "startTimestamp", formatter: formatUnixTime, width: 150 },
],
};

Expand Down Expand Up @@ -138,8 +138,10 @@ const ggAVAXMEVDef = {
clipboardCopyRowRange: "selected",
columns: [
{ width: 20, formatter: "responsiveCollapse", headerSort: false },
{ title: "Period Ends", field: "endTimestamp", formatter: formatDurationHumanUntil },
{ title: "Node", field: "nodeId", formatter: formatNodeIdLink },
{ title: "Period Ends", field: "endTimestamp", formatter: formatDurationHumanUntil },
{ title: "Amount", field: "amountStaked", formatter: formatGlacierAmount, width: 70 },
{ title: "Reward", field: "estimatedReward", formatter: formatAvaxAmount, width: 60 },
],
};

Expand Down

0 comments on commit 4e8d129

Please sign in to comment.