Published
Edited
Jan 15, 2020
3 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
import {slider, select} from "@jashkenas/inputs"
Insert cell
totalGroupValElected = Math.floor(FractionVoteShare*100)
Insert cell
ownGroup = {
var ownGroup
if (ownGroupStr == "Yes") {
return 1
} else {
return 0
}
}
Insert cell
targetValReward = 75000
Insert cell
overspendAdjustmentFactor = 5
Insert cell
underspendAdjustmentFactor = 0.5
Insert cell
maxMultiplier = 2
Insert cell
pctVotingReward = 0.06
Insert cell
rewardsMult = {
if (fractionRemaining<1) {
let mult = Math.max(0, round(1+overspendAdjustmentFactor*(fractionRemaining-1), 4))
if (isNaN(mult)) {
return 0
} else {
return mult
}
} else {
return round(Math.min(1+underspendAdjustmentFactor*(fractionRemaining-1), maxMultiplier), 4)
}
}
Insert cell
function round(value, decimals) {
return Number(Math.round(value+'e'+decimals)+'e-'+decimals);
}
Insert cell
cGldLockedVals = 10000*ownValElected
Insert cell
cGldLockedGroup = 10000*totalGroupValElected*ownGroup
Insert cell
valNodesReward = round(targetValReward*(1-groupShare)*ownValElected*rewardsMult, 0)
Insert cell
groupOwnerReward = round(groupShare*totalGroupValElected*targetValReward*rewardsMult*ownGroup, 0)
Insert cell
lockedGoldReward = round((cGldLockedVals+cGldLockedGroup)*pctVotingReward*rewardsMult, 0)
Insert cell
lockedGoldRewardUSD = round(lockedGoldReward * cGldPrice, 0)
Insert cell
totalRewardCUSD = round(valNodesReward + groupOwnerReward, 0)
Insert cell
totalRewardUSD = round(totalRewardCUSD + lockedGoldRewardUSD, 0)
Insert cell
fractionRemaining = 1
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more