Merge pull request #1182 from Luis-Fernando-Molina/develop
Contribution: Governance: Abstracting the mandatory Programs.
This commit is contained in:
24 files changed
+2222
-2248
No files matched your search
File renamed without changes.
File renamed without changes.
@@ -401,8 +401,8 @@
|
||||
"id": "60712b3c-ee76-40ba-8de2-e03aa61f6dde",
|
||||
"savedPayload": {
|
||||
"position": {
|
||||
"x": 25130.086277076116,
|
||||
"y": 31080.643930047634
|
||||
"x": 25177.761863855485,
|
||||
"y": 31018.51189569167
|
||||
},
|
||||
"targetPosition": {
|
||||
"x": 24917.954242720152,
|
||||
@@ -431,7 +431,7 @@
|
||||
"id": "639a6504-a0d0-4d7e-ad99-80ba5115ac72",
|
||||
"savedPayload": {
|
||||
"position": {
|
||||
"x": 24840.308529189395,
|
||||
"x": 24995.59995625091,
|
||||
"y": 31158.28964357839
|
||||
},
|
||||
"targetPosition": {
|
||||
@@ -450,6 +450,36 @@
|
||||
"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": 24767.954242720152,
|
||||
"y": 31128.319516827003
|
||||
},
|
||||
"targetPosition": {
|
||||
"x": 24917.954242720152,
|
||||
"y": 30868.51189569167
|
||||
},
|
||||
"floatingObject": {
|
||||
"isPinned": false,
|
||||
"isFrozen": false,
|
||||
"isCollapsed": false,
|
||||
"angleToParent": 2,
|
||||
"distanceToParent": 3,
|
||||
"arrangementStyle": 0
|
||||
},
|
||||
"uiObject": {
|
||||
"isRunning": false
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"id": "9b6c24b9-e21d-458b-b509-1828d40b4239",
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
"name": "Julian-Molina",
|
||||
"config": "{\n \"signature\": {\n \"message\": \"julian-molina\",\n \"messageHash\": \"0x34eae63163cc918a1a1fab82836b0f15e33051925812cf7d5f8ffe5ff0854f2c\",\n \"v\": \"0x1b\",\n \"r\": \"0x8560ff34239215408cb869d3c90c30ed11ab6634c4269b255d2b4159b7690fe5\",\n \"s\": \"0x017b2c5e080b0f340dcd09f8ba5c67119a3b62c375252d96f541c57db109a0b7\",\n \"signature\": \"0x8560ff34239215408cb869d3c90c30ed11ab6634c4269b255d2b4159b7690fe5017b2c5e080b0f340dcd09f8ba5c67119a3b62c375252d96f541c57db109a0b71b\"\n }\n}",
|
||||
"project": "Governance",
|
||||
"tokenSwitch": {
|
||||
"type": "Token Switch",
|
||||
"name": "New Token Switch",
|
||||
"tokenPowerSwitch": {
|
||||
"type": "Token Power Switch",
|
||||
"name": "New Token Power Switch",
|
||||
"config": "{}",
|
||||
"project": "Governance",
|
||||
"referralProgram": {
|
||||
@@ -13,37 +13,39 @@
|
||||
"name": "New Referral Program",
|
||||
"config": "{}",
|
||||
"project": "Governance",
|
||||
"userReferrer": {
|
||||
"type": "User Referrer",
|
||||
"name": "Jeremy",
|
||||
"config": "{}",
|
||||
"project": "Governance",
|
||||
"id": "0d0b04ff-034b-4b02-8351-67d621d514c0",
|
||||
"savedPayload": {
|
||||
"position": {
|
||||
"x": 25532.618466191747,
|
||||
"y": 23465.846712854385
|
||||
},
|
||||
"targetPosition": {
|
||||
"x": 25233.45732703739,
|
||||
"y": 23488.265740930314
|
||||
},
|
||||
"floatingObject": {
|
||||
"isPinned": false,
|
||||
"isFrozen": false,
|
||||
"isCollapsed": false,
|
||||
"angleToParent": 2,
|
||||
"distanceToParent": 3,
|
||||
"arrangementStyle": 0
|
||||
},
|
||||
"uiObject": {},
|
||||
"referenceParent": {
|
||||
"type": "User Profile",
|
||||
"name": "Jeremy",
|
||||
"id": "759e9012-c995-47ed-92f1-7d204bf2b58e"
|
||||
"userReferrers": [
|
||||
{
|
||||
"type": "User Referrer",
|
||||
"name": "Jeremy",
|
||||
"config": "{}",
|
||||
"project": "Governance",
|
||||
"id": "0aa9db01-7605-4a51-abd9-e233de6721d6",
|
||||
"savedPayload": {
|
||||
"position": {
|
||||
"x": 25532.618466191747,
|
||||
"y": 23465.846712854385
|
||||
},
|
||||
"targetPosition": {
|
||||
"x": 25233.45732703739,
|
||||
"y": 23488.265740930314
|
||||
},
|
||||
"floatingObject": {
|
||||
"isPinned": false,
|
||||
"isFrozen": false,
|
||||
"isCollapsed": false,
|
||||
"angleToParent": 2,
|
||||
"distanceToParent": 3,
|
||||
"arrangementStyle": 0
|
||||
},
|
||||
"uiObject": {},
|
||||
"referenceParent": {
|
||||
"type": "User Profile",
|
||||
"name": "Jeremy",
|
||||
"id": "759e9012-c995-47ed-92f1-7d204bf2b58e"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
],
|
||||
"tokensAwarded": {
|
||||
"type": "Tokens Awarded",
|
||||
"name": "New Tokens Awarded",
|
||||
@@ -106,12 +108,12 @@
|
||||
"id": "0e176a01-3ed2-4b02-b070-601236ea2393",
|
||||
"savedPayload": {
|
||||
"position": {
|
||||
"x": 25662.630264392985,
|
||||
"y": 23874.32824727054
|
||||
"x": 25429.475731817543,
|
||||
"y": 23702.252371245373
|
||||
},
|
||||
"targetPosition": {
|
||||
"x": 25243.737077503094,
|
||||
"y": 23709.924786305663
|
||||
"x": 25150.213607224283,
|
||||
"y": 23592.650063935456
|
||||
},
|
||||
"floatingObject": {
|
||||
"isPinned": false,
|
||||
@@ -137,12 +139,12 @@
|
||||
"id": "27f046ba-de7c-45a3-9086-d6f4e0ac0fd7",
|
||||
"savedPayload": {
|
||||
"position": {
|
||||
"x": 25310.806097282373,
|
||||
"y": 24154.89865810697
|
||||
"x": 25194.926287077134,
|
||||
"y": 23889.299311802995
|
||||
},
|
||||
"targetPosition": {
|
||||
"x": 25243.737077503094,
|
||||
"y": 23709.924786305663
|
||||
"x": 25150.213607224283,
|
||||
"y": 23592.650063935456
|
||||
},
|
||||
"floatingObject": {
|
||||
"isPinned": false,
|
||||
@@ -158,8 +160,8 @@
|
||||
"id": "362a1ecb-dce9-4ebb-9b00-a20d3631f2f3",
|
||||
"savedPayload": {
|
||||
"position": {
|
||||
"x": 25243.737077503094,
|
||||
"y": 23709.924786305663
|
||||
"x": 25150.213607224283,
|
||||
"y": 23592.650063935456
|
||||
},
|
||||
"targetPosition": {
|
||||
"x": 24963.166666666664,
|
||||
@@ -168,9 +170,9 @@
|
||||
"floatingObject": {
|
||||
"isPinned": false,
|
||||
"isFrozen": false,
|
||||
"isCollapsed": false,
|
||||
"isCollapsed": true,
|
||||
"angleToParent": 2,
|
||||
"distanceToParent": 4,
|
||||
"distanceToParent": 3,
|
||||
"arrangementStyle": 0
|
||||
},
|
||||
"uiObject": {
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -144,32 +144,6 @@
|
||||
"type": "Governance Project",
|
||||
"name": "New Governance Project",
|
||||
"project": "Governance",
|
||||
"projectDefinition": {
|
||||
"type": "Project Definition",
|
||||
"name": "Governance",
|
||||
"config": "{ \n \"codeName\": \"Governance\"\n}",
|
||||
"project": "Foundations",
|
||||
"id": "ba1aa656-d184-493a-b332-e4db109065f0",
|
||||
"savedPayload": {
|
||||
"position": {
|
||||
"x": 13832,
|
||||
"y": 10738.5
|
||||
},
|
||||
"targetPosition": {
|
||||
"x": 13532,
|
||||
"y": 10738.5
|
||||
},
|
||||
"floatingObject": {
|
||||
"isPinned": false,
|
||||
"isFrozen": false,
|
||||
"isCollapsed": false,
|
||||
"angleToParent": 1,
|
||||
"distanceToParent": 3,
|
||||
"arrangementStyle": 0
|
||||
},
|
||||
"uiObject": {}
|
||||
}
|
||||
},
|
||||
"id": "db380c52-cf90-475b-87df-c005dd51cdf6",
|
||||
"savedPayload": {
|
||||
"position": {
|
||||
@@ -193,66 +167,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Positions",
|
||||
"name": "Superalgos",
|
||||
"project": "Governance",
|
||||
"positionClasss": [],
|
||||
"positions": [
|
||||
{
|
||||
"type": "Position",
|
||||
"name": "Project Leader",
|
||||
"config": "{\n \"description\": \"\", \"relativeWeight\": 0 \n}",
|
||||
"project": "Governance",
|
||||
"positions": [],
|
||||
"positionClasss": [],
|
||||
"id": "5f694173-4568-46b2-a52c-4244320919f7",
|
||||
"savedPayload": {
|
||||
"position": {
|
||||
"x": 30231,
|
||||
"y": 38070
|
||||
},
|
||||
"targetPosition": {
|
||||
"x": 30231,
|
||||
"y": 37770
|
||||
},
|
||||
"floatingObject": {
|
||||
"isPinned": false,
|
||||
"isFrozen": false,
|
||||
"isCollapsed": false,
|
||||
"angleToParent": 2,
|
||||
"distanceToParent": 3,
|
||||
"arrangementStyle": 0
|
||||
},
|
||||
"uiObject": {
|
||||
"isRunning": false
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"id": "50c68665-5da2-48a8-b229-7a1563ae82d2",
|
||||
"savedPayload": {
|
||||
"position": {
|
||||
"x": 30231,
|
||||
"y": 37770
|
||||
},
|
||||
"targetPosition": {
|
||||
"x": 30231,
|
||||
"y": 37770
|
||||
},
|
||||
"floatingObject": {
|
||||
"isPinned": false,
|
||||
"isFrozen": false,
|
||||
"isCollapsed": true,
|
||||
"angleToParent": 1,
|
||||
"distanceToParent": 3,
|
||||
"arrangementStyle": 0
|
||||
},
|
||||
"uiObject": {
|
||||
"isRunning": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Docs Space",
|
||||
"name": "New Docs Space",
|
||||
@@ -892,9 +806,9 @@
|
||||
{
|
||||
"type": "Plugin File",
|
||||
"name": "Julian-Molina",
|
||||
"config": "{\"project\":\"Governance\",\"fileName\":\"Julian-Molina\"}",
|
||||
"config": "{\n \"project\": \"Governance\",\n \"fileName\": \"Julian-Molina\"\n}",
|
||||
"project": "Foundations",
|
||||
"id": "d13c2f5a-b48c-4c67-ae0a-c5c49c27868b",
|
||||
"id": "39cd9f98-5266-4eee-ace2-cad6db5b29e4",
|
||||
"savedPayload": {
|
||||
"position": {
|
||||
"x": 35306.95802911758,
|
||||
@@ -931,7 +845,7 @@
|
||||
"floatingObject": {
|
||||
"isPinned": false,
|
||||
"isFrozen": false,
|
||||
"isCollapsed": true,
|
||||
"isCollapsed": false,
|
||||
"angleToParent": 2,
|
||||
"distanceToParent": 3,
|
||||
"arrangementStyle": 0
|
||||
@@ -1246,7 +1160,7 @@
|
||||
"floatingObject": {
|
||||
"isPinned": false,
|
||||
"isFrozen": false,
|
||||
"isCollapsed": false,
|
||||
"isCollapsed": true,
|
||||
"angleToParent": 2,
|
||||
"distanceToParent": 3,
|
||||
"arrangementStyle": 0
|
||||
@@ -1284,7 +1198,36 @@
|
||||
"type": "Plugin Positions",
|
||||
"name": "New Plugin Positions",
|
||||
"project": "Governance",
|
||||
"pluginFiles": [],
|
||||
"pluginFiles": [
|
||||
{
|
||||
"type": "Plugin File",
|
||||
"name": "Superalgos",
|
||||
"config": "{\n \"project\": \"Governance\",\n \"fileName\": \"Superalgos\"\n}",
|
||||
"project": "Foundations",
|
||||
"id": "ccaa3acb-687b-4e61-8a15-251f5524ed13",
|
||||
"savedPayload": {
|
||||
"position": {
|
||||
"x": 35942.095312981444,
|
||||
"y": 9960.039006389541
|
||||
},
|
||||
"targetPosition": {
|
||||
"x": 35910.73677400115,
|
||||
"y": 10258.395575000022
|
||||
},
|
||||
"floatingObject": {
|
||||
"isPinned": false,
|
||||
"isFrozen": false,
|
||||
"isCollapsed": true,
|
||||
"angleToParent": 2,
|
||||
"distanceToParent": 3,
|
||||
"arrangementStyle": 0
|
||||
},
|
||||
"uiObject": {
|
||||
"isRunning": false
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"id": "4adb08aa-1703-4a6d-a8f5-eec6f5d8d1cc",
|
||||
"savedPayload": {
|
||||
"position": {
|
||||
@@ -1298,7 +1241,7 @@
|
||||
"floatingObject": {
|
||||
"isPinned": false,
|
||||
"isFrozen": false,
|
||||
"isCollapsed": false,
|
||||
"isCollapsed": true,
|
||||
"angleToParent": 2,
|
||||
"distanceToParent": 3,
|
||||
"arrangementStyle": 0
|
||||
@@ -1382,6 +1325,34 @@
|
||||
"isRunning": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "User Profile",
|
||||
"name": "Jeremy",
|
||||
"config": "{\n \"codeName\": \"\",\n \"tokens\": 1000\n}",
|
||||
"project": "Governance",
|
||||
"id": "759e9012-c995-47ed-92f1-7d204bf2b58e",
|
||||
"savedPayload": {
|
||||
"position": {
|
||||
"x": 19667.166666666664,
|
||||
"y": 23061.600619195047
|
||||
},
|
||||
"targetPosition": {
|
||||
"x": 19667.166666666664,
|
||||
"y": 23061.600619195047
|
||||
},
|
||||
"floatingObject": {
|
||||
"isPinned": false,
|
||||
"isFrozen": false,
|
||||
"isCollapsed": false,
|
||||
"angleToParent": 2,
|
||||
"distanceToParent": 3,
|
||||
"arrangementStyle": 0
|
||||
},
|
||||
"uiObject": {
|
||||
"isRunning": false
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -56,7 +56,7 @@
|
||||
"config": "{}"
|
||||
},
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Token Switch->"
|
||||
"compatibleTypes": "->Token Power Switch->"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 1,
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
"config": "{}"
|
||||
},
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Token Switch->"
|
||||
"compatibleTypes": "->Token Power Switch->"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 1,
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"actionProject": "Foundations",
|
||||
"disableIfPropertyIsDefined": true,
|
||||
"propertyToCheckFor": "userReferrer",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"label": "Add User Referrer",
|
||||
"relatedUiObject": "User Referrer"
|
||||
@@ -44,15 +42,15 @@
|
||||
"config": "{}"
|
||||
},
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Token Switch->"
|
||||
"compatibleTypes": "->Token Power Switch->"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 1,
|
||||
"propertyNameAtParent": "referralProgram",
|
||||
"childrenNodesProperties": [
|
||||
{
|
||||
"name": "userReferrer",
|
||||
"type": "node",
|
||||
"name": "userReferrers",
|
||||
"type": "array",
|
||||
"childType": "User Referrer",
|
||||
"autoAdd": true
|
||||
},
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
"config": "{}"
|
||||
},
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Token Switch->"
|
||||
"compatibleTypes": "->Token Power Switch->"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 1,
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
"action": "Add UI Object",
|
||||
"actionProject": "Foundations",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"label": "Add User Support",
|
||||
"relatedUiObject": "User Support"
|
||||
"label": "Add User Supporter",
|
||||
"relatedUiObject": "User Supporter"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
@@ -42,16 +42,16 @@
|
||||
"config": "{}"
|
||||
},
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Token Switch->"
|
||||
"compatibleTypes": "->Token Power Switch->"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 1,
|
||||
"propertyNameAtParent": "supportProgram",
|
||||
"childrenNodesProperties": [
|
||||
{
|
||||
"name": "userSupports",
|
||||
"name": "userSupporters",
|
||||
"type": "array",
|
||||
"childType": "User Support",
|
||||
"childType": "User Supporter",
|
||||
"autoAdd": false
|
||||
},
|
||||
{
|
||||
|
||||
+22
-22
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"type": "Token Switch",
|
||||
"type": "Token Power Switch",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
@@ -17,6 +17,15 @@
|
||||
"label": "Add Referral Program",
|
||||
"relatedUiObject": "Referral Program"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"actionProject": "Foundations",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"disableIfPropertyIsDefined": true,
|
||||
"propertyToCheckFor": "supportProgram",
|
||||
"label": "Add Support Program",
|
||||
"relatedUiObject": "Support Program"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"actionProject": "Foundations",
|
||||
@@ -31,9 +40,9 @@
|
||||
"actionProject": "Foundations",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"disableIfPropertyIsDefined": true,
|
||||
"propertyToCheckFor": "supportProgram",
|
||||
"label": "Add Support Program",
|
||||
"relatedUiObject": "Support Program"
|
||||
"propertyToCheckFor": "claimsProgram",
|
||||
"label": "Add Claims Program",
|
||||
"relatedUiObject": "Claims Program"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
@@ -44,15 +53,6 @@
|
||||
"label": "Add Voting Program",
|
||||
"relatedUiObject": "Voting Program"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"actionProject": "Foundations",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"disableIfPropertyIsDefined": true,
|
||||
"propertyToCheckFor": "claimsProgram",
|
||||
"label": "Add Claims Program",
|
||||
"relatedUiObject": "Claims Program"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"actionProject": "Foundations",
|
||||
@@ -84,7 +84,7 @@
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->User Profile->"
|
||||
},
|
||||
"propertyNameAtParent": "tokenSwitch",
|
||||
"propertyNameAtParent": "tokenPowerSwitch",
|
||||
"childrenNodesProperties": [
|
||||
{
|
||||
"name": "referralProgram",
|
||||
@@ -92,12 +92,6 @@
|
||||
"childType": "Referral Program",
|
||||
"autoAdd": true
|
||||
},
|
||||
{
|
||||
"name": "mentorshipProgram",
|
||||
"type": "node",
|
||||
"childType": "Mentorship Program",
|
||||
"autoAdd": true
|
||||
},
|
||||
{
|
||||
"name": "supportProgram",
|
||||
"type": "node",
|
||||
@@ -105,9 +99,9 @@
|
||||
"autoAdd": true
|
||||
},
|
||||
{
|
||||
"name": "votingProgram",
|
||||
"name": "mentorshipProgram",
|
||||
"type": "node",
|
||||
"childType": "Voting Program",
|
||||
"childType": "Mentorship Program",
|
||||
"autoAdd": true
|
||||
},
|
||||
{
|
||||
@@ -116,6 +110,12 @@
|
||||
"childType": "Claims Program",
|
||||
"autoAdd": true
|
||||
},
|
||||
{
|
||||
"name": "votingProgram",
|
||||
"type": "node",
|
||||
"childType": "Voting Program",
|
||||
"autoAdd": true
|
||||
},
|
||||
{
|
||||
"name": "stakingProgram",
|
||||
"type": "node",
|
||||
File renamed without changes.
@@ -12,10 +12,10 @@
|
||||
"action": "Add UI Object",
|
||||
"actionProject": "Foundations",
|
||||
"disableIfPropertyIsDefined": true,
|
||||
"propertyToCheckFor": "tokenSwitch",
|
||||
"propertyToCheckFor": "tokenPowerSwitch",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"label": "Add Token Switch",
|
||||
"relatedUiObject": "Token Switch"
|
||||
"label": "Add Token Power Switch",
|
||||
"relatedUiObject": "Token Power Switch"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
@@ -40,9 +40,9 @@
|
||||
"level": 0,
|
||||
"childrenNodesProperties": [
|
||||
{
|
||||
"name": "tokenSwitch",
|
||||
"name": "tokenPowerSwitch",
|
||||
"type": "node",
|
||||
"childType": "Token Switch",
|
||||
"childType": "Token Power Switch",
|
||||
"autoAdd": true
|
||||
}
|
||||
]
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"type": "User Support",
|
||||
"type": "User Supporter",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
@@ -31,10 +31,10 @@
|
||||
"addLeftIcons": true,
|
||||
"level": 2,
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->support Program->"
|
||||
"compatibleTypes": "->Support Program->"
|
||||
},
|
||||
"referencingRules": {
|
||||
"compatibleTypes": "->User Profile->"
|
||||
},
|
||||
"propertyNameAtParent": "userSupports"
|
||||
"propertyNameAtParent": "userSupporters"
|
||||
}
|
||||
@@ -42,7 +42,7 @@
|
||||
"config": "{}"
|
||||
},
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Token Switch->"
|
||||
"compatibleTypes": "->Token Power Switch->"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 1,
|
||||
|
||||
@@ -41,6 +41,11 @@ function newGovernanceFunctionLibraryDistributionProcess() {
|
||||
userProfiles
|
||||
)
|
||||
|
||||
UI.projects.governance.functionLibraries.supportProgram.calculate(
|
||||
pools,
|
||||
userProfiles
|
||||
)
|
||||
|
||||
UI.projects.governance.functionLibraries.mentorshipProgram.calculate(
|
||||
pools,
|
||||
userProfiles
|
||||
|
||||
@@ -9,283 +9,15 @@ function newGovernanceFunctionLibraryMentorshipProgram() {
|
||||
pools,
|
||||
userProfiles
|
||||
) {
|
||||
/*
|
||||
Here we will store the total amount of tokens that is going to be distributed among all participants
|
||||
of the Mentorship Program. This will come from a Pool that is configured wiht a codeName config property
|
||||
with the value "Mentorship-Program"
|
||||
*/
|
||||
let mentorshipProgramPoolTokenReward
|
||||
/*
|
||||
In order to be able to calculate the share of the Mentorships Program Pool for each User Profile,
|
||||
we need to accumulate all the Icomming Mentorship Power that each User Profile at their Mentorship Program
|
||||
node has, because with that Incoming Power is that each Mentorship Program node gets a share of
|
||||
the pool.
|
||||
*/
|
||||
let accumulatedIncomingMentorshipPower = 0
|
||||
|
||||
/* Scan Pools Until finding the Mentoship-Program Pool */
|
||||
for (let i = 0; i < pools.length; i++) {
|
||||
let poolsNode = pools[i]
|
||||
mentorshipProgramPoolTokenReward = UI.projects.governance.utilities.pools.findPool(poolsNode, "Mentorship-Program")
|
||||
}
|
||||
if (mentorshipProgramPoolTokenReward === undefined || mentorshipProgramPoolTokenReward === 0) { return }
|
||||
/*
|
||||
We will first reset all the mentorship outgoingPower, and then distribute it.
|
||||
*/
|
||||
for (let i = 0; i < userProfiles.length; i++) {
|
||||
let userProfile = userProfiles[i]
|
||||
|
||||
if (userProfile.tokenSwitch === undefined) { continue }
|
||||
if (userProfile.tokenSwitch.mentorshipProgram === undefined) { continue }
|
||||
if (userProfile.tokenSwitch.mentorshipProgram.payload === undefined) { continue }
|
||||
|
||||
reserMentorshipProgram(userProfile.tokenSwitch.mentorshipProgram)
|
||||
}
|
||||
for (let i = 0; i < userProfiles.length; i++) {
|
||||
let userProfile = userProfiles[i]
|
||||
|
||||
if (userProfile.tokenSwitch === undefined) { continue }
|
||||
if (userProfile.tokenSwitch.mentorshipProgram === undefined) { continue }
|
||||
if (userProfile.tokenSwitch.mentorshipProgram.payload === undefined) { continue }
|
||||
|
||||
distributeMentorshipProgram(userProfile.tokenSwitch.mentorshipProgram)
|
||||
}
|
||||
for (let i = 0; i < userProfiles.length; i++) {
|
||||
let userProfile = userProfiles[i]
|
||||
|
||||
if (userProfile.tokenSwitch === undefined) { continue }
|
||||
if (userProfile.tokenSwitch.mentorshipProgram === undefined) { continue }
|
||||
if (userProfile.tokenSwitch.mentorshipProgram.payload === undefined) { continue }
|
||||
|
||||
calculateMentorshipProgram(userProfile.tokenSwitch.mentorshipProgram)
|
||||
}
|
||||
|
||||
function reserMentorshipProgram(node) {
|
||||
if (node === undefined) { return }
|
||||
if (node.payload === undefined) { return }
|
||||
node.payload.mentorshipProgram = {
|
||||
count: 0,
|
||||
outgoingPower: 0,
|
||||
ownPower: 0,
|
||||
incomingPower: 0,
|
||||
awarded: {
|
||||
tokens: 0,
|
||||
percentage: 0
|
||||
}
|
||||
}
|
||||
if (
|
||||
node.type === 'User Profile' &&
|
||||
node.tokenSwitch !== undefined
|
||||
) {
|
||||
reserMentorshipProgram(node.tokenSwitch)
|
||||
return
|
||||
}
|
||||
if (
|
||||
node.type === 'Token Switch' &&
|
||||
node.mentorshipProgram !== undefined
|
||||
) {
|
||||
reserMentorshipProgram(node.mentorshipProgram)
|
||||
return
|
||||
}
|
||||
if (
|
||||
node.type === 'Mentorship Program' &&
|
||||
node.userMentors !== undefined
|
||||
) {
|
||||
for (let i = 0; i < node.userMentors.length; i++) {
|
||||
reserMentorshipProgram(node.userMentors[i])
|
||||
}
|
||||
return
|
||||
}
|
||||
if (
|
||||
node.type === 'User Mentor' &&
|
||||
node.payload.referenceParent !== undefined
|
||||
) {
|
||||
reserMentorshipProgram(node.payload.referenceParent)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
function distributeMentorshipProgram(mentorshipProgram) {
|
||||
if (mentorshipProgram === undefined || mentorshipProgram.payload === undefined) { return }
|
||||
/*
|
||||
Here we will convert Token Power into Mentorship Power.
|
||||
As per system rules mentoshipPower = tokensPower
|
||||
*/
|
||||
let mentoshipPower = mentorshipProgram.payload.tokenPower
|
||||
/*
|
||||
We will also reseet the count of mentorships here.
|
||||
*/
|
||||
let count = 0
|
||||
/*
|
||||
The Own Power is the power generated by the same User Profile tokens, not inherited from others.
|
||||
*/
|
||||
mentorshipProgram.payload.mentorshipProgram.ownPower = mentoshipPower
|
||||
|
||||
distributeMentorshipPower(mentorshipProgram, mentoshipPower, count)
|
||||
}
|
||||
|
||||
function distributeMentorshipPower(
|
||||
node,
|
||||
mentoshipPower,
|
||||
count
|
||||
) {
|
||||
if (node === undefined) { return }
|
||||
if (node.payload === undefined) { return }
|
||||
if (node.payload.mentorshipProgram === undefined) { return }
|
||||
|
||||
switch (node.type) {
|
||||
case 'Mentorship Program': {
|
||||
/*
|
||||
This is the point where we increase to our local count of mentorships whatever it comes
|
||||
at the count parameters. If we are processing the User Profile of this Mentorship Program
|
||||
then we will add zero, otherwise, 1.
|
||||
*/
|
||||
node.payload.mentorshipProgram.count = node.payload.mentorshipProgram.count + count
|
||||
/*
|
||||
The outgoingPower of this node will be accumulating all the mentoshipPower flowing
|
||||
through it, no matter from where it comes.
|
||||
*/
|
||||
node.payload.mentorshipProgram.outgoingPower = node.payload.mentorshipProgram.outgoingPower + mentoshipPower
|
||||
/*
|
||||
We need to adjust the balance that holds the accumulationt of all incomingPower of all Mentorship Program
|
||||
nodes. To do this we will substratct the current incomingPower, bacause it is going to be recalculated
|
||||
inmediatelly after this, and then we will add it again after the recalcualtion.
|
||||
*/
|
||||
accumulatedIncomingMentorshipPower = accumulatedIncomingMentorshipPower - node.payload.mentorshipProgram.incomingPower
|
||||
/*
|
||||
At any point in time, the incomingPower will be equal to the total of the outgoingPower minus
|
||||
the ownPower. This is like this because the outgoingPower is the accumulation of all the
|
||||
power flow that is leaving this node, which includes the ownPower. That means that if we
|
||||
substract the ownPower, we will have the accumulation of all the incomingPower, which
|
||||
means all the power coming from other User Profiles referencing this one.
|
||||
*/
|
||||
node.payload.mentorshipProgram.incomingPower = node.payload.mentorshipProgram.outgoingPower - node.payload.mentorshipProgram.ownPower
|
||||
/*
|
||||
Now that we have the incomingPower calculated again, we can add it again to the balance of all the incomingPower
|
||||
of all Mentorship Program nodes.
|
||||
*/
|
||||
accumulatedIncomingMentorshipPower = accumulatedIncomingMentorshipPower + node.payload.mentorshipProgram.incomingPower
|
||||
|
||||
if (node.userMentors !== undefined) {
|
||||
for (let i = 0; i < node.userMentors.length; i++) {
|
||||
distributeMentorshipPower(node.userMentors[i], mentoshipPower / node.userMentors.length, 0)
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
case 'User Mentor': {
|
||||
node.payload.mentorshipProgram.outgoingPower = node.payload.parentNode.payload.mentorshipProgram.outgoingPower / node.payload.parentNode.userMentors.length
|
||||
|
||||
drawUserMentor(node)
|
||||
if (node.payload.referenceParent !== undefined) {
|
||||
distributeMentorshipPower(node.payload.referenceParent, mentoshipPower / 10, 0)
|
||||
}
|
||||
break
|
||||
}
|
||||
case 'User Profile': {
|
||||
if (node.tokenSwitch !== undefined) {
|
||||
distributeMentorshipPower(node.tokenSwitch, mentoshipPower, 0)
|
||||
}
|
||||
break
|
||||
}
|
||||
case 'Token Switch': {
|
||||
if (node.mentorshipProgram !== undefined) {
|
||||
distributeMentorshipPower(node.mentorshipProgram, mentoshipPower, 1)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function calculateMentorshipProgram(mentorshipProgram) {
|
||||
/*
|
||||
Here we will calculate which share of the Mentorship Program Pool this user will get in tokens.
|
||||
To do that, we use the incomingPower, to see which proportion of the accumulatedIncomingMentorshipPower
|
||||
represents.
|
||||
*/
|
||||
if (mentorshipProgram.payload === undefined) { return }
|
||||
/*
|
||||
If the accumulatedIncomingMentorshipPower is not grater the amount of tokens at the Mentorship Program Pool, then
|
||||
this user will get the exact amount of tokens from the pool as incomingPower he has.
|
||||
|
||||
If the accumulatedIncomingMentorshipPower is grater the amount of tokens at the Mentorship Program Pool, then
|
||||
the amount ot tokens to be received is a proportional to the share of incomingPower in accumulatedIncomingMentorshipPower.
|
||||
*/
|
||||
let totalPowerRewardRatio = accumulatedIncomingMentorshipPower / mentorshipProgramPoolTokenReward
|
||||
if (totalPowerRewardRatio < 1) { totalPowerRewardRatio = 1 }
|
||||
|
||||
if (mentorshipProgram.tokensAwarded === undefined || mentorshipProgram.tokensAwarded.payload === undefined) {
|
||||
mentorshipProgram.payload.uiObject.setErrorMessage("Tokens Awarded Node is needed in order for this Program to get Tokens from the Mentorship Program Pool.")
|
||||
return
|
||||
}
|
||||
mentorshipProgram.payload.mentorshipProgram.awarded.tokens = mentorshipProgram.payload.mentorshipProgram.incomingPower * totalPowerRewardRatio
|
||||
/*
|
||||
As per the system rules, the Mentorship Program will not give tokens to users that do not ha their own Referrer set up,
|
||||
unless it has a big amount of tokens (this last condition is for the edge case where a user it at the top of the
|
||||
mentorship pyramid.)
|
||||
*/
|
||||
if (
|
||||
mentorshipProgram.payload.mentorshipProgram.awarded.tokens > 0 &&
|
||||
mentorshipProgram.payload.mentorshipProgram.ownPower < 1000000 &&
|
||||
(mentorshipProgram.userMentors === undefined || hasUsersDefined(mentorshipProgram.userMentors) === false)
|
||||
) {
|
||||
|
||||
mentorshipProgram.payload.uiObject.setErrorMessage("In order to be awarded " + mentorshipProgram.payload.mentorshipProgram.awarded.tokens + " SA Tokens from your mentorships, you need first to define yourself who your metors are.")
|
||||
mentorshipProgram.payload.mentorshipProgram.awarded.tokens = 0
|
||||
}
|
||||
|
||||
drawMentorshipProgram(mentorshipProgram)
|
||||
}
|
||||
|
||||
function hasUsersDefined(usersArray) {
|
||||
if (usersArray === undefined) { return false }
|
||||
for (let i = 0; i < usersArray.length; i++) {
|
||||
let user = usersArray[i]
|
||||
if (user.payload.referenceParent !== undefined) { return true }
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
function drawUserMentor(node) {
|
||||
if (node.payload !== undefined) {
|
||||
|
||||
const outgoingPowerText = new Intl.NumberFormat().format(node.payload.mentorshipProgram.outgoingPower)
|
||||
|
||||
node.payload.uiObject.valueAngleOffset = 180
|
||||
node.payload.uiObject.valueAtAngle = true
|
||||
|
||||
node.payload.uiObject.setValue(outgoingPowerText + ' ' + 'Mentorship Power')
|
||||
|
||||
node.payload.uiObject.statusAngleOffset = 0
|
||||
node.payload.uiObject.statusAtAngle = false
|
||||
|
||||
node.payload.uiObject.setStatus(outgoingPowerText + ' ' + ' Outgoing Power')
|
||||
}
|
||||
}
|
||||
|
||||
function drawMentorshipProgram(node) {
|
||||
if (node.payload !== undefined) {
|
||||
|
||||
const ownPowerText = new Intl.NumberFormat().format(node.payload.mentorshipProgram.ownPower)
|
||||
const incomingPowerText = new Intl.NumberFormat().format(node.payload.mentorshipProgram.incomingPower)
|
||||
|
||||
node.payload.uiObject.statusAngleOffset = 0
|
||||
node.payload.uiObject.statusAtAngle = false
|
||||
|
||||
node.payload.uiObject.setStatus(ownPowerText + ' Own Power - ' + incomingPowerText + ' Incoming Power')
|
||||
}
|
||||
if (node.tokensAwarded !== undefined && node.tokensAwarded.payload !== undefined) {
|
||||
|
||||
const tokensAwardedText = new Intl.NumberFormat().format(node.payload.mentorshipProgram.awarded.tokens)
|
||||
|
||||
node.tokensAwarded.payload.uiObject.statusAngleOffset = 0
|
||||
node.tokensAwarded.payload.uiObject.statusAtAngle = false
|
||||
node.tokensAwarded.payload.uiObject.valueAngleOffset = 0
|
||||
node.tokensAwarded.payload.uiObject.valueAtAngle = false
|
||||
|
||||
node.tokensAwarded.payload.uiObject.setValue(tokensAwardedText + ' SA Tokens')
|
||||
node.tokensAwarded.payload.uiObject.setStatus('From ' + node.payload.mentorshipProgram.count + ' Mentees.')
|
||||
}
|
||||
}
|
||||
UI.projects.governance.utilities.mandatoryProgram.run(
|
||||
pools,
|
||||
userProfiles,
|
||||
"mentorshipProgram",
|
||||
"Mentorship-Program",
|
||||
"Mentorship Program",
|
||||
"Mentorship Power",
|
||||
"userMentors",
|
||||
"User Mentor"
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -9,265 +9,15 @@ function newGovernanceFunctionLibraryReferralProgram() {
|
||||
pools,
|
||||
userProfiles
|
||||
) {
|
||||
/*
|
||||
Here we will store the total amount of tokens that is going to be distributed among all participants
|
||||
of the Referral Program. This will come from a Pool that is configured wiht a codeName config property
|
||||
with the value "Referral-Program"
|
||||
*/
|
||||
let referralProgramPoolTokenReward
|
||||
/*
|
||||
In order to be able to calculate the share of the Referrals Program Pool for each User Profile,
|
||||
we need to accumulate all the Icomming Referral Power that each User Profile at their Referral Program
|
||||
node has, because with that Incoming Power is that each Referral Program node gets a share of
|
||||
the pool.
|
||||
*/
|
||||
let accumulatedIncomingReferralPower = 0
|
||||
|
||||
/* Scan Pools Until finding the Referrla-Program Pool */
|
||||
for (let i = 0; i < pools.length; i++) {
|
||||
let poolsNode = pools[i]
|
||||
referralProgramPoolTokenReward = UI.projects.governance.utilities.pools.findPool(poolsNode, "Referral-Program")
|
||||
}
|
||||
if (referralProgramPoolTokenReward === undefined || referralProgramPoolTokenReward === 0) { return }
|
||||
/*
|
||||
We will first reset all the referral outgoingPower, and then distribute it.
|
||||
*/
|
||||
for (let i = 0; i < userProfiles.length; i++) {
|
||||
let userProfile = userProfiles[i]
|
||||
|
||||
if (userProfile.tokenSwitch === undefined) { continue }
|
||||
if (userProfile.tokenSwitch.referralProgram === undefined) { continue }
|
||||
if (userProfile.tokenSwitch.referralProgram.payload === undefined) { continue }
|
||||
|
||||
reserReferralProgram(userProfile.tokenSwitch.referralProgram)
|
||||
}
|
||||
for (let i = 0; i < userProfiles.length; i++) {
|
||||
let userProfile = userProfiles[i]
|
||||
|
||||
if (userProfile.tokenSwitch === undefined) { continue }
|
||||
if (userProfile.tokenSwitch.referralProgram === undefined) { continue }
|
||||
if (userProfile.tokenSwitch.referralProgram.payload === undefined) { continue }
|
||||
|
||||
distributeReferralProgram(userProfile.tokenSwitch.referralProgram)
|
||||
}
|
||||
for (let i = 0; i < userProfiles.length; i++) {
|
||||
let userProfile = userProfiles[i]
|
||||
|
||||
if (userProfile.tokenSwitch === undefined) { continue }
|
||||
if (userProfile.tokenSwitch.referralProgram === undefined) { continue }
|
||||
if (userProfile.tokenSwitch.referralProgram.payload === undefined) { continue }
|
||||
|
||||
calculateReferralProgram(userProfile.tokenSwitch.referralProgram)
|
||||
}
|
||||
|
||||
function reserReferralProgram(node) {
|
||||
if (node === undefined) { return }
|
||||
if (node.payload === undefined) { return }
|
||||
node.payload.referralProgram = {
|
||||
count: 0,
|
||||
outgoingPower: 0,
|
||||
ownPower: 0,
|
||||
incomingPower: 0,
|
||||
awarded: {
|
||||
tokens: 0,
|
||||
percentage: 0
|
||||
}
|
||||
}
|
||||
if (
|
||||
node.type === 'User Profile' &&
|
||||
node.tokenSwitch !== undefined
|
||||
) {
|
||||
reserReferralProgram(node.tokenSwitch)
|
||||
return
|
||||
}
|
||||
if (
|
||||
node.type === 'Token Switch' &&
|
||||
node.referralProgram !== undefined
|
||||
) {
|
||||
reserReferralProgram(node.referralProgram)
|
||||
return
|
||||
}
|
||||
if (
|
||||
node.type === 'Referral Program' &&
|
||||
node.userReferrer !== undefined
|
||||
) {
|
||||
reserReferralProgram(node.userReferrer)
|
||||
return
|
||||
}
|
||||
if (
|
||||
node.type === 'User Referrer' &&
|
||||
node.payload.referenceParent !== undefined
|
||||
) {
|
||||
reserReferralProgram(node.payload.referenceParent)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
function distributeReferralProgram(referralProgram) {
|
||||
if (referralProgram === undefined || referralProgram.payload === undefined) { return }
|
||||
/*
|
||||
Here we will convert Token Power into Referral Power.
|
||||
As per system rules referringPower = tokensPower
|
||||
*/
|
||||
let referringPower = referralProgram.payload.tokenPower
|
||||
/*
|
||||
We will also reseet the count of referrals here.
|
||||
*/
|
||||
let count = 0
|
||||
/*
|
||||
The Own Power is the power generated by the same User Profile tokens, not inherited from others.
|
||||
*/
|
||||
referralProgram.payload.referralProgram.ownPower = referringPower
|
||||
|
||||
distributeReferralPower(referralProgram, referringPower, count)
|
||||
}
|
||||
|
||||
function distributeReferralPower(
|
||||
node,
|
||||
referringPower,
|
||||
count
|
||||
) {
|
||||
|
||||
if (node === undefined) { return }
|
||||
if (node.payload === undefined) { return }
|
||||
|
||||
switch (node.type) {
|
||||
case 'Referral Program': {
|
||||
/*
|
||||
This is the point where we increase to our local count of referrals whatever it comes
|
||||
at the count parameters. If we are processing the User Profile of this Referral Program
|
||||
then we will add zero, otherwise, 1.
|
||||
*/
|
||||
node.payload.referralProgram.count = node.payload.referralProgram.count + count
|
||||
/*
|
||||
The outgoingPower of this node will be accumulating all the referringPower flowing
|
||||
through it, no matter from where it comes.
|
||||
*/
|
||||
node.payload.referralProgram.outgoingPower = node.payload.referralProgram.outgoingPower + referringPower
|
||||
/*
|
||||
We need to adjust the balance that holds the accumulationt of all incomingPower of all Referral Program
|
||||
nodes. To do this we will substratct the current incomingPower, bacause it is going to be recalculated
|
||||
inmediatelly after this, and then we will add it again after the recalcualtion.
|
||||
*/
|
||||
accumulatedIncomingReferralPower = accumulatedIncomingReferralPower - node.payload.referralProgram.incomingPower
|
||||
/*
|
||||
At any point in time, the incomingPower will be equal to the total of the outgoingPower minus
|
||||
the ownPower. This is like this because the outgoingPower is the accumulation of all the
|
||||
power flow that is leaving this node, which includes the ownPower. That means that if we
|
||||
substract the ownPower, we will have the accumulation of all the incomingPower, which
|
||||
means all the power coming from other User Profiles referencing this one.
|
||||
*/
|
||||
node.payload.referralProgram.incomingPower = node.payload.referralProgram.outgoingPower - node.payload.referralProgram.ownPower
|
||||
/*
|
||||
Now that we have the incomingPower calculated again, we can add it again to the balance of all the incomingPower
|
||||
of all Referral Program nodes.
|
||||
*/
|
||||
accumulatedIncomingReferralPower = accumulatedIncomingReferralPower + node.payload.referralProgram.incomingPower
|
||||
|
||||
if (node.userReferrer !== undefined) {
|
||||
distributeReferralPower(node.userReferrer, referringPower, 0)
|
||||
}
|
||||
break
|
||||
}
|
||||
case 'User Referrer': {
|
||||
drawUserReferrer(node)
|
||||
if (node.payload.referenceParent !== undefined) {
|
||||
distributeReferralPower(node.payload.referenceParent, referringPower / 10, 0)
|
||||
}
|
||||
break
|
||||
}
|
||||
case 'User Profile': {
|
||||
if (node.tokenSwitch !== undefined) {
|
||||
distributeReferralPower(node.tokenSwitch, referringPower, 0)
|
||||
}
|
||||
break
|
||||
}
|
||||
case 'Token Switch': {
|
||||
if (node.referralProgram !== undefined) {
|
||||
distributeReferralPower(node.referralProgram, referringPower, 1)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function calculateReferralProgram(referralProgram) {
|
||||
/*
|
||||
Here we will calculate which share of the Referral Program Pool this user will get in tokens.
|
||||
To do that, we use the incomingPower, to see which proportion of the accumulatedIncomingReferralPower
|
||||
represents.
|
||||
*/
|
||||
if (referralProgram.payload === undefined) { return }
|
||||
/*
|
||||
If the accumulatedIncomingReferralPower is not grater the amount of tokens at the Referral Program Pool, then
|
||||
this user will get the exact amount of tokens from the pool as incomingPower he has.
|
||||
|
||||
If the accumulatedIncomingReferralPower is grater the amount of tokens at the Referral Program Pool, then
|
||||
the amount ot tokens to be received is a proportional to the share of incomingPower in accumulatedIncomingReferralPower.
|
||||
*/
|
||||
let totalPowerRewardRatio = accumulatedIncomingReferralPower / referralProgramPoolTokenReward
|
||||
if (totalPowerRewardRatio < 1) { totalPowerRewardRatio = 1 }
|
||||
|
||||
if (referralProgram.tokensAwarded === undefined || referralProgram.tokensAwarded.payload === undefined) {
|
||||
referralProgram.payload.uiObject.setErrorMessage("Tokens Awarded Node is needed in order for this Program to get Tokens from the Referral Program Pool.")
|
||||
return
|
||||
}
|
||||
referralProgram.payload.referralProgram.awarded.tokens = referralProgram.payload.referralProgram.incomingPower * totalPowerRewardRatio
|
||||
/*
|
||||
As per the system rules, the Referral Program will not give tokens to users that do not ha their own Referrer set up,
|
||||
unless it has a big amount of tokens (this last condition is for the edge case where a user it at the top of the
|
||||
referral pyramid.)
|
||||
*/
|
||||
if (
|
||||
referralProgram.payload.referralProgram.ownPower < 1000000 &&
|
||||
(referralProgram.userReferrer === undefined || referralProgram.userReferrer.payload.referenceParent === undefined)
|
||||
) {
|
||||
|
||||
referralProgram.payload.uiObject.setErrorMessage("In order to be awarded " + referralProgram.payload.referralProgram.awarded.tokens + " SA Tokens from your referrals, you need first to define yourself who your referrer is.")
|
||||
referralProgram.payload.referralProgram.awarded.tokens = 0
|
||||
}
|
||||
|
||||
drawReferralProgram(referralProgram)
|
||||
}
|
||||
|
||||
function drawUserReferrer(node) {
|
||||
if (node.payload !== undefined) {
|
||||
const ownPowerText = new Intl.NumberFormat().format(node.payload.parentNode.payload.referralProgram.ownPower)
|
||||
const incomingPowerText = new Intl.NumberFormat().format(node.payload.parentNode.payload.referralProgram.incomingPower)
|
||||
const outgoingPowerText = new Intl.NumberFormat().format(node.payload.parentNode.payload.referralProgram.outgoingPower)
|
||||
|
||||
node.payload.uiObject.valueAngleOffset = 180
|
||||
node.payload.uiObject.valueAtAngle = true
|
||||
|
||||
node.payload.uiObject.setValue(outgoingPowerText + ' ' + 'Referring Power')
|
||||
|
||||
node.payload.uiObject.statusAngleOffset = 0
|
||||
node.payload.uiObject.statusAtAngle = false
|
||||
|
||||
node.payload.uiObject.setStatus(ownPowerText + ' Own RP + ' + incomingPowerText + ' Incoming RP = ' + outgoingPowerText + ' ' + ' Outgoing RP')
|
||||
}
|
||||
}
|
||||
|
||||
function drawReferralProgram(node) {
|
||||
if (node.payload !== undefined) {
|
||||
|
||||
node.payload.uiObject.statusAngleOffset = 0
|
||||
node.payload.uiObject.statusAtAngle = false
|
||||
|
||||
node.payload.uiObject.setStatus("Referring Power = Token Power")
|
||||
}
|
||||
if (node.tokensAwarded !== undefined && node.tokensAwarded.payload !== undefined) {
|
||||
|
||||
const tokensAwardedText = new Intl.NumberFormat().format(node.payload.referralProgram.awarded.tokens)
|
||||
|
||||
node.tokensAwarded.payload.uiObject.statusAngleOffset = 0
|
||||
node.tokensAwarded.payload.uiObject.statusAtAngle = false
|
||||
node.tokensAwarded.payload.uiObject.valueAngleOffset = 0
|
||||
node.tokensAwarded.payload.uiObject.valueAtAngle = false
|
||||
|
||||
node.tokensAwarded.payload.uiObject.setValue(tokensAwardedText + ' SA Tokens')
|
||||
node.tokensAwarded.payload.uiObject.setStatus('From '+ node.payload.referralProgram.count + ' Referrals.')
|
||||
}
|
||||
}
|
||||
UI.projects.governance.utilities.mandatoryProgram.run(
|
||||
pools,
|
||||
userProfiles,
|
||||
"referralProgram",
|
||||
"Referral-Program",
|
||||
"Referral Program",
|
||||
"Referral Power",
|
||||
"userReferrers",
|
||||
"User Referrer"
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
function newGovernanceFunctionLibrarySupportProgram() {
|
||||
let thisObject = {
|
||||
calculate: calculate
|
||||
}
|
||||
|
||||
return thisObject
|
||||
|
||||
function calculate(
|
||||
pools,
|
||||
userProfiles
|
||||
) {
|
||||
UI.projects.governance.utilities.mandatoryProgram.run(
|
||||
pools,
|
||||
userProfiles,
|
||||
"supportProgram",
|
||||
"Support-Program",
|
||||
"Support Program",
|
||||
"Support Power",
|
||||
"userSupporters",
|
||||
"User Supporter"
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -78,20 +78,20 @@ function newGovernanceFunctionLibraryTokenPower() {
|
||||
/*
|
||||
Before we start we will do some validations:
|
||||
*/
|
||||
if (userProfile.tokenSwitch === undefined) {
|
||||
userProfile.payload.uiObject.setErrorMessage("You need to have a Token Switch child node.")
|
||||
if (userProfile.tokenPowerSwitch === undefined) {
|
||||
userProfile.payload.uiObject.setErrorMessage("You need to have a Token Power Switch child node.")
|
||||
return
|
||||
}
|
||||
if (userProfile.tokenSwitch.referralProgram === undefined) {
|
||||
userProfile.tokenSwitch.payload.uiObject.setErrorMessage("You need to have a Referral Program child node.")
|
||||
if (userProfile.tokenPowerSwitch.referralProgram === undefined) {
|
||||
userProfile.tokenPowerSwitch.payload.uiObject.setErrorMessage("You need to have a Referral Program child node.")
|
||||
return
|
||||
}
|
||||
if (userProfile.tokenSwitch.mentorshipProgram === undefined) {
|
||||
userProfile.tokenSwitch.payload.uiObject.setErrorMessage("You need to have a Mentorship Program child node.")
|
||||
if (userProfile.tokenPowerSwitch.mentorshipProgram === undefined) {
|
||||
userProfile.tokenPowerSwitch.payload.uiObject.setErrorMessage("You need to have a Mentorship Program child node.")
|
||||
return
|
||||
}
|
||||
if (userProfile.tokenSwitch.supportProgram === undefined) {
|
||||
userProfile.tokenSwitch.payload.uiObject.setErrorMessage("You need to have a Spupport Program child node.")
|
||||
if (userProfile.tokenPowerSwitch.supportProgram === undefined) {
|
||||
userProfile.tokenPowerSwitch.payload.uiObject.setErrorMessage("You need to have a Spupport Program child node.")
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -42,22 +42,22 @@ function newGovernanceFunctionLibraryVotes() {
|
||||
for (let i = 0; i < userProfiles.length; i++) {
|
||||
let userProfile = userProfiles[i]
|
||||
|
||||
if (userProfile.tokenSwitch === undefined) { continue }
|
||||
if (userProfile.tokenSwitch.votingProgram === undefined) { continue }
|
||||
if (userProfile.tokenSwitch.votingProgram.payload === undefined) { continue }
|
||||
if (userProfile.tokenPowerSwitch === undefined) { continue }
|
||||
if (userProfile.tokenPowerSwitch.votingProgram === undefined) { continue }
|
||||
if (userProfile.tokenPowerSwitch.votingProgram.payload === undefined) { continue }
|
||||
|
||||
resetVotes(userProfile.tokenSwitch.votingProgram)
|
||||
resetVotes(userProfile.tokenPowerSwitch.votingProgram)
|
||||
}
|
||||
for (let i = 0; i < userProfiles.length; i++) {
|
||||
let userProfile = userProfiles[i]
|
||||
|
||||
if (userProfile.tokenSwitch === undefined) { continue }
|
||||
if (userProfile.tokenSwitch.votingProgram === undefined) { continue }
|
||||
if (userProfile.tokenSwitch.votingProgram.payload === undefined) { continue }
|
||||
if (userProfile.tokenPowerSwitch === undefined) { continue }
|
||||
if (userProfile.tokenPowerSwitch.votingProgram === undefined) { continue }
|
||||
if (userProfile.tokenPowerSwitch.votingProgram.payload === undefined) { continue }
|
||||
|
||||
userProfile.tokenSwitch.votingProgram.payload.votes = userProfile.tokenSwitch.votingProgram.payload.tokenPower
|
||||
userProfile.tokenPowerSwitch.votingProgram.payload.votes = userProfile.tokenPowerSwitch.votingProgram.payload.tokenPower
|
||||
|
||||
distributeVotingProgram(userProfile.tokenSwitch.votingProgram)
|
||||
distributeVotingProgram(userProfile.tokenPowerSwitch.votingProgram)
|
||||
}
|
||||
|
||||
function resetVotes(node) {
|
||||
|
||||
@@ -0,0 +1,363 @@
|
||||
function newFoundationsUtilitiesMandatoryProgram() {
|
||||
let thisObject = {
|
||||
run: run
|
||||
}
|
||||
|
||||
return thisObject
|
||||
|
||||
function run(
|
||||
pools,
|
||||
userProfiles,
|
||||
programPropertyName,
|
||||
programName,
|
||||
programNodeType,
|
||||
programPowerName,
|
||||
usersArrayPropertyName,
|
||||
userNodeType
|
||||
) {
|
||||
/*
|
||||
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
|
||||
*/
|
||||
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 Icomming programPowerName that each User Profile at their Program
|
||||
node has, because with that Incoming Power is that each Program node gets a share of
|
||||
the pool.
|
||||
*/
|
||||
let accumulatedIncomingProgramPower = 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, programName)
|
||||
}
|
||||
if (programPoolTokenReward === undefined || programPoolTokenReward === 0) { return }
|
||||
/*
|
||||
We will first reset all the program outgoingPower, and then distribute it.
|
||||
*/
|
||||
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] = {
|
||||
count: 0,
|
||||
percentage: 0,
|
||||
outgoingPower: 0,
|
||||
ownPower: 0,
|
||||
incomingPower: 0,
|
||||
awarded: {
|
||||
tokens: 0,
|
||||
percentage: 0
|
||||
}
|
||||
}
|
||||
if (
|
||||
node.type === 'User Profile' &&
|
||||
node.tokenPowerSwitch !== undefined
|
||||
) {
|
||||
resetProgram(node.tokenPowerSwitch)
|
||||
return
|
||||
}
|
||||
if (
|
||||
node.type === 'Token Power Switch' &&
|
||||
node[programPropertyName] !== undefined
|
||||
) {
|
||||
resetProgram(node[programPropertyName])
|
||||
return
|
||||
}
|
||||
if (
|
||||
node.type === programNodeType &&
|
||||
node[usersArrayPropertyName] !== undefined
|
||||
) {
|
||||
for (let i = 0; i < node[usersArrayPropertyName].length; i++) {
|
||||
resetProgram(node[usersArrayPropertyName][i])
|
||||
}
|
||||
return
|
||||
}
|
||||
if (
|
||||
node.type === userNodeType &&
|
||||
node.payload.referenceParent !== undefined
|
||||
) {
|
||||
resetProgram(node.payload.referenceParent)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
/*
|
||||
As per the system rules, the Program will not give tokens
|
||||
to users that do not have their own user nodes set up, unless it has a big
|
||||
amount of tokens (this last condition is for the edge case where a user it
|
||||
at the top of the program pyramid.)
|
||||
*/
|
||||
if (
|
||||
node.payload.parentNode.payload.parentNode.payload.blockchainTokens < 1000000 &&
|
||||
(node[usersArrayPropertyName] === undefined || hasUsersDefined(node[usersArrayPropertyName]) === false)
|
||||
) {
|
||||
node.payload[programPropertyName].isActive = false
|
||||
node.payload.uiObject.setErrorMessage("In order to enable this program you need to add " + userNodeType + " nodes and reference a User Profile from each one.")
|
||||
} else {
|
||||
node.payload[programPropertyName].isActive = true
|
||||
}
|
||||
function hasUsersDefined(usersArray) {
|
||||
if (usersArray === undefined) { return false }
|
||||
for (let i = 0; i < usersArray.length; i++) {
|
||||
let user = usersArray[i]
|
||||
if (user.payload.referenceParent !== undefined) { return true }
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
function distributeProgram(programNode) {
|
||||
if (programNode === undefined || programNode.payload === undefined) { return }
|
||||
/*
|
||||
Here we will convert Token Power into programPowerName.
|
||||
As per system rules mentoshipPower = tokensPower
|
||||
*/
|
||||
let mentoshipPower = programNode.payload.tokenPower
|
||||
/*
|
||||
We will also reseet the count of descendents from here.
|
||||
*/
|
||||
let count = 0
|
||||
/*
|
||||
The Own Power is the power generated by the same User Profile tokens, not inherited from others.
|
||||
*/
|
||||
programNode.payload[programPropertyName].ownPower = mentoshipPower
|
||||
|
||||
distributeProgramPower(programNode, mentoshipPower, count)
|
||||
}
|
||||
|
||||
function distributeProgramPower(
|
||||
node,
|
||||
mentoshipPower,
|
||||
count,
|
||||
percentage
|
||||
) {
|
||||
if (node === undefined) { return }
|
||||
if (node.payload === undefined) { return }
|
||||
if (node.payload[programPropertyName] === undefined) { return }
|
||||
|
||||
switch (node.type) {
|
||||
case programNodeType: {
|
||||
/*
|
||||
This is the point where we increase to our local count of descendents whatever it comes
|
||||
at the count parameters. If we are processing the User Profile of this Program
|
||||
then we will add zero, otherwise, 1.
|
||||
*/
|
||||
node.payload[programPropertyName].count = node.payload[programPropertyName].count + count
|
||||
/*
|
||||
The outgoingPower of this node will be accumulating all the mentoshipPower flowing
|
||||
through it, no matter from where it comes.
|
||||
*/
|
||||
node.payload[programPropertyName].outgoingPower = node.payload[programPropertyName].outgoingPower + mentoshipPower
|
||||
/*
|
||||
We need to adjust the balance that holds the accumulationt of all incomingPower of all Program
|
||||
nodes. To do this we will substratct the current incomingPower, bacause it is going to be recalculated
|
||||
inmediatelly after this, and then we will add it again after the recalcualtion.
|
||||
*/
|
||||
accumulatedIncomingProgramPower = accumulatedIncomingProgramPower - node.payload[programPropertyName].incomingPower
|
||||
/*
|
||||
At any point in time, the incomingPower will be equal to the total of the outgoingPower minus
|
||||
the ownPower. This is like this because the outgoingPower is the accumulation of all the
|
||||
power flow that is leaving this node, which includes the ownPower. That means that if we
|
||||
substract the ownPower, we will have the accumulation of all the incomingPower, which
|
||||
means all the power coming from other User Profiles referencing this one.
|
||||
*/
|
||||
node.payload[programPropertyName].incomingPower = node.payload[programPropertyName].outgoingPower - node.payload[programPropertyName].ownPower
|
||||
/*
|
||||
Now that we have the incomingPower calculated again, we can add it again to the balance of all the incomingPower
|
||||
of all Program nodes.
|
||||
*/
|
||||
accumulatedIncomingProgramPower = accumulatedIncomingProgramPower + node.payload[programPropertyName].incomingPower
|
||||
|
||||
if (node[usersArrayPropertyName] !== undefined) {
|
||||
/*
|
||||
Before distributing the program power, we will calculate how the power
|
||||
is going to be switched between all nodes. The first pass is about
|
||||
scanning all sibling nodes to see which ones have a percentage defined
|
||||
at their config, and check that all percentages don't add more than 100.
|
||||
*/
|
||||
let totalPercentage = 0
|
||||
let totalNodesWithoutPercentage = 0
|
||||
for (let i = 0; i < node[usersArrayPropertyName].length; i++) {
|
||||
let childNode = node[usersArrayPropertyName][i]
|
||||
let percentage = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
|
||||
if (percentage !== undefined && isNaN(percentage) !== true) {
|
||||
totalPercentage = totalPercentage + percentage
|
||||
} else {
|
||||
totalNodesWithoutPercentage++
|
||||
}
|
||||
}
|
||||
if (totalPercentage > 100) {
|
||||
node.payload.uiObject.setErrorMessage('Program Power Switching Error. Total Percentage of children nodes is grater that 100.')
|
||||
return
|
||||
}
|
||||
let defaultPercentage = 0
|
||||
if (totalNodesWithoutPercentage > 0) {
|
||||
defaultPercentage = (100 - totalPercentage) / totalNodesWithoutPercentage
|
||||
}
|
||||
/*
|
||||
Here we do the actual distribution.
|
||||
*/
|
||||
for (let i = 0; i < node[usersArrayPropertyName].length; i++) {
|
||||
let childNode = node[usersArrayPropertyName][i]
|
||||
let percentage = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
|
||||
if (percentage === undefined || isNaN(percentage) === true) {
|
||||
percentage = defaultPercentage
|
||||
}
|
||||
distributeProgramPower(childNode, mentoshipPower * percentage / 100, 0, percentage)
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
case userNodeType: {
|
||||
node.payload[programPropertyName].outgoingPower = node.payload.parentNode.payload[programPropertyName].outgoingPower * percentage / 100
|
||||
|
||||
drawUserNode(node, percentage)
|
||||
if (node.payload.referenceParent !== undefined) {
|
||||
distributeProgramPower(node.payload.referenceParent, mentoshipPower / 10, 0)
|
||||
}
|
||||
break
|
||||
}
|
||||
case 'User Profile': {
|
||||
if (node.tokenPowerSwitch !== undefined) {
|
||||
distributeProgramPower(node.tokenPowerSwitch, mentoshipPower, 0)
|
||||
}
|
||||
break
|
||||
}
|
||||
case 'Token Power Switch': {
|
||||
if (node[programPropertyName] !== undefined) {
|
||||
distributeProgramPower(node[programPropertyName], mentoshipPower, 1)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 incomingPower, to see which proportion of the accumulatedIncomingProgramPower
|
||||
represents.
|
||||
*/
|
||||
if (programNode.payload === undefined) { return }
|
||||
/*
|
||||
If the accumulatedIncomingProgramPower 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 accumulatedIncomingProgramPower 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 accumulatedIncomingProgramPower.
|
||||
*/
|
||||
let totalPowerRewardRatio = accumulatedIncomingProgramPower / programPoolTokenReward
|
||||
if (totalPowerRewardRatio < 1) { totalPowerRewardRatio = 1 }
|
||||
|
||||
if (programNode.tokensAwarded === undefined || programNode.tokensAwarded.payload === undefined) {
|
||||
programNode.payload.uiObject.setErrorMessage("Tokens Awarded Node is needed in order for this Program to get Tokens from the Program Pool.")
|
||||
return
|
||||
}
|
||||
programNode.payload[programPropertyName].awarded.tokens = programNode.payload[programPropertyName].incomingPower * totalPowerRewardRatio
|
||||
|
||||
drawProgram(programNode)
|
||||
}
|
||||
|
||||
function drawUserNode(node, percentage) {
|
||||
if (node.payload !== undefined) {
|
||||
|
||||
const outgoingPowerText = new Intl.NumberFormat().format(node.payload[programPropertyName].outgoingPower)
|
||||
|
||||
node.payload.uiObject.valueAngleOffset = 180
|
||||
node.payload.uiObject.valueAtAngle = true
|
||||
|
||||
node.payload.uiObject.setValue(outgoingPowerText + ' ' + programPowerName)
|
||||
|
||||
node.payload.uiObject.percentageAngleOffset = 180
|
||||
node.payload.uiObject.percentageAtAngle = true
|
||||
|
||||
node.payload.uiObject.setPercentage(percentage)
|
||||
|
||||
node.payload.uiObject.statusAngleOffset = 0
|
||||
node.payload.uiObject.statusAtAngle = false
|
||||
|
||||
node.payload.uiObject.setStatus(outgoingPowerText + ' ' + ' Outgoing Power')
|
||||
}
|
||||
}
|
||||
|
||||
function drawProgram(node) {
|
||||
if (node.payload !== undefined) {
|
||||
|
||||
const ownPowerText = new Intl.NumberFormat().format(node.payload[programPropertyName].ownPower)
|
||||
const incomingPowerText = new Intl.NumberFormat().format(node.payload[programPropertyName].incomingPower)
|
||||
|
||||
node.payload.uiObject.statusAngleOffset = 0
|
||||
node.payload.uiObject.statusAtAngle = false
|
||||
|
||||
node.payload.uiObject.setStatus(ownPowerText + ' Own Power - ' + incomingPowerText + ' Incoming Power')
|
||||
}
|
||||
if (node.tokensAwarded !== undefined && node.tokensAwarded.payload !== undefined) {
|
||||
|
||||
const tokensAwardedText = new Intl.NumberFormat().format(node.payload[programPropertyName].awarded.tokens)
|
||||
|
||||
node.tokensAwarded.payload.uiObject.statusAngleOffset = 0
|
||||
node.tokensAwarded.payload.uiObject.statusAtAngle = false
|
||||
node.tokensAwarded.payload.uiObject.valueAngleOffset = 0
|
||||
node.tokensAwarded.payload.uiObject.valueAtAngle = false
|
||||
|
||||
node.tokensAwarded.payload.uiObject.setValue(tokensAwardedText + ' SA Tokens')
|
||||
node.tokensAwarded.payload.uiObject.setStatus('From ' + node.payload[programPropertyName].count + ' Descendants.')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1003,6 +1003,11 @@
|
||||
"propertyName": "referralProgram",
|
||||
"functionName": "newGovernanceFunctionLibraryReferralProgram"
|
||||
},
|
||||
{
|
||||
"name": "Support Program",
|
||||
"propertyName": "supportProgram",
|
||||
"functionName": "newGovernanceFunctionLibrarySupportProgram"
|
||||
},
|
||||
{
|
||||
"name": "Mentorship Program",
|
||||
"propertyName": "mentorshipProgram",
|
||||
@@ -1019,6 +1024,11 @@
|
||||
"name": "Pools",
|
||||
"propertyName": "pools",
|
||||
"functionName": "newFoundationsUtilitiesPools"
|
||||
},
|
||||
{
|
||||
"name": "Mandatory Program",
|
||||
"propertyName": "mandatoryProgram",
|
||||
"functionName": "newFoundationsUtilitiesMandatoryProgram"
|
||||
}
|
||||
],
|
||||
"spaces": [
|
||||
|
||||
Reference in new issue
Block a user