mirror of
https://github.com/seigler/govobject-proposal
synced 2025-07-27 06:46:10 +00:00
include proposal maturity constants
This commit is contained in:
parent
3848f5e4e9
commit
17fbcebf4f
1 changed files with 12 additions and 7 deletions
|
@ -9,13 +9,15 @@ function PaymentCycle(gov, provider) {
|
||||||
|
|
||||||
this.network = gov.network;
|
this.network = gov.network;
|
||||||
this.provider = provider;
|
this.provider = provider;
|
||||||
this.paymentCycle = 16616; // mainnet
|
this.paymentCycle = 16616;
|
||||||
|
this.proposalMaturity = 1662 + 10; // ~(60*24*3)/2.6 = about three days
|
||||||
this.budgetCycles = 24;
|
this.budgetCycles = 24;
|
||||||
|
|
||||||
this.selectedStartIndex = 0;
|
this.selectedStartIndex = 0;
|
||||||
this.selectedPeriods = 1;
|
this.selectedPeriods = 1;
|
||||||
|
|
||||||
if (this.network == 'testnet') this.paymentCycle = 23;
|
if (this.network == 'testnet') this.paymentCycle = 23;
|
||||||
|
if (this.network == 'testnet') this.proposalMaturity = 24 + 1; // a little more than one hour
|
||||||
if (this.network == 'testnet') this.budgetCycles = 99;
|
if (this.network == 'testnet') this.budgetCycles = 99;
|
||||||
|
|
||||||
this.blockHeight = null;
|
this.blockHeight = null;
|
||||||
|
@ -96,14 +98,15 @@ PaymentCycle.prototype.updateDropdowns = function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
var blockHeight = this.blockHeight;
|
var blockHeight = this.blockHeight;
|
||||||
|
var now = Math.floor(Date.now());
|
||||||
|
|
||||||
for (i = 0; i < this.budgetCycles + 1; i++) {
|
for (i = 0; i < this.budgetCycles + 1; i++) {
|
||||||
|
|
||||||
var superblock = this.getNextSuperblock(blockHeight);
|
var superblock = this.getNextSuperblock(blockHeight);
|
||||||
var timestamp = this.getBlockTimestamp(superblock);
|
var timestamp = this.getBlockTimestamp(superblock);
|
||||||
|
|
||||||
var before = this.getBlockTimestamp((superblock-(this.paymentCycle/2)));
|
var before = this.getBlockTimestamp((superblock-this.proposalMaturity));
|
||||||
var after = this.getBlockTimestamp((superblock+(this.paymentCycle/2)));
|
var after = this.getBlockTimestamp((superblock+(this.paymentCycle/2))); // set end_epoch to halfway after the last superblock
|
||||||
|
|
||||||
var label = new Date(timestamp).toLocaleDateString();
|
var label = new Date(timestamp).toLocaleDateString();
|
||||||
if (this.network == 'testnet') label += " @ " + new Date(timestamp).toLocaleTimeString();
|
if (this.network == 'testnet') label += " @ " + new Date(timestamp).toLocaleTimeString();
|
||||||
|
@ -115,8 +118,12 @@ PaymentCycle.prototype.updateDropdowns = function() {
|
||||||
after: after,
|
after: after,
|
||||||
label: label
|
label: label
|
||||||
};
|
};
|
||||||
this.startDate.push(superblockDate);
|
|
||||||
this.endDate.push(superblockDate);
|
// include superblock if proposal maturity date is later than now
|
||||||
|
if (superblockDate.before > now) {
|
||||||
|
this.startDate.push(superblockDate);
|
||||||
|
this.endDate.push(superblockDate);
|
||||||
|
}
|
||||||
|
|
||||||
blockHeight = superblock;
|
blockHeight = superblock;
|
||||||
|
|
||||||
|
@ -125,8 +132,6 @@ PaymentCycle.prototype.updateDropdowns = function() {
|
||||||
// this.endDate.shift(); // remove first element of endDate
|
// this.endDate.shift(); // remove first element of endDate
|
||||||
// this.startDate.pop(); // remove last element of startDate to keep length even
|
// this.startDate.pop(); // remove last element of startDate to keep length even
|
||||||
|
|
||||||
var now = Math.floor(Date.now());
|
|
||||||
|
|
||||||
var opts = {
|
var opts = {
|
||||||
precision: 2
|
precision: 2
|
||||||
}; // 2 unit of precision for eta formatting
|
}; // 2 unit of precision for eta formatting
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue