Reorganization into function libraries complete
This commit is contained in:
1 parent
b60906915c
commit
0514361d30
9 files changed
+70
-43
No files matched your search
@@ -7,5 +7,29 @@ function newGovernanceFunctionLibraryDistributionProcess() {
|
||||
|
||||
function calculate() {
|
||||
|
||||
let pools = UI.projects.superalgos.spaces.designSpace.workspace.getHierarchyHeadsByNodeType('Pools')
|
||||
let features = UI.projects.superalgos.spaces.designSpace.workspace.getHierarchyHeadsByNodeType('Features')
|
||||
let assets = UI.projects.superalgos.spaces.designSpace.workspace.getHierarchyHeadsByNodeType('Assets')
|
||||
let positions = UI.projects.superalgos.spaces.designSpace.workspace.getHierarchyHeadsByNodeType('Positions')
|
||||
let userProfiles = UI.projects.superalgos.spaces.designSpace.workspace.getHierarchyHeadsByNodeType('User Profile')
|
||||
|
||||
UI.projects.governance.functionLibraries.votes.calculate(
|
||||
pools,
|
||||
features,
|
||||
assets,
|
||||
positions,
|
||||
userProfiles
|
||||
)
|
||||
|
||||
UI.projects.governance.functionLibraries.weights.calculate(
|
||||
pools,
|
||||
features,
|
||||
assets,
|
||||
positions
|
||||
)
|
||||
|
||||
UI.projects.governance.functionLibraries.tokens.calculate(
|
||||
pools
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -5,14 +5,9 @@ function newGovernanceFunctionLibraryTokens() {
|
||||
|
||||
return thisObject
|
||||
|
||||
function calculate() {
|
||||
let pools = UI.projects.superalgos.spaces.designSpace.workspace.getHierarchyHeadsByNodeType('Pools')
|
||||
|
||||
/* Weight Calculation Follows */
|
||||
for (let i = 0; i < pools.length; i++) {
|
||||
let poolsNode = pools[i]
|
||||
UI.projects.governance.functionLibraries.weights.calculate(poolsNode)
|
||||
}
|
||||
function calculate(
|
||||
pools
|
||||
) {
|
||||
/*
|
||||
We will reset all the token flows, and then distribute it.
|
||||
*/
|
||||
|
||||
@@ -5,36 +5,36 @@ function newGovernanceFunctionLibraryVotes() {
|
||||
|
||||
return thisObject
|
||||
|
||||
function calculate() {
|
||||
let pools = UI.projects.superalgos.spaces.designSpace.workspace.getHierarchyHeadsByNodeType('Pools')
|
||||
function calculate(
|
||||
pools,
|
||||
features,
|
||||
assets,
|
||||
positions,
|
||||
userProfiles
|
||||
) {
|
||||
/* Reset Votes at Pools */
|
||||
for (let i = 0; i < pools.length; i++) {
|
||||
let poolsNode = pools[i]
|
||||
resetVotes(poolsNode)
|
||||
}
|
||||
|
||||
let features = UI.projects.superalgos.spaces.designSpace.workspace.getHierarchyHeadsByNodeType('Features')
|
||||
/* Reset Votes at Features */
|
||||
for (let i = 0; i < features.length; i++) {
|
||||
let feature = features[i]
|
||||
resetVotes(feature)
|
||||
}
|
||||
|
||||
let assets = UI.projects.superalgos.spaces.designSpace.workspace.getHierarchyHeadsByNodeType('Assets')
|
||||
/* Reset Votes at Features */
|
||||
for (let i = 0; i < assets.length; i++) {
|
||||
let asset = assets[i]
|
||||
resetVotes(asset)
|
||||
}
|
||||
|
||||
let positions = UI.projects.superalgos.spaces.designSpace.workspace.getHierarchyHeadsByNodeType('Positions')
|
||||
/* Reset Votes at Features */
|
||||
for (let i = 0; i < positions.length; i++) {
|
||||
let position = positions[i]
|
||||
resetVotes(position)
|
||||
}
|
||||
|
||||
let userProfiles = UI.projects.superalgos.spaces.designSpace.workspace.getHierarchyHeadsByNodeType('User Profile')
|
||||
/*
|
||||
We will first reset all the voting power, and then distribute it.
|
||||
*/
|
||||
@@ -129,7 +129,7 @@ function newGovernanceFunctionLibraryVotes() {
|
||||
node.type === 'Pool' ||
|
||||
node.type === 'Position Contribution Claim' ||
|
||||
node.type === 'Asset Contribution Claim' ||
|
||||
node.type === 'Feature Contribution Claim'
|
||||
node.type === 'Feature Contribution Claim'
|
||||
) { return }
|
||||
/*
|
||||
If there is a reference parent defined, this means that the voting power is
|
||||
|
||||
@@ -5,7 +5,39 @@ function newGovernanceFunctionLibraryWeights() {
|
||||
|
||||
return thisObject
|
||||
|
||||
function calculate(node) {
|
||||
function calculate(
|
||||
pools,
|
||||
features,
|
||||
assets,
|
||||
positions
|
||||
) {
|
||||
/* Weight Calculation Follows */
|
||||
for (let i = 0; i < assets.length; i++) {
|
||||
let asset = assets[i]
|
||||
calculateForNode(asset)
|
||||
}
|
||||
|
||||
/* Weight Calculation Follows */
|
||||
for (let i = 0; i < features.length; i++) {
|
||||
let feature = features[i]
|
||||
calculateForNode(feature)
|
||||
}
|
||||
|
||||
/* Weight Calculation Follows */
|
||||
for (let i = 0; i < positions.length; i++) {
|
||||
let position = positions[i]
|
||||
calculateForNode(position)
|
||||
}
|
||||
|
||||
/* Weight Calculation Follows */
|
||||
for (let i = 0; i < pools.length; i++) {
|
||||
let poolsNode = pools[i]
|
||||
calculateForNode(poolsNode)
|
||||
}
|
||||
}
|
||||
|
||||
function calculateForNode(node) {
|
||||
|
||||
let totalVotes = 0
|
||||
countVotesAndResetWeights(node)
|
||||
applyWeightCalculation(node)
|
||||
|
||||
@@ -26,14 +26,6 @@ function newGobernanceAssetsSpace() {
|
||||
|
||||
function physics() {
|
||||
if (UI.projects.superalgos.spaces.designSpace.workspace === undefined) { return }
|
||||
|
||||
let assets = UI.projects.superalgos.spaces.designSpace.workspace.getHierarchyHeadsByNodeType('Assets')
|
||||
|
||||
/* Weight Calculation Follows */
|
||||
for (let i = 0; i < assets.length; i++) {
|
||||
let asset = assets[i]
|
||||
UI.projects.governance.functionLibraries.weights.calculate(asset)
|
||||
}
|
||||
}
|
||||
|
||||
function getContainer(point) {
|
||||
|
||||
@@ -26,14 +26,6 @@ function newGovernanceFeaturesSpace() {
|
||||
|
||||
function physics() {
|
||||
if (UI.projects.superalgos.spaces.designSpace.workspace === undefined) { return }
|
||||
|
||||
let features = UI.projects.superalgos.spaces.designSpace.workspace.getHierarchyHeadsByNodeType('Features')
|
||||
|
||||
/* Weight Calculation Follows */
|
||||
for (let i = 0; i < features.length; i++) {
|
||||
let feature = features[i]
|
||||
UI.projects.governance.functionLibraries.weights.calculate(feature)
|
||||
}
|
||||
}
|
||||
|
||||
function getContainer(point) {
|
||||
|
||||
@@ -37,7 +37,7 @@ function newGovernancePoolsSpace() {
|
||||
function physics() {
|
||||
if (UI.projects.superalgos.spaces.designSpace.workspace === undefined) { return }
|
||||
|
||||
UI.projects.governance.functionLibraries.tokens.calculate()
|
||||
UI.projects.governance.functionLibraries.distributionProcess.calculate()
|
||||
}
|
||||
|
||||
function draw() {
|
||||
|
||||
@@ -28,14 +28,6 @@ function newGovernancePositionsSpace() {
|
||||
|
||||
function physics() {
|
||||
if (UI.projects.superalgos.spaces.designSpace.workspace === undefined) { return }
|
||||
|
||||
let positions = UI.projects.superalgos.spaces.designSpace.workspace.getHierarchyHeadsByNodeType('Positions')
|
||||
|
||||
/* Weight Calculation Follows */
|
||||
for (let i = 0; i < positions.length; i++) {
|
||||
let position = positions[i]
|
||||
UI.projects.governance.functionLibraries.weights.calculate(position)
|
||||
}
|
||||
}
|
||||
|
||||
function getContainer(point) {
|
||||
|
||||
@@ -37,7 +37,7 @@ function newGovernanceUserProfileSpace() {
|
||||
function physics() {
|
||||
if (UI.projects.superalgos.spaces.designSpace.workspace === undefined) { return }
|
||||
|
||||
UI.projects.governance.functionLibraries.votes.calculate()
|
||||
|
||||
}
|
||||
|
||||
function draw() {
|
||||
|
||||
Reference in new issue
Block a user