Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions data/dataStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ module.exports = {
proposalFee: 0,
budget: 0,
superBlockNextDate: 0,
superBlockNextEpochSec: 0,
votingDeadlineDate: 0,
sb1: 0,
sb2: 0,
Expand Down
5 changes: 5 additions & 0 deletions services/calculations.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ function calculations() {
proposal_fee: data.proposalFee,
budget: data.budget,
superblock_date: data.superBlockNextDate,
// Numeric next-superblock epoch (UNIX seconds). Callers that
// need a machine-readable anchor (governance wizard window
// derivation, etc.) should use this instead of parsing the
// human-formatted `superblock_date` string.
superblock_next_epoch_sec: data.superBlockNextEpochSec || 0,
voting_deadline: data.votingDeadlineDate,
sb1: "SB" + data.sb1 / sbTotal + " - " + data.sb1,
sb2: "SB" + data.sb2 / sbTotal + " - " + data.sb2,
Expand Down
6 changes: 6 additions & 0 deletions services/sysMain.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ setInterval(async function sysMain() {
const diffBlock = data.nextSuperBlock - data.currentBlock;
const sbDate = Date.now() + diffBlock * data.avgBlockTime;
data.superBlockNextDate = moment(sbDate).format("MMMM Do YYYY, h:mm:ss a");
// Raw next-superblock epoch (UNIX seconds) for API consumers that
// need a numeric anchor instead of the human-formatted string
// (e.g. the /governance/new wizard's computeProposalWindow).
// Kept alongside the formatted date so the two stay in sync
// whenever sbDate is recomputed.
data.superBlockNextEpochSec = Math.floor(sbDate / 1000);

const voteDeadlineBlock = data.nextSuperBlock - 1728;
const voteDeadlineDate = Date.now() + (voteDeadlineBlock - data.currentBlock) * data.avgBlockTime;
Expand Down
Loading