Merge pull request #1216 from Luis-Fernando-Molina/develop

Contribution: Decendent Program
This commit is contained in:
Luis Fernando Molina authored and GitHub committed 2021-06-24 06:31:55 -04:00
commit 3157df712b
19 files changed
+1313 -1002

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

+83 -357
View File
@@ -358,282 +358,8 @@
"id": "85dbdcb9-5b59-432e-86a0-fab37e20a55d",
"savedPayload": {
"position": {
"x": 25177.355469747014,
"y": 30553.475971410026
},
"targetPosition": {
"x": 24990.308529189395,
"y": 30318.926526669617
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": true,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
{
"type": "Pool Class",
"name": "Community",
"config": "{}",
"project": "Governance",
"poolClasses": [
{
"type": "Pool Class",
"name": "Users",
"config": "{}",
"project": "Governance",
"poolClasses": [],
"pools": [
{
"type": "Pool",
"name": "Mentorship Program",
"config": "{\n \"codeName\": \"Mentorship-Program\"\n}",
"project": "Governance",
"poolClasses": [],
"pools": [],
"id": "60712b3c-ee76-40ba-8de2-e03aa61f6dde",
"savedPayload": {
"position": {
"x": 25375.64024561165,
"y": 30932.178440279546
},
"targetPosition": {
"x": 25083.1618719571,
"y": 30865.42216009265
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
{
"type": "Pool",
"name": "Referral Program",
"config": "{\n \"codeName\": \"Referral-Program\"\n}",
"project": "Governance",
"poolClasses": [],
"pools": [],
"id": "639a6504-a0d0-4d7e-ad99-80ba5115ac72",
"savedPayload": {
"position": {
"x": 25242.771494911703,
"y": 31119.439419861137
},
"targetPosition": {
"x": 25083.1618719571,
"y": 30865.42216009265
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
{
"type": "Pool",
"name": "Support-Program",
"config": "{\n\"codeName\": \"Support-Program\"\n}",
"project": "Governance",
"poolClasses": [],
"pools": [],
"id": "18fa6e35-77df-4446-87a9-9d3e6b83eb05",
"savedPayload": {
"position": {
"x": 25016.405591770206,
"y": 31157.900533747197
},
"targetPosition": {
"x": 25083.1618719571,
"y": 30865.42216009265
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
}
],
"id": "9b6c24b9-e21d-458b-b509-1828d40b4239",
"savedPayload": {
"position": {
"x": 25083.1618719571,
"y": 30865.42216009265
},
"targetPosition": {
"x": 24923.5522490025,
"y": 30611.404900324163
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
{
"type": "Pool Class",
"name": "Contributors",
"config": "{}",
"project": "Governance",
"poolClasses": [],
"pools": [
{
"type": "Pool",
"name": "Badges",
"config": "{}",
"project": "Governance",
"poolClasses": [],
"pools": [],
"id": "6b11cf29-2957-417d-a268-3569178eca9e",
"savedPayload": {
"position": {
"x": 24790.03968862871,
"y": 31196.361647633257
},
"targetPosition": {
"x": 24856.795968815604,
"y": 30903.88327397871
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
}
],
"id": "e2113b73-9a38-4c59-8fbe-95a7539379c5",
"savedPayload": {
"position": {
"x": 24856.795968815604,
"y": 30903.88327397871
},
"targetPosition": {
"x": 24923.5522490025,
"y": 30611.404900324163
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
{
"type": "Pool Class",
"name": "Token Holders",
"config": "{}",
"project": "Governance",
"poolClasses": [],
"pools": [
{
"type": "Pool",
"name": "Stacking-Program",
"config": "{\n \"codeName\": \"Staking-Program\"\n}",
"project": "Governance",
"poolClasses": [],
"pools": [],
"id": "ea79efd3-c3d9-4c80-a1d0-1cab106e0242",
"savedPayload": {
"position": {
"x": 24415.517729465526,
"y": 30930.624146233367
},
"targetPosition": {
"x": 24669.534989234013,
"y": 30771.014523278765
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
}
],
"id": "c7cd91a3-96b0-4115-aaaa-fddae1c1b246",
"savedPayload": {
"position": {
"x": 24669.534989234013,
"y": 30771.014523278765
},
"targetPosition": {
"x": 24923.5522490025,
"y": 30611.404900324163
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
}
],
"pools": [],
"id": "ae18dd6f-80f7-4fa0-a386-7ffd75e45063",
"savedPayload": {
"position": {
"x": 24923.5522490025,
"y": 30611.404900324163
"x": 25140.308529189395,
"y": 30578.73414780495
},
"targetPosition": {
"x": 24990.308529189395,
@@ -1077,8 +803,8 @@
"id": "86787666-908c-4b27-8265-cd460732030f",
"savedPayload": {
"position": {
"x": 24720.017868818668,
"y": 30449.091648404883
"x": 24840.308529189395,
"y": 30578.73414780495
},
"targetPosition": {
"x": 24990.308529189395,
@@ -1143,8 +869,8 @@
"id": "a2acb2b1-c88f-47f2-b31b-b0cde52801ac",
"savedPayload": {
"position": {
"x": 24720.017868818668,
"y": 30188.76140493435
"x": 24690.308529189395,
"y": 30318.926526669617
},
"targetPosition": {
"x": 24990.308529189395,
@@ -1209,8 +935,8 @@
"id": "8c3175a1-17aa-4e27-bcbe-063468ecc87e",
"savedPayload": {
"position": {
"x": 24923.5522490025,
"y": 30026.44815301507
"x": 24840.308529189395,
"y": 30059.118905534284
},
"targetPosition": {
"x": 24990.308529189395,
@@ -1252,12 +978,12 @@
"id": "2e9dff69-e407-4ccb-9a42-e4a476e28d7c",
"savedPayload": {
"position": {
"x": 24824.11148680688,
"y": 29605.748481395745
"x": 24719.674098399406,
"y": 29638.484474744295
},
"targetPosition": {
"x": 25032.23980361544,
"y": 29821.810055356582
"x": 24957.680100486778,
"y": 29821.112903446912
},
"floatingObject": {
"isPinned": false,
@@ -1274,20 +1000,20 @@
},
{
"type": "Pool",
"name": "Referrals Participation Bonus",
"config": "{\n \"codeName\": \"Referrals-Participation-Bonus\"\n}",
"name": "Referrals Bonus",
"config": "{\n \"codeName\": \"Referrals-Bonus\"\n}",
"project": "Governance",
"poolClasses": [],
"pools": [],
"id": "af1984a3-465b-48ed-9944-c101a8ed376c",
"savedPayload": {
"position": {
"x": 24922.63749630552,
"y": 29542.54793076332
"x": 24807.680100486778,
"y": 29561.30528231158
},
"targetPosition": {
"x": 25032.23980361544,
"y": 29821.810055356582
"x": 24957.680100486778,
"y": 29821.112903446912
},
"floatingObject": {
"isPinned": false,
@@ -1306,12 +1032,12 @@
"id": "9f94d0e0-ddf7-4e04-8a3c-9485c09e079d",
"savedPayload": {
"position": {
"x": 25032.23980361544,
"y": 29821.810055356582
"x": 24957.680100486778,
"y": 29821.112903446912
},
"targetPosition": {
"x": 25177.355469747014,
"y": 30084.377081929208
"x": 25140.308529189395,
"y": 30059.118905534284
},
"floatingObject": {
"isPinned": false,
@@ -1343,12 +1069,12 @@
"id": "c41497c5-7440-4ebd-aabb-fbc3d022136b",
"savedPayload": {
"position": {
"x": 25034.1638196061,
"y": 29507.001294367976
"x": 24912.662815658638,
"y": 29509.53353651223
},
"targetPosition": {
"x": 25143.76612691602,
"y": 29786.263418961236
"x": 25062.662815658638,
"y": 29769.341157647563
},
"floatingObject": {
"isPinned": false,
@@ -1365,20 +1091,20 @@
},
{
"type": "Pool",
"name": "Support Participation Bonus",
"config": "{\n \"codeName\": \"Support-Participation-Bonus\"\n}",
"name": "Support Bonus",
"config": "{\n \"codeName\": \"Support-Bonus\"\n}",
"project": "Governance",
"poolClasses": [],
"pools": [],
"id": "6625953a-6026-4686-9091-2796fd08b9a7",
"savedPayload": {
"position": {
"x": 25149.375786845292,
"y": 29486.315870687413
"x": 25023.504957992624,
"y": 29471.90769923542
},
"targetPosition": {
"x": 25143.76612691602,
"y": 29786.263418961236
"x": 25062.662815658638,
"y": 29769.341157647563
},
"floatingObject": {
"isPinned": false,
@@ -1397,12 +1123,12 @@
"id": "174e7d3b-fe3c-4fb1-825c-4ea488d82171",
"savedPayload": {
"position": {
"x": 25143.76612691602,
"y": 29786.263418961236
"x": 25062.662815658638,
"y": 29769.341157647563
},
"targetPosition": {
"x": 25177.355469747014,
"y": 30084.377081929208
"x": 25140.308529189395,
"y": 30059.118905534284
},
"floatingObject": {
"isPinned": false,
@@ -1434,12 +1160,12 @@
"id": "53ddcc36-f693-4193-8284-999a88f1c944",
"savedPayload": {
"position": {
"x": 25266.01578310374,
"y": 29496.154337071854
"x": 25140.308529189395,
"y": 29464.25198871
},
"targetPosition": {
"x": 25260.406123174467,
"y": 29796.101885345677
"x": 25179.46638685541,
"y": 29761.68544712214
},
"floatingObject": {
"isPinned": false,
@@ -1457,19 +1183,19 @@
{
"type": "Pool",
"name": "Mentorship Participation Bonus",
"config": "{\n \"codeName\": \"Mentorship-Participation-Bonus\"\n}",
"config": "{\n \"codeName\": \"Mentorship-Bonus\"\n}",
"project": "Governance",
"poolClasses": [],
"pools": [],
"id": "ff1e4a84-3363-4348-ad15-31a34898fa82",
"savedPayload": {
"position": {
"x": 25380.37373047039,
"y": 29521.133208584684
"x": 25257.112100386166,
"y": 29471.90769923542
},
"targetPosition": {
"x": 25260.406123174467,
"y": 29796.101885345677
"x": 25179.46638685541,
"y": 29761.68544712214
},
"floatingObject": {
"isPinned": false,
@@ -1488,12 +1214,12 @@
"id": "8b3714a0-3bf2-491e-8ffc-9c4286446382",
"savedPayload": {
"position": {
"x": 25260.406123174467,
"y": 29796.101885345677
"x": 25179.46638685541,
"y": 29761.68544712214
},
"targetPosition": {
"x": 25177.355469747014,
"y": 30084.377081929208
"x": 25140.308529189395,
"y": 30059.118905534284
},
"floatingObject": {
"isPinned": false,
@@ -1518,12 +1244,12 @@
"id": "5bd09ac2-6c9f-4a7d-a547-c05a8a1e98e2",
"savedPayload": {
"position": {
"x": 25364.402410304632,
"y": 29849.8276371888
"x": 25290.308529189395,
"y": 29799.31128439895
},
"targetPosition": {
"x": 25177.355469747014,
"y": 30084.377081929208
"x": 25140.308529189395,
"y": 30059.118905534284
},
"floatingObject": {
"isPinned": false,
@@ -1547,20 +1273,20 @@
"pools": [
{
"type": "Pool",
"name": "Voting Participation Bonus",
"config": "{\n \"codeName\": \"Voting-Participation-Bonus\"\n}",
"name": "Voting Bonus",
"config": "{\n \"codeName\": \"Voting-Bonus\"\n}",
"project": "Governance",
"poolClasses": [],
"pools": [],
"id": "9eb846a4-effb-4380-9487-1a82011b0488",
"savedPayload": {
"position": {
"x": 25702.489522892265,
"y": 29794.145749666062
"x": 25616.320533364138,
"y": 29693.86204812905
},
"targetPosition": {
"x": 25439.92249631964,
"y": 29939.261415797635
"x": 25378.314531276767,
"y": 29876.490476831666
},
"floatingObject": {
"isPinned": false,
@@ -1579,12 +1305,12 @@
"id": "80d4f08f-bb7f-48a2-9cef-be12befcac2e",
"savedPayload": {
"position": {
"x": 25439.92249631964,
"y": 29939.261415797635
"x": 25378.314531276767,
"y": 29876.490476831666
},
"targetPosition": {
"x": 25177.355469747014,
"y": 30084.377081929208
"x": 25140.308529189395,
"y": 30059.118905534284
},
"floatingObject": {
"isPinned": false,
@@ -1608,20 +1334,20 @@
"pools": [
{
"type": "Pool",
"name": "Liquid Democracy Participation Bonus",
"config": "{\n \"codeName\": \"Liquid-Democracy-Participation-Bonus\"\n}",
"name": "Liquid Democracy Bonus",
"config": "{\n \"codeName\": \"Liquid-Democracy-Bonus\"\n}",
"project": "Governance",
"poolClasses": [],
"pools": [],
"id": "24e62dd3-4d7b-4eba-b401-493c155d85d0",
"savedPayload": {
"position": {
"x": 25773.582795682956,
"y": 30017.19839626722
"x": 25719.864024962837,
"y": 29903.82747847277
},
"targetPosition": {
"x": 25475.469132714985,
"y": 30050.787739098214
"x": 25430.086277076116,
"y": 29981.473192003526
},
"floatingObject": {
"isPinned": false,
@@ -1640,12 +1366,12 @@
"id": "f09429a2-3f6c-4210-bb73-0c8efd254c82",
"savedPayload": {
"position": {
"x": 25475.469132714985,
"y": 30050.787739098214
"x": 25430.086277076116,
"y": 29981.473192003526
},
"targetPosition": {
"x": 25177.355469747014,
"y": 30084.377081929208
"x": 25140.308529189395,
"y": 30059.118905534284
},
"floatingObject": {
"isPinned": false,
@@ -1677,12 +1403,12 @@
"id": "d2cf4c65-b4bd-4fa8-b0da-f73a38b8419a",
"savedPayload": {
"position": {
"x": 25753.905862914075,
"y": 30250.478388784115
"x": 25735.17544601368,
"y": 30137.434620866312
},
"targetPosition": {
"x": 25465.630666330544,
"y": 30167.42773535666
"x": 25437.741987601537,
"y": 30098.276763200298
},
"floatingObject": {
"isPinned": false,
@@ -1701,12 +1427,12 @@
"id": "68e3f570-4156-4be6-8881-c526a06f85d0",
"savedPayload": {
"position": {
"x": 25465.630666330544,
"y": 30167.42773535666
"x": 25437.741987601537,
"y": 30098.276763200298
},
"targetPosition": {
"x": 25177.355469747014,
"y": 30084.377081929208
"x": 25140.308529189395,
"y": 30059.118905534284
},
"floatingObject": {
"isPinned": false,
@@ -1726,8 +1452,8 @@
"id": "4fbb05ee-d7a0-43a7-9983-9fae7a7e4848",
"savedPayload": {
"position": {
"x": 25177.355469747014,
"y": 30084.377081929208
"x": 25140.308529189395,
"y": 30059.118905534284
},
"targetPosition": {
"x": 24990.308529189395,
File diff suppressed because it is too large. Load diff
@@ -24,6 +24,15 @@
"label": "Add Tokens Awarded",
"relatedUiObject": "Tokens Awarded"
},
{
"action": "Add UI Object",
"actionProject": "Foundations",
"disableIfPropertyIsDefined": true,
"propertyToCheckFor": "tokensBonus",
"actionFunction": "payload.executeAction",
"label": "Add Tokens Bonus",
"relatedUiObject": "Tokens Bonus"
},
{
"action": "Delete UI Object",
"actionProject": "Foundations",
@@ -59,6 +68,12 @@
"type": "node",
"childType": "Tokens Awarded",
"autoAdd": true
},
{
"name": "tokensBonus",
"type": "node",
"childType": "Tokens Bonus",
"autoAdd": true
}
]
}
@@ -24,6 +24,15 @@
"label": "Add Tokens Awarded",
"relatedUiObject": "Tokens Awarded"
},
{
"action": "Add UI Object",
"actionProject": "Foundations",
"disableIfPropertyIsDefined": true,
"propertyToCheckFor": "tokensBonus",
"actionFunction": "payload.executeAction",
"label": "Add Tokens Bonus",
"relatedUiObject": "Tokens Bonus"
},
{
"action": "Delete UI Object",
"actionProject": "Foundations",
@@ -59,6 +68,12 @@
"type": "node",
"childType": "Tokens Awarded",
"autoAdd": true
},
{
"name": "tokensBonus",
"type": "node",
"childType": "Tokens Bonus",
"autoAdd": true
}
]
}
@@ -24,6 +24,15 @@
"label": "Add Tokens Awarded",
"relatedUiObject": "Tokens Awarded"
},
{
"action": "Add UI Object",
"actionProject": "Foundations",
"disableIfPropertyIsDefined": true,
"propertyToCheckFor": "tokensBonus",
"actionFunction": "payload.executeAction",
"label": "Add Tokens Bonus",
"relatedUiObject": "Tokens Bonus"
},
{
"action": "Delete UI Object",
"actionProject": "Foundations",
@@ -59,6 +68,12 @@
"type": "node",
"childType": "Tokens Awarded",
"autoAdd": true
},
{
"name": "tokensBonus",
"type": "node",
"childType": "Tokens Bonus",
"autoAdd": true
}
]
}
@@ -15,7 +15,7 @@
"addLeftIcons": true,
"level": 2,
"attachingRules": {
"compatibleTypes": "->Referral Program->Mentorship Program->Support Program->Voting Program->Claims Program->Staking Program->"
"compatibleTypes": "->Referral Program->Mentorship Program->Support Program->Claims Program->Staking Program->"
},
"propertyNameAtParent": "tokensAwarded"
}
@@ -0,0 +1,21 @@
{
"type": "Tokens Bonus",
"menuItems": [
{
"action": "Delete UI Object",
"actionProject": "Foundations",
"askConfirmation": true,
"confirmationLabel": "Confirm to Delete",
"label": "Delete",
"iconPathOn": "delete-entity",
"iconPathOff": "delete-entity",
"actionFunction": "payload.executeAction"
}
],
"addLeftIcons": true,
"level": 2,
"attachingRules": {
"compatibleTypes": "->Referral Program->Mentorship Program->Support Program->Voting Program->"
},
"propertyNameAtParent": "tokensBonus"
}
@@ -19,10 +19,10 @@
"action": "Add UI Object",
"actionProject": "Foundations",
"disableIfPropertyIsDefined": true,
"propertyToCheckFor": "tokensAwarded",
"propertyToCheckFor": "tokensBonus",
"actionFunction": "payload.executeAction",
"label": "Add Tokens Awarded",
"relatedUiObject": "Tokens Awarded"
"label": "Add Tokens Bonus",
"relatedUiObject": "Tokens Bonus"
},
{
"action": "Delete UI Object",
@@ -55,9 +55,9 @@
"autoAdd": false
},
{
"name": "tokensAwarded",
"name": "tokensBonus",
"type": "node",
"childType": "Tokens Awarded",
"childType": "Tokens Bonus",
"autoAdd": true
}
]
@@ -457,9 +457,9 @@ function newGovernanceFunctionLibraryClaimsProgram() {
const tokensAwardedText = parseFloat(node.payload.claimsProgram.awarded.tokens.toFixed(2)).toLocaleString('en')
node.tokensAwarded.payload.uiObject.valueAngleOffset = 0
node.tokensAwarded.payload.uiObject.valueAtAngle = false
node.tokensAwarded.payload.uiObject.valueAtAngle = true
node.tokensAwarded.payload.uiObject.statusAngleOffset = 0
node.tokensAwarded.payload.uiObject.statusAtAngle = false
node.tokensAwarded.payload.uiObject.statusAtAngle = true
node.tokensAwarded.payload.uiObject.setValue(tokensAwardedText + ' SA Tokens')
node.tokensAwarded.payload.uiObject.setStatus('From ' + node.payload.claimsProgram.count + ' Claims.')
@@ -9,11 +9,19 @@ function newGovernanceFunctionLibraryMentorshipProgram() {
pools,
userProfiles
) {
UI.projects.governance.utilities.mandatoryProgram.run(
UI.projects.governance.utilities.bonusProgram.run(
pools,
userProfiles,
"mentorshipProgram",
"Mentorship-Program",
"Mentorship-Bonus"
)
UI.projects.governance.utilities.decendentProgram.run(
pools,
userProfiles,
"mentorshipProgram",
"Mentorship-Rewards",
"Mentorship Program",
"Mentorship Power",
"userMentors",
@@ -9,11 +9,19 @@ function newGovernanceFunctionLibraryReferralProgram() {
pools,
userProfiles
) {
UI.projects.governance.utilities.mandatoryProgram.run(
UI.projects.governance.utilities.bonusProgram.run(
pools,
userProfiles,
"referralProgram",
"Referral-Program",
"Referrals-Bonus"
)
UI.projects.governance.utilities.decendentProgram.run(
pools,
userProfiles,
"referralProgram",
"Referrals-Rewards",
"Referral Program",
"Referral Power",
"userReferrers",
@@ -20,7 +20,7 @@ function newGovernanceFunctionLibraryStackingProgram() {
/* Scan Pools Until finding the Mentoship-Program Pool */
for (let i = 0; i < pools.length; i++) {
let poolsNode = pools[i]
programPoolTokenReward = UI.projects.governance.utilities.pools.findPool(poolsNode, "Staking-Program")
programPoolTokenReward = UI.projects.governance.utilities.pools.findPool(poolsNode, "Staking-Rewards")
}
if (programPoolTokenReward === undefined || programPoolTokenReward === 0) { return }
@@ -92,26 +92,7 @@ function newGovernanceFunctionLibraryStackingProgram() {
node.payload.parentNode.payload.parentNode.payload.uiObject.setErrorMessage("You need to setup this profile with the Profile Constructor, to access the Token Power of your account at the Blockchain.")
return
}
/*
The Staking Program is activated, only when then Mandatory Programs are active.
*/
if (
node.payload.parentNode.payload.parentNode.tokenPowerSwitch !== undefined &&
node.payload.parentNode.payload.parentNode.tokenPowerSwitch.referralProgram !== undefined &&
node.payload.parentNode.payload.parentNode.tokenPowerSwitch.mentorshipProgram !== undefined &&
node.payload.parentNode.payload.parentNode.tokenPowerSwitch.supportProgram !== undefined &&
node.payload.parentNode.payload.parentNode.tokenPowerSwitch.referralProgram.payload.referralProgram !== undefined &&
node.payload.parentNode.payload.parentNode.tokenPowerSwitch.mentorshipProgram.payload.mentorshipProgram !== undefined &&
node.payload.parentNode.payload.parentNode.tokenPowerSwitch.supportProgram.payload.supportProgram !== undefined &&
node.payload.parentNode.payload.parentNode.tokenPowerSwitch.referralProgram.payload.referralProgram.isActive === true &&
node.payload.parentNode.payload.parentNode.tokenPowerSwitch.mentorshipProgram.payload.mentorshipProgram.isActive === true &&
node.payload.parentNode.payload.parentNode.tokenPowerSwitch.supportProgram.payload.supportProgram.isActive === true
) {
node.payload.stackingProgram.isActive = true
} else {
node.payload.stackingProgram.isActive = false
node.payload.uiObject.setErrorMessage("This Program will be activated once you activate the Referral, Support and Mentorship Programs.")
}
node.payload.stackingProgram.isActive = true
}
function distributeProgram(programNode) {
@@ -155,7 +136,7 @@ function newGovernanceFunctionLibraryStackingProgram() {
function drawProgram(node) {
if (node.payload !== undefined) {
const ownPowerText = parseFloat(node.payload.stackingProgram.ownPower.toFixed(2)).toLocaleString('en')
const ownPowerText = parseFloat(node.payload.stackingProgram.ownPower.toFixed(2)).toLocaleString('en')
node.payload.uiObject.statusAngleOffset = 0
node.payload.uiObject.statusAtAngle = false
@@ -164,7 +145,7 @@ function newGovernanceFunctionLibraryStackingProgram() {
}
if (node.tokensAwarded !== undefined && node.tokensAwarded.payload !== undefined) {
const tokensAwardedText = parseFloat(node.payload.stackingProgram.awarded.tokens.toFixed(2)).toLocaleString('en')
const tokensAwardedText = parseFloat(node.payload.stackingProgram.awarded.tokens.toFixed(2)).toLocaleString('en')
node.tokensAwarded.payload.uiObject.valueAngleOffset = 0
node.tokensAwarded.payload.uiObject.valueAtAngle = false
@@ -9,11 +9,19 @@ function newGovernanceFunctionLibrarySupportProgram() {
pools,
userProfiles
) {
UI.projects.governance.utilities.mandatoryProgram.run(
UI.projects.governance.utilities.bonusProgram.run(
pools,
userProfiles,
"supportProgram",
"Support-Program",
"Support-Bonus"
)
UI.projects.governance.utilities.decendentProgram.run(
pools,
userProfiles,
"supportProgram",
"Support-Rewards",
"Support Program",
"Support Power",
"userSupporters",
@@ -210,22 +210,7 @@ function newGovernanceFunctionLibraryTokenPower() {
}
function getPercentage(node) {
/*
There are some system wide rules regarfing mandatory percentages,
we will apply them now.
*/
switch (node.type) {
case 'Referral Program': {
return 20
}
case 'Mentorship Program': {
return 10
}
case 'Support Program': {
return 10
}
default: return UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(node.payload, 'percentage')
}
return UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(node.payload, 'percentage')
}
function drawTokenPower(node, tokenPower, percentage) {
@@ -13,6 +13,15 @@ function newGovernanceFunctionLibraryVotingProgram() {
positions,
userProfiles
) {
/* Bonus Calculation is here */
UI.projects.governance.utilities.bonusProgram.run(
pools,
userProfiles,
"votingProgram",
"Voting-Bonus"
)
/* Reset Votes at Pools */
for (let i = 0; i < pools.length; i++) {
let poolsNode = pools[i]
@@ -337,15 +346,6 @@ function newGovernanceFunctionLibraryVotingProgram() {
node.payload.uiObject.setStatus(ownPowerText + ' Voting Power')
}
if (node.tokensAwarded !== undefined && node.tokensAwarded.payload !== undefined) {
const tokensAwardedText = parseFloat(node.payload.votingProgram.awarded.tokens.toFixed(2)).toLocaleString('en')
node.tokensAwarded.payload.uiObject.valueAngleOffset = 0
node.tokensAwarded.payload.uiObject.valueAtAngle = false
node.tokensAwarded.payload.uiObject.setValue(tokensAwardedText + ' SA Tokens')
}
}
}
}
@@ -0,0 +1,145 @@
function newFoundationsUtilitiesBonusProgram() {
let thisObject = {
run: run
}
return thisObject
function run(
pools,
userProfiles,
programPropertyName,
programCodeName
) {
let programPoolTokenReward
/*
In order to be able to calculate the share of the Program Pool for each User Profile,
we need to accumulate all the Participation Power that each User Profile at their Program
node has, because with that Power is that each Program node gets a share of the pool.
*/
let accumulatedProgramPower = 0
/* Scan Pools Until finding the Mentoship-Program Pool */
for (let i = 0; i < pools.length; i++) {
let poolsNode = pools[i]
programPoolTokenReward = UI.projects.governance.utilities.pools.findPool(poolsNode, programCodeName)
}
if (programPoolTokenReward === undefined || programPoolTokenReward === 0) { return }
for (let i = 0; i < userProfiles.length; i++) {
let userProfile = userProfiles[i]
if (userProfile.tokenPowerSwitch === undefined) { continue }
if (userProfile.tokenPowerSwitch[programPropertyName] === undefined) { continue }
if (userProfile.tokenPowerSwitch[programPropertyName].payload === undefined) { continue }
resetProgram(userProfile.tokenPowerSwitch[programPropertyName])
}
for (let i = 0; i < userProfiles.length; i++) {
let userProfile = userProfiles[i]
if (userProfile.tokenPowerSwitch === undefined) { continue }
if (userProfile.tokenPowerSwitch[programPropertyName] === undefined) { continue }
if (userProfile.tokenPowerSwitch[programPropertyName].payload === undefined) { continue }
validateProgram(userProfile.tokenPowerSwitch[programPropertyName])
}
for (let i = 0; i < userProfiles.length; i++) {
let userProfile = userProfiles[i]
if (userProfile.tokenPowerSwitch === undefined) { continue }
if (userProfile.tokenPowerSwitch[programPropertyName] === undefined) { continue }
if (userProfile.tokenPowerSwitch[programPropertyName].payload === undefined) { continue }
if (userProfile.tokenPowerSwitch[programPropertyName].payload[programPropertyName].isActive === false) { continue }
distributeProgram(userProfile.tokenPowerSwitch[programPropertyName])
}
for (let i = 0; i < userProfiles.length; i++) {
let userProfile = userProfiles[i]
if (userProfile.tokenPowerSwitch === undefined) { continue }
if (userProfile.tokenPowerSwitch[programPropertyName] === undefined) { continue }
if (userProfile.tokenPowerSwitch[programPropertyName].payload === undefined) { continue }
if (userProfile.tokenPowerSwitch[programPropertyName].payload[programPropertyName].isActive === false) { continue }
calculateProgram(userProfile.tokenPowerSwitch[programPropertyName])
}
function resetProgram(node) {
if (node === undefined) { return }
if (node.payload === undefined) { return }
node.payload[programPropertyName] = {
bonusPower: 0,
bonus: {
tokens: 0,
percentage: 0
}
}
}
function validateProgram(node) {
/*
This program is not going to run unless the Profile has Tokens, and for
that users needs to execute the setup procedure of signing their Github
username with their private key.
*/
if (
node.payload.parentNode.payload.parentNode.payload.blockchainTokens === undefined
) {
node.payload[programPropertyName].isActive = false
node.payload.parentNode.payload.parentNode.payload.uiObject.setErrorMessage("You need to setup this profile with the Profile Constructor, to access the Token Power of your account at the Blockchain.")
return
}
}
function distributeProgram(programNode) {
if (programNode === undefined || programNode.payload === undefined) { return }
/*
Here we will convert Token Power into Participation Power.
As per system rules Participation Powar = tokensPower
*/
let programPower = programNode.payload.tokenPower
programNode.payload[programPropertyName].bonusPower = programPower
accumulatedProgramPower = accumulatedProgramPower + programPower
}
function calculateProgram(programNode) {
/*
Here we will calculate which share of the Program Pool this user will get in tokens.
To do that, we use the bonusPower, to see which proportion of the accumulatedProgramPower
represents.
*/
if (programNode.payload === undefined) { return }
/*
If the accumulatedProgramPower is not grater the amount of tokens at the Program Pool, then
this user will get the exact amount of tokens from the pool as incomingPower he has.
If the accumulatedProgramPower is grater the amount of tokens at the Program Pool, then
the amount ot tokens to be received is a proportional to the share of incomingPower in accumulatedProgramPower.
*/
let totalPowerRewardRatio = accumulatedProgramPower / programPoolTokenReward
if (totalPowerRewardRatio < 1) { totalPowerRewardRatio = 1 }
if (programNode.tokensBonus === undefined || programNode.tokensBonus.payload === undefined) {
programNode.payload.uiObject.setErrorMessage("Tokens Bonus Node is needed in order for this Program to get Tokens from the Program Pool.")
return
}
programNode.payload[programPropertyName].bonus.tokens = programNode.payload[programPropertyName].bonusPower * totalPowerRewardRatio
drawProgram(programNode)
}
function drawProgram(node) {
if (node.tokensBonus !== undefined && node.tokensBonus.payload !== undefined) {
const tokensBonusText = parseFloat(node.payload[programPropertyName].bonus.tokens.toFixed(2)).toLocaleString('en')
node.tokensBonus.payload.uiObject.valueAngleOffset = 0
node.tokensBonus.payload.uiObject.valueAtAngle = true
node.tokensBonus.payload.uiObject.setValue(tokensBonusText + ' SA Tokens')
}
}
}
}
@@ -1,4 +1,4 @@
function newFoundationsUtilitiesMandatoryProgram() {
function newFoundationsUtilitiesDecendentProgram() {
let thisObject = {
run: run
}
@@ -9,7 +9,7 @@ function newFoundationsUtilitiesMandatoryProgram() {
pools,
userProfiles,
programPropertyName,
programName,
programCodeName,
programNodeType,
programPowerName,
usersArrayPropertyName,
@@ -18,7 +18,7 @@ function newFoundationsUtilitiesMandatoryProgram() {
/*
Here we will store the total amount of tokens that is going to be distributed among all participants
of the Program. This will come from a Pool that is configured wiht a codeName config property
with the value programName
with the value programCodeName
*/
let programPoolTokenReward
/*
@@ -32,7 +32,7 @@ function newFoundationsUtilitiesMandatoryProgram() {
/* Scan Pools Until finding the Mentoship-Program Pool */
for (let i = 0; i < pools.length; i++) {
let poolsNode = pools[i]
programPoolTokenReward = UI.projects.governance.utilities.pools.findPool(poolsNode, programName)
programPoolTokenReward = UI.projects.governance.utilities.pools.findPool(poolsNode, programCodeName)
}
if (programPoolTokenReward === undefined || programPoolTokenReward === 0) { return }
/*
@@ -329,7 +329,7 @@ function newFoundationsUtilitiesMandatoryProgram() {
node.payload.uiObject.setPercentage(percentage)
node.payload.uiObject.statusAngleOffset = 0
node.payload.uiObject.statusAtAngle = false
node.payload.uiObject.statusAtAngle = true
node.payload.uiObject.setStatus(outgoingPowerText + ' ' + ' Outgoing Power')
}
@@ -344,16 +344,16 @@ function newFoundationsUtilitiesMandatoryProgram() {
node.payload.uiObject.statusAngleOffset = 0
node.payload.uiObject.statusAtAngle = false
node.payload.uiObject.setStatus(ownPowerText + ' Own ' + programPowerName + ' - ' + incomingPowerText + ' Incoming ' + programPowerName + '')
node.payload.uiObject.setStatus(ownPowerText + ' Own Power' + ' - ' + incomingPowerText + ' Incoming Power' + '')
}
if (node.tokensAwarded !== undefined && node.tokensAwarded.payload !== undefined) {
const tokensAwardedText = parseFloat(node.payload[programPropertyName].awarded.tokens.toFixed(2)).toLocaleString('en')
node.tokensAwarded.payload.uiObject.statusAngleOffset = 0
node.tokensAwarded.payload.uiObject.statusAtAngle = false
node.tokensAwarded.payload.uiObject.statusAtAngle = true
node.tokensAwarded.payload.uiObject.valueAngleOffset = 0
node.tokensAwarded.payload.uiObject.valueAtAngle = false
node.tokensAwarded.payload.uiObject.valueAtAngle = true
node.tokensAwarded.payload.uiObject.setValue(tokensAwardedText + ' SA Tokens')
node.tokensAwarded.payload.uiObject.setStatus('From ' + node.payload[programPropertyName].count + ' Descendants.')
+8 -3
View File
@@ -1031,9 +1031,14 @@
"functionName": "newFoundationsUtilitiesPools"
},
{
"name": "Mandatory Program",
"propertyName": "mandatoryProgram",
"functionName": "newFoundationsUtilitiesMandatoryProgram"
"name": "Decendent Program",
"propertyName": "decendentProgram",
"functionName": "newFoundationsUtilitiesDecendentProgram"
},
{
"name": "Bonus Program",
"propertyName": "bonusProgram",
"functionName": "newFoundationsUtilitiesBonusProgram"
}
],
"spaces": [