Reorganization into plugins and dirrefent workspaces

This commit is contained in:
Luis Fernando Molina committed 2021-06-11 20:14:12 +02:00
1 parent 786df087d4
commit be7ef9fbd9
16 files changed
+72 -24

No files matched your search

@@ -99,6 +99,7 @@ function newGovernanceFunctionLibraryClaims() {
node.payload.votes !== undefined &&
node.payload.votes > 0 &&
node.payload.referenceParent !== undefined &&
node.payload.referenceParent.payload !== undefined &&
node.payload.referenceParent.payload.votes !== undefined &&
node.payload.referenceParent.payload.votes > 0 &&
node.payload.referenceParent.payload.weight !== undefined &&
@@ -152,6 +153,7 @@ function newGovernanceFunctionLibraryClaims() {
node.payload.votes !== undefined &&
node.payload.votes > 0 &&
node.payload.referenceParent !== undefined &&
node.payload.referenceParent.payload !== undefined &&
node.payload.referenceParent.payload.votes !== undefined &&
node.payload.referenceParent.payload.votes > 0 &&
node.payload.referenceParent.payload.weight !== undefined &&
@@ -26,8 +26,17 @@ function newGovernanceFunctionLibraryTokens() {
}
function poolsDistribute(pools) {
let tokens = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(pools.payload, 'tokens')
distributeTokens(pools, tokens)
if (pools.payload === undefined) { return }
let tokens = pools.payload.tokens
/* Check if this Pools has already been processed by it's reference child.*/
if (tokens !== undefined && tokens > 0) { return }
let confiTokens = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(pools.payload, 'tokens')
if (confiTokens !== undefined) {
tokens = confiTokens
distributeTokens(pools, tokens)
}
}
function resetTokenFlow(node) {
@@ -53,23 +53,32 @@ function newGovernanceFunctionLibraryVotes() {
if (node.payload === undefined) { return }
node.payload.votes = 0
/*
If there is a reference parent defined, this means that the voting power is
transfered to it and not distributed among children.
*/
if (node.payload.referenceParent !== undefined) {
resetVotes(node.payload.referenceParent)
return
}
/*
When we reach certain node types, we will halt the distribution, because thse are targets for
voting power.
*/
if (
node.type === 'Position' ||
node.type === 'Asset' ||
node.type === 'Feature'
node.type === 'Feature' ||
node.type === 'Pool' ||
node.type === 'Position Contribution Claim' ||
node.type === 'Asset Contribution Claim' ||
node.type === 'Feature Contribution Claim'
) { return }
/*
If there is a reference parent defined, this means that the voting power is
transfered to it and not distributed among children.
*/
if (
node.payload.referenceParent !== undefined &&
node.type !== 'Asset Class' &&
node.type !== 'Feature Class' &&
node.type !== 'Position Class'
) {
resetVotes(node.payload.referenceParent)
return
}
/*
If there is no reference parent we will redistribute voting power among children.
*/
let schemaDocument = getSchemaDocument(node)
@@ -131,7 +140,12 @@ function newGovernanceFunctionLibraryVotes() {
If there is a reference parent defined, this means that the voting power is
transfered to it and not distributed among children.
*/
if (node.payload.referenceParent !== undefined) {
if (
node.payload.referenceParent !== undefined &&
node.type !== 'Asset Class' &&
node.type !== 'Feature Class' &&
node.type !== 'Position Class'
) {
distributeVotes(node.payload.referenceParent, votes)
return
}
@@ -47,10 +47,18 @@ function newGovernanceFunctionLibraryWeights() {
if (node.payload === undefined) { return }
if (
node.type !== 'Pool Class' &&
node.type !== 'Asset Class' &&
node.type !== 'Feature Class' &&
node.type !== 'Position Class'
(node.type !== 'Pool Class' &&
node.type !== 'Asset Class' &&
node.type !== 'Feature Class' &&
node.type !== 'Position Class') ||
(
node.type === 'Asset Class' &&
node.payload.referenceParent !== undefined
) ||
(
node.type === 'Feature Class' &&
node.payload.referenceParent !== undefined
)
) {
if (node.payload.votes !== undefined) {
totalVotes = totalVotes + node.payload.votes
@@ -93,10 +101,18 @@ function newGovernanceFunctionLibraryWeights() {
if (node.payload === undefined) { return }
if (
node.type !== 'Pool Class' &&
node.type !== 'Asset Class' &&
node.type !== 'Feature Class' &&
node.type !== 'Position Class'
(node.type !== 'Pool Class' &&
node.type !== 'Asset Class' &&
node.type !== 'Feature Class' &&
node.type !== 'Position Class') ||
(
node.type === 'Asset Class' &&
node.payload.referenceParent !== undefined
) ||
(
node.type === 'Feature Class' &&
node.payload.referenceParent !== undefined
)
) {
if (node.payload.votes !== undefined) {
if (node.payload.votes !== undefined) {