Merge pull request #1637 from Luis-Fernando-Molina/develop
Contribution: Governance Bug Fixed: Flashing status and values
This commit is contained in:
18 files changed
+256
-85
No files matched your search
@@ -106,8 +106,13 @@ function newGovernanceFunctionLibraryAirdropProgram() {
|
||||
userProfile.payload.blockchainTokens === undefined
|
||||
) {
|
||||
node.payload.airdropProgram.isActive = false
|
||||
userProfile.payload.uiObject.setErrorMessage("You need to setup this profile with the Profile Constructor, to access the Token Power of your account at the Blockchain.")
|
||||
userProfile.payload.uiObject.setErrorMessage(
|
||||
"Airdrop Program: You need to setup this profile with the Profile Constructor, to access the Token Power of your account at the Blockchain.",
|
||||
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
|
||||
)
|
||||
return
|
||||
} else {
|
||||
userProfile.payload.uiObject.resetErrorMessage()
|
||||
}
|
||||
/*
|
||||
Next thing to do is to validate if the airdrop user profile has a star at the Superalgos repository.
|
||||
@@ -117,7 +122,10 @@ function newGovernanceFunctionLibraryAirdropProgram() {
|
||||
profileSignature === undefined
|
||||
) {
|
||||
node.payload.airdropProgram.isActive = false
|
||||
userProfile.payload.uiObject.setErrorMessage("You need to setup this profile with the Profile Constructor, and produce a signature of your Airdrop Username.")
|
||||
userProfile.payload.uiObject.setErrorMessage(
|
||||
"You need to setup this profile with the Profile Constructor, and produce a signature of your Airdrop Username.",
|
||||
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -154,7 +162,10 @@ function newGovernanceFunctionLibraryAirdropProgram() {
|
||||
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.")
|
||||
programNode.payload.uiObject.setErrorMessage(
|
||||
"Tokens Awarded Node is needed in order for this Program to get Tokens from the Program Pool.",
|
||||
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
|
||||
)
|
||||
return
|
||||
}
|
||||
programNode.payload.airdropProgram.awarded.tokens = programNode.payload.airdropProgram.ownPower / totalPowerRewardRatio
|
||||
@@ -170,7 +181,7 @@ function newGovernanceFunctionLibraryAirdropProgram() {
|
||||
node.payload.uiObject.statusAngleOffset = 0
|
||||
node.payload.uiObject.statusAtAngle = false
|
||||
|
||||
node.payload.uiObject.setStatus(ownPowerText + ' Airdrop Power')
|
||||
node.payload.uiObject.setStatus(ownPowerText + ' Airdrop Power', UI.projects.governance.globals.designer.SET_STATUS_COUNTER)
|
||||
}
|
||||
if (node.tokensAwarded !== undefined && node.tokensAwarded.payload !== undefined) {
|
||||
|
||||
@@ -180,12 +191,12 @@ function newGovernanceFunctionLibraryAirdropProgram() {
|
||||
node.tokensAwarded.payload.uiObject.valueAngleOffset = 0
|
||||
node.tokensAwarded.payload.uiObject.valueAtAngle = false
|
||||
|
||||
node.tokensAwarded.payload.uiObject.setValue(tokensAwardedText + ' SA Tokens' + tokensAwardedBTC)
|
||||
node.tokensAwarded.payload.uiObject.setValue(tokensAwardedText + ' SA Tokens' + tokensAwardedBTC, UI.projects.governance.globals.designer.SET_VALUE_COUNTER)
|
||||
|
||||
node.tokensAwarded.payload.uiObject.statusAngleOffset = 0
|
||||
node.tokensAwarded.payload.uiObject.statusAtAngle = false
|
||||
|
||||
node.tokensAwarded.payload.uiObject.setStatus('For creating your Superalgos profile!')
|
||||
node.tokensAwarded.payload.uiObject.setStatus('For creating your Superalgos profile!', UI.projects.governance.globals.designer.SET_STATUS_COUNTER)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,10 +12,16 @@ function newGovernanceFunctionLibraryAssets() {
|
||||
let folderPath = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(node.payload, 'folderPath')
|
||||
|
||||
if (folderPath === undefined || folderPath === "") {
|
||||
node.payload.uiObject.setErrorMessage("folderPath Config Property undefined.")
|
||||
node.payload.uiObject.setErrorMessage(
|
||||
"folderPath Config Property undefined.",
|
||||
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
|
||||
)
|
||||
return
|
||||
}
|
||||
node.payload.uiObject.setInfoMessage("Hold on while we install all the assets inside the this path: " + folderPath + ". This might take a minute or two.")
|
||||
node.payload.uiObject.setInfoMessage(
|
||||
"Hold on while we install all the assets inside the this path: " + folderPath + ". This might take a minute or two.",
|
||||
UI.projects.governance.globals.designer.SET_INFO_COUNTER_FACTOR
|
||||
)
|
||||
httpRequest(undefined, 'DirContent' + '/' + folderPath, onResponse)
|
||||
|
||||
function onResponse(err, data) {
|
||||
@@ -32,7 +38,10 @@ function newGovernanceFunctionLibraryAssets() {
|
||||
totalAssets++
|
||||
createNodesFromPath(node, foldersArray)
|
||||
}
|
||||
node.payload.uiObject.setInfoMessage("A total of : " + totalAssets + " assets have been installed.")
|
||||
node.payload.uiObject.setInfoMessage(
|
||||
"A total of : " + totalAssets + " assets have been installed.",
|
||||
UI.projects.governance.globals.designer.SET_INFO_COUNTER_FACTOR
|
||||
)
|
||||
}
|
||||
|
||||
function removeFirstFromArray(array) {
|
||||
|
||||
@@ -350,7 +350,10 @@ function newGovernanceFunctionLibraryClaimsProgram() {
|
||||
}
|
||||
}
|
||||
if (totalPercentage > 100) {
|
||||
node.payload.uiObject.setErrorMessage('Claim Power Switching Error. Total Percentage of children nodes is grater that 100.')
|
||||
node.payload.uiObject.setErrorMessage(
|
||||
'Claim Power Switching Error. Total Percentage of children nodes is grater that 100.',
|
||||
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
|
||||
)
|
||||
return
|
||||
}
|
||||
let defaultPercentage = 0
|
||||
@@ -446,7 +449,7 @@ function newGovernanceFunctionLibraryClaimsProgram() {
|
||||
'Shared Between: ' + node.payload.claimsProgram.share.count + ' claims' + ' - ' +
|
||||
'Share of Claims: ' + node.payload.claimsProgram.share.percentage.toFixed(2) + '%'
|
||||
|
||||
node.payload.uiObject.setStatus(status)
|
||||
node.payload.uiObject.setStatus(status, UI.projects.governance.globals.designer.SET_STATUS_COUNTER)
|
||||
}
|
||||
|
||||
function drawProgram(node) {
|
||||
@@ -457,7 +460,7 @@ function newGovernanceFunctionLibraryClaimsProgram() {
|
||||
node.payload.uiObject.statusAngleOffset = 0
|
||||
node.payload.uiObject.statusAtAngle = false
|
||||
|
||||
node.payload.uiObject.setStatus(ownPowerText + ' Claim Power')
|
||||
node.payload.uiObject.setStatus(ownPowerText + ' Claim Power', UI.projects.governance.globals.designer.SET_STATUS_COUNTER)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -472,8 +475,8 @@ function newGovernanceFunctionLibraryClaimsProgram() {
|
||||
node.tokensAwarded.payload.uiObject.statusAngleOffset = 0
|
||||
node.tokensAwarded.payload.uiObject.statusAtAngle = true
|
||||
|
||||
node.tokensAwarded.payload.uiObject.setValue(tokensAwardedText + ' SA Tokens' + tokensAwardedBTC)
|
||||
node.tokensAwarded.payload.uiObject.setStatus('From ' + node.payload.claimsProgram.count + ' Claims.')
|
||||
node.tokensAwarded.payload.uiObject.setValue(tokensAwardedText + ' SA Tokens' + tokensAwardedBTC, UI.projects.governance.globals.designer.SET_VALUE_COUNTER)
|
||||
node.tokensAwarded.payload.uiObject.setStatus('From ' + node.payload.claimsProgram.count + ' Claims.', UI.projects.governance.globals.designer.SET_STATUS_COUNTER)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -489,7 +492,9 @@ function newGovernanceFunctionLibraryClaimsProgram() {
|
||||
node.payload.uiObject.setValue(programPowerText)
|
||||
|
||||
if (percentage !== undefined) {
|
||||
node.payload.uiObject.setPercentage(percentage.toFixed(2))
|
||||
node.payload.uiObject.setPercentage(percentage.toFixed(2),
|
||||
UI.projects.governance.globals.designer.SET_PERCENTAGE_COUNTER
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -498,7 +503,10 @@ function newGovernanceFunctionLibraryClaimsProgram() {
|
||||
function installMissingClaims(node, rootNodes) {
|
||||
if (node.payload === undefined) { return }
|
||||
if (node.payload.referenceParent === undefined) {
|
||||
node.payload.uiObject.setErrorMessage('To Install Missing Claims you need a Reference Parent')
|
||||
node.payload.uiObject.setErrorMessage(
|
||||
'To Install Missing Claims you need a Reference Parent',
|
||||
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
|
||||
)
|
||||
return
|
||||
}
|
||||
scanNodeBranch(node, node.payload.referenceParent)
|
||||
|
||||
@@ -211,7 +211,10 @@ function newGovernanceFunctionLibraryDelegationProgram() {
|
||||
}
|
||||
}
|
||||
if (totalPercentage > 100) {
|
||||
node.payload.uiObject.setErrorMessage('Delegate Power Switching Error. Total Percentage of children nodes is grater that 100.')
|
||||
node.payload.uiObject.setErrorMessage(
|
||||
'Delegate Power Switching Error. Total Percentage of children nodes is grater that 100.',
|
||||
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
|
||||
)
|
||||
return
|
||||
}
|
||||
let defaultPercentage = 0
|
||||
@@ -278,7 +281,9 @@ function newGovernanceFunctionLibraryDelegationProgram() {
|
||||
drawProgram(node)
|
||||
|
||||
if (percentage !== undefined) {
|
||||
node.payload.uiObject.setPercentage(percentage.toFixed(2))
|
||||
node.payload.uiObject.setPercentage(percentage.toFixed(2),
|
||||
UI.projects.governance.globals.designer.SET_PERCENTAGE_COUNTER
|
||||
)
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -294,10 +299,12 @@ function newGovernanceFunctionLibraryDelegationProgram() {
|
||||
let powerType = 'Delegate Power'
|
||||
|
||||
const programPowerText = parseFloat(programPower.toFixed(0)).toLocaleString('en') + ' ' + powerType
|
||||
node.payload.uiObject.setValue(programPowerText)
|
||||
node.payload.uiObject.setValue(programPowerText, UI.projects.governance.globals.designer.SET_VALUE_COUNTER)
|
||||
|
||||
if (percentage !== undefined) {
|
||||
node.payload.uiObject.setPercentage(percentage.toFixed(2))
|
||||
node.payload.uiObject.setPercentage(percentage.toFixed(2),
|
||||
UI.projects.governance.globals.designer.SET_PERCENTAGE_COUNTER
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -310,18 +317,20 @@ function newGovernanceFunctionLibraryDelegationProgram() {
|
||||
node.payload.uiObject.valueAngleOffset = 180
|
||||
node.payload.uiObject.valueAtAngle = true
|
||||
|
||||
node.payload.uiObject.setValue(outgoingPowerText + ' Delegate Power')
|
||||
node.payload.uiObject.setValue(outgoingPowerText + ' Delegate Power', UI.projects.governance.globals.designer.SET_VALUE_COUNTER)
|
||||
|
||||
node.payload.uiObject.percentageAngleOffset = 180
|
||||
node.payload.uiObject.percentageAtAngle = true
|
||||
|
||||
node.payload.uiObject.setPercentage(percentage)
|
||||
node.payload.uiObject.setPercentage(percentage,
|
||||
UI.projects.governance.globals.designer.SET_PERCENTAGE_COUNTER
|
||||
)
|
||||
|
||||
if (node.payload.referenceParent !== undefined) {
|
||||
node.payload.uiObject.statusAngleOffset = 0
|
||||
node.payload.uiObject.statusAtAngle = true
|
||||
|
||||
node.payload.uiObject.setStatus(outgoingPowerText + ' ' + ' Outgoing Power')
|
||||
node.payload.uiObject.setStatus(outgoingPowerText + ' ' + ' Outgoing Power', UI.projects.governance.globals.designer.SET_STATUS_COUNTER)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -334,7 +343,7 @@ function newGovernanceFunctionLibraryDelegationProgram() {
|
||||
node.payload.uiObject.statusAngleOffset = 0
|
||||
node.payload.uiObject.statusAtAngle = false
|
||||
|
||||
node.payload.uiObject.setStatus(ownPowerText + ' Delegate Power')
|
||||
node.payload.uiObject.setStatus(ownPowerText + ' Delegate Power', UI.projects.governance.globals.designer.SET_STATUS_COUNTER)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,8 +106,13 @@ function newGovernanceFunctionLibraryGithubProgram() {
|
||||
userProfile.payload.blockchainTokens === undefined
|
||||
) {
|
||||
node.payload.githubProgram.isActive = false
|
||||
userProfile.payload.uiObject.setErrorMessage("You need to setup this profile with the Profile Constructor, to access the Token Power of your account at the Blockchain.")
|
||||
userProfile.payload.uiObject.setErrorMessage(
|
||||
"Github Program: You need to setup this profile with the Profile Constructor, to access the Token Power of your account at the Blockchain.",
|
||||
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
|
||||
)
|
||||
return
|
||||
} else {
|
||||
userProfile.payload.uiObject.resetErrorMessage()
|
||||
}
|
||||
/*
|
||||
Next thing to do is to validate if the github user profile has a star at the Superalgos repository.
|
||||
@@ -117,7 +122,10 @@ function newGovernanceFunctionLibraryGithubProgram() {
|
||||
profileSignature === undefined
|
||||
) {
|
||||
node.payload.githubProgram.isActive = false
|
||||
userProfile.payload.uiObject.setErrorMessage("You need to setup this profile with the Profile Constructor, and produce a signature of your Github Username.")
|
||||
userProfile.payload.uiObject.setErrorMessage(
|
||||
"You need to setup this profile with the Profile Constructor, and produce a signature of your Github Username.",
|
||||
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
|
||||
)
|
||||
return
|
||||
}
|
||||
let githubUsername = profileSignature.message
|
||||
@@ -168,7 +176,10 @@ function newGovernanceFunctionLibraryGithubProgram() {
|
||||
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.")
|
||||
programNode.payload.uiObject.setErrorMessage(
|
||||
"Tokens Awarded Node is needed in order for this Program to get Tokens from the Program Pool.",
|
||||
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
|
||||
)
|
||||
return
|
||||
}
|
||||
const MAX_ENGAGEMENT = 3
|
||||
@@ -185,7 +196,7 @@ function newGovernanceFunctionLibraryGithubProgram() {
|
||||
node.payload.uiObject.statusAngleOffset = 0
|
||||
node.payload.uiObject.statusAtAngle = false
|
||||
|
||||
node.payload.uiObject.setStatus(ownPowerText + ' Github Power')
|
||||
node.payload.uiObject.setStatus(ownPowerText + ' Github Power', UI.projects.governance.globals.designer.SET_STATUS_COUNTER)
|
||||
}
|
||||
if (node.tokensAwarded !== undefined && node.tokensAwarded.payload !== undefined) {
|
||||
|
||||
@@ -195,7 +206,7 @@ function newGovernanceFunctionLibraryGithubProgram() {
|
||||
node.tokensAwarded.payload.uiObject.valueAngleOffset = 0
|
||||
node.tokensAwarded.payload.uiObject.valueAtAngle = false
|
||||
|
||||
node.tokensAwarded.payload.uiObject.setValue(tokensAwardedText + ' SA Tokens' + tokensAwardedBTC)
|
||||
node.tokensAwarded.payload.uiObject.setValue(tokensAwardedText + ' SA Tokens' + tokensAwardedBTC, UI.projects.governance.globals.designer.SET_VALUE_COUNTER)
|
||||
|
||||
node.tokensAwarded.payload.uiObject.statusAngleOffset = 0
|
||||
node.tokensAwarded.payload.uiObject.statusAtAngle = false
|
||||
@@ -211,7 +222,7 @@ function newGovernanceFunctionLibraryGithubProgram() {
|
||||
extraText = extraText + ' + 1 Fork'
|
||||
}
|
||||
|
||||
node.tokensAwarded.payload.uiObject.setStatus('From' + extraText)
|
||||
node.tokensAwarded.payload.uiObject.setStatus('From' + extraText, UI.projects.governance.globals.designer.SET_STATUS_COUNTER)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,10 @@ function newGovernanceFunctionLibraryPluginsFunctions() {
|
||||
let projectName = UI.projects.foundations.utilities.plugins.getProjectName(node)
|
||||
if (projectName === "" || projectName === undefined) {
|
||||
if (node.payload.parentNode !== undefined) {
|
||||
node.payload.parentNode.payload.uiObject.setErrorMessage("Config codeName must have the name of the project.")
|
||||
node.payload.parentNode.payload.uiObject.setErrorMessage(
|
||||
"Config codeName must have the name of the project.",
|
||||
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
|
||||
)
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -28,7 +31,10 @@ function newGovernanceFunctionLibraryPluginsFunctions() {
|
||||
let projectName = UI.projects.foundations.utilities.plugins.getProjectName(node)
|
||||
if (projectName === "" || projectName === undefined) {
|
||||
if (node.payload.parentNode !== undefined) {
|
||||
node.payload.parentNode.payload.uiObject.setErrorMessage("Config codeName must have the name of the project.")
|
||||
node.payload.parentNode.payload.uiObject.setErrorMessage(
|
||||
"Config codeName must have the name of the project.",
|
||||
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
|
||||
)
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -44,7 +50,10 @@ function newGovernanceFunctionLibraryPluginsFunctions() {
|
||||
let projectName = UI.projects.foundations.utilities.plugins.getProjectName(node)
|
||||
if (projectName === "" || projectName === undefined) {
|
||||
if (node.payload.parentNode !== undefined) {
|
||||
node.payload.parentNode.payload.uiObject.setErrorMessage("Config codeName must have the name of the project.")
|
||||
node.payload.parentNode.payload.uiObject.setErrorMessage(
|
||||
"Config codeName must have the name of the project.",
|
||||
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
|
||||
)
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -60,7 +69,10 @@ function newGovernanceFunctionLibraryPluginsFunctions() {
|
||||
let projectName = UI.projects.foundations.utilities.plugins.getProjectName(node)
|
||||
if (projectName === "" || projectName === undefined) {
|
||||
if (node.payload.parentNode !== undefined) {
|
||||
node.payload.parentNode.payload.uiObject.setErrorMessage("Config codeName must have the name of the project.")
|
||||
node.payload.parentNode.payload.uiObject.setErrorMessage(
|
||||
"Config codeName must have the name of the project.",
|
||||
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
|
||||
)
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -76,7 +88,10 @@ function newGovernanceFunctionLibraryPluginsFunctions() {
|
||||
let projectName = UI.projects.foundations.utilities.plugins.getProjectName(node)
|
||||
if (projectName === "" || projectName === undefined) {
|
||||
if (node.payload.parentNode !== undefined) {
|
||||
node.payload.parentNode.payload.uiObject.setErrorMessage("Config codeName must have the name of the project.")
|
||||
node.payload.parentNode.payload.uiObject.setErrorMessage(
|
||||
"Config codeName must have the name of the project.",
|
||||
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
|
||||
)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,10 @@ function newGovernanceFunctionLibraryProfileConstructor() {
|
||||
let mnemonic = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(node.payload, 'mnemonic')
|
||||
|
||||
if (githubUsername === undefined || githubUsername === "") {
|
||||
node.payload.uiObject.setErrorMessage("githubUsername config property missing.")
|
||||
node.payload.uiObject.setErrorMessage(
|
||||
"githubUsername config property missing.",
|
||||
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -48,7 +51,10 @@ function newGovernanceFunctionLibraryProfileConstructor() {
|
||||
function onResponse(err, data) {
|
||||
/* Lets check the result of the call through the http interface */
|
||||
if (err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
|
||||
node.payload.uiObject.setErrorMessage('Call via HTTP Interface failed.')
|
||||
node.payload.uiObject.setErrorMessage(
|
||||
'Call via HTTP Interface failed.',
|
||||
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -58,11 +64,17 @@ function newGovernanceFunctionLibraryProfileConstructor() {
|
||||
if (response.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
|
||||
|
||||
if (mnemonic === undefined || mnemonic === "") {
|
||||
node.payload.uiObject.setErrorMessage('Call to WEB3 Server failed. ' + response.error)
|
||||
node.payload.uiObject.setErrorMessage(
|
||||
'Call to WEB3 Server failed. ' + response.error,
|
||||
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
|
||||
)
|
||||
console.log('Call to WEB3 Server failed. ' + response.error)
|
||||
return
|
||||
} else {
|
||||
node.payload.uiObject.setErrorMessage('Call to WEB3 Server failed. Most likely the Mnemonic provided is not correct or you need to run node setup because a dependency is missing. ' + response.error)
|
||||
node.payload.uiObject.setErrorMessage(
|
||||
'Call to WEB3 Server failed. Most likely the Mnemonic provided is not correct or you need to run node setup because a dependency is missing. ' + response.error,
|
||||
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
|
||||
)
|
||||
console.log('Call to WEB3 Server failed. Most likely the Mnemonic provided is not correct or you need to run node setup because a dependency is missing. ' + response.error)
|
||||
return
|
||||
}
|
||||
@@ -88,7 +100,10 @@ function newGovernanceFunctionLibraryProfileConstructor() {
|
||||
function onResponse(err, data) {
|
||||
/* Lets check the result of the call through the http interface */
|
||||
if (err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
|
||||
node.payload.uiObject.setErrorMessage('Call via HTTP Interface failed.')
|
||||
node.payload.uiObject.setErrorMessage(
|
||||
'Call via HTTP Interface failed.',
|
||||
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -96,7 +111,10 @@ function newGovernanceFunctionLibraryProfileConstructor() {
|
||||
|
||||
/* Lets check the result of the method call */
|
||||
if (response.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
|
||||
node.payload.uiObject.setErrorMessage('Call to WEB3 Server failed. ' + response.error)
|
||||
node.payload.uiObject.setErrorMessage(
|
||||
'Call to WEB3 Server failed. ' + response.error,
|
||||
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
|
||||
)
|
||||
console.log('Call to WEB3 Server failed. ' + response.error)
|
||||
return
|
||||
}
|
||||
@@ -124,9 +142,15 @@ function newGovernanceFunctionLibraryProfileConstructor() {
|
||||
Show nice message.
|
||||
*/
|
||||
if (mnemonic === undefined || mnemonic === "") {
|
||||
node.payload.uiObject.setInfoMessage("Profile Private Key has been successfully created. User Profile installed as a plugin and saved. Use the Private Key at a crypto wallet and delete this node once done.", 10000)
|
||||
node.payload.uiObject.setInfoMessage(
|
||||
"Profile Private Key has been successfully created. User Profile installed as a plugin and saved. Use the Private Key at a crypto wallet and delete this node once done.",
|
||||
UI.projects.governance.globals.designer.SET_INFO_COUNTER_FACTOR
|
||||
)
|
||||
} else {
|
||||
node.payload.uiObject.setInfoMessage("Mnemonic successfully imported. User Profile installed as a plugin and saved. Your external wallet was sucessfully linked to your profile.", 10000)
|
||||
node.payload.uiObject.setInfoMessage(
|
||||
"Mnemonic successfully imported. User Profile installed as a plugin and saved. Your external wallet was sucessfully linked to your profile.",
|
||||
UI.projects.governance.globals.designer.SET_INFO_COUNTER_FACTOR
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,10 +106,15 @@ function newGovernanceFunctionLibraryStakingProgram() {
|
||||
userProfile.payload.blockchainTokens === undefined
|
||||
) {
|
||||
node.payload.stakingProgram.isActive = false
|
||||
userProfile.payload.uiObject.setErrorMessage("You need to setup this profile with the Profile Constructor, to access the Token Power of your account at the Blockchain.")
|
||||
userProfile.payload.uiObject.setErrorMessage(
|
||||
"Staking Program: You need to setup this profile with the Profile Constructor, to access the Token Power of your account at the Blockchain.",
|
||||
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
|
||||
)
|
||||
return
|
||||
} else {
|
||||
userProfile.payload.uiObject.resetErrorMessage()
|
||||
node.payload.stakingProgram.isActive = true
|
||||
}
|
||||
node.payload.stakingProgram.isActive = true
|
||||
}
|
||||
|
||||
function distributeProgram(programNode) {
|
||||
@@ -142,7 +147,10 @@ function newGovernanceFunctionLibraryStakingProgram() {
|
||||
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.")
|
||||
programNode.payload.uiObject.setErrorMessage(
|
||||
"Tokens Awarded Node is needed in order for this Program to get Tokens from the Program Pool.",
|
||||
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
|
||||
)
|
||||
return
|
||||
}
|
||||
programNode.payload.stakingProgram.awarded.tokens = programNode.payload.stakingProgram.ownPower / totalPowerRewardRatio
|
||||
@@ -158,7 +166,7 @@ function newGovernanceFunctionLibraryStakingProgram() {
|
||||
node.payload.uiObject.statusAngleOffset = 0
|
||||
node.payload.uiObject.statusAtAngle = false
|
||||
|
||||
node.payload.uiObject.setStatus(ownPowerText + ' Staking Power')
|
||||
node.payload.uiObject.setStatus(ownPowerText + ' Staking Power', UI.projects.governance.globals.designer.SET_STATUS_COUNTER)
|
||||
}
|
||||
if (node.tokensAwarded !== undefined && node.tokensAwarded.payload !== undefined) {
|
||||
|
||||
@@ -168,7 +176,7 @@ function newGovernanceFunctionLibraryStakingProgram() {
|
||||
node.tokensAwarded.payload.uiObject.valueAngleOffset = 0
|
||||
node.tokensAwarded.payload.uiObject.valueAtAngle = false
|
||||
|
||||
node.tokensAwarded.payload.uiObject.setValue(tokensAwardedText + ' SA Tokens' + tokensAwardedBTC)
|
||||
node.tokensAwarded.payload.uiObject.setValue(tokensAwardedText + ' SA Tokens' + tokensAwardedBTC, UI.projects.governance.globals.designer.SET_VALUE_COUNTER)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,8 +174,8 @@ function newGovernanceFunctionLibraryTokenMining() {
|
||||
userProfile.tokensMined.payload.uiObject.valueAngleOffset = 0
|
||||
userProfile.tokensMined.payload.uiObject.valueAtAngle = true
|
||||
|
||||
userProfile.tokensMined.payload.uiObject.setStatus(awarded + ' Awarded + ' + bonus + ' Bonus')
|
||||
userProfile.tokensMined.payload.uiObject.setValue(total + ' SA Tokens' + tokensAwardedBTC)
|
||||
userProfile.tokensMined.payload.uiObject.setStatus(awarded + ' Awarded + ' + bonus + ' Bonus', UI.projects.governance.globals.designer.SET_STATUS_COUNTER)
|
||||
userProfile.tokensMined.payload.uiObject.setValue(total + ' SA Tokens' + tokensAwardedBTC, UI.projects.governance.globals.designer.SET_VALUE_COUNTER)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -96,7 +96,10 @@ function newGovernanceFunctionLibraryTokenPower() {
|
||||
Before we start we will do some validations:
|
||||
*/
|
||||
if (userProfile.tokenPowerSwitch === undefined) {
|
||||
userProfile.payload.uiObject.setErrorMessage("You need to have a Token Power Switch child node.")
|
||||
userProfile.payload.uiObject.setErrorMessage(
|
||||
"You need to have a Token Power Switch child node.",
|
||||
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
|
||||
)
|
||||
return
|
||||
}
|
||||
distributeTokenPower(
|
||||
@@ -119,7 +122,10 @@ function newGovernanceFunctionLibraryTokenPower() {
|
||||
Before we start we will do some validations:
|
||||
*/
|
||||
if (userProfile.tokenPowerSwitch === undefined) {
|
||||
userProfile.payload.uiObject.setErrorMessage("You need to have a Token Power Switch child node.")
|
||||
userProfile.payload.uiObject.setErrorMessage(
|
||||
"You need to have a Token Power Switch child node.",
|
||||
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
|
||||
)
|
||||
return
|
||||
}
|
||||
distributeTokenPower(
|
||||
@@ -213,7 +219,10 @@ function newGovernanceFunctionLibraryTokenPower() {
|
||||
}
|
||||
}
|
||||
if (totalPercentage > 100) {
|
||||
node.payload.uiObject.setErrorMessage('Token Power Switching Error. Total Percentage of children nodes is grater that 100.')
|
||||
node.payload.uiObject.setErrorMessage(
|
||||
'Token Power Switching Error. Total Percentage of children nodes is grater that 100.',
|
||||
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
|
||||
)
|
||||
return
|
||||
}
|
||||
let defaultPercentage = 0
|
||||
@@ -287,7 +296,7 @@ function newGovernanceFunctionLibraryTokenPower() {
|
||||
|
||||
node.payload.uiObject.valueAngleOffset = 0
|
||||
node.payload.uiObject.valueAtAngle = false
|
||||
node.payload.uiObject.setStatus(ownPowerText + ' + ' + incomingPowerText)
|
||||
node.payload.uiObject.setStatus(ownPowerText + ' + ' + incomingPowerText, UI.projects.governance.globals.designer.SET_STATUS_COUNTER)
|
||||
|
||||
return
|
||||
}
|
||||
@@ -297,12 +306,14 @@ function newGovernanceFunctionLibraryTokenPower() {
|
||||
node.payload.uiObject.valueAngleOffset = 180
|
||||
node.payload.uiObject.valueAtAngle = true
|
||||
|
||||
node.payload.uiObject.setValue(tokenPowerText)
|
||||
node.payload.uiObject.setValue(tokenPowerText, UI.projects.governance.globals.designer.SET_VALUE_COUNTER)
|
||||
|
||||
if (percentage !== undefined) {
|
||||
node.payload.uiObject.percentageAngleOffset = 180
|
||||
node.payload.uiObject.percentageAtAngle = true
|
||||
node.payload.uiObject.setPercentage(percentage.toFixed(2))
|
||||
node.payload.uiObject.setPercentage(percentage.toFixed(2),
|
||||
UI.projects.governance.globals.designer.SET_PERCENTAGE_COUNTER
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ function newGovernanceFunctionLibraryTokens() {
|
||||
node.payload.uiObject.statusAngleOffset = 0
|
||||
node.payload.uiObject.statusAtAngle = true
|
||||
|
||||
node.payload.uiObject.setStatus(status)
|
||||
node.payload.uiObject.setStatus(status, UI.projects.governance.globals.designer.SET_STATUS_COUNTER)
|
||||
} else {
|
||||
status = 'Reward: ' + tokens.toLocaleString('en')
|
||||
+ ' ' + 'SA' + ' ≃ ' + UI.projects.governance.utilities.conversions.estimateSATokensInBTC(tokens | 0) + ' BTC '
|
||||
@@ -181,7 +181,7 @@ function newGovernanceFunctionLibraryTokens() {
|
||||
node.payload.uiObject.statusAngleOffset = 0
|
||||
node.payload.uiObject.statusAtAngle = false
|
||||
|
||||
node.payload.uiObject.setStatus(status)
|
||||
node.payload.uiObject.setStatus(status, UI.projects.governance.globals.designer.SET_STATUS_COUNTER)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -334,7 +334,10 @@ function newGovernanceFunctionLibraryVotingProgram() {
|
||||
}
|
||||
}
|
||||
if (totalPercentage > 100) {
|
||||
node.payload.uiObject.setErrorMessage('Voting Power Switching Error. Total Percentage of children nodes is grater that 100.')
|
||||
node.payload.uiObject.setErrorMessage(
|
||||
'Voting Power Switching Error. Total Percentage of children nodes is grater that 100.',
|
||||
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
|
||||
)
|
||||
return
|
||||
}
|
||||
let defaultPercentage = 0
|
||||
@@ -406,7 +409,9 @@ function newGovernanceFunctionLibraryVotingProgram() {
|
||||
drawProgram(node, userProfile)
|
||||
|
||||
if (percentage !== undefined) {
|
||||
node.payload.uiObject.setPercentage(percentage.toFixed(2))
|
||||
node.payload.uiObject.setPercentage(percentage.toFixed(2),
|
||||
UI.projects.governance.globals.designer.SET_PERCENTAGE_COUNTER
|
||||
)
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -457,10 +462,12 @@ function newGovernanceFunctionLibraryVotingProgram() {
|
||||
node.payload.uiObject.valueAngleOffset = 0
|
||||
node.payload.uiObject.valueAtAngle = true
|
||||
|
||||
node.payload.uiObject.setValue(votesText)
|
||||
node.payload.uiObject.setValue(votesText, UI.projects.governance.globals.designer.SET_VALUE_COUNTER)
|
||||
|
||||
if (percentage !== undefined) {
|
||||
node.payload.uiObject.setPercentage(percentage.toFixed(2))
|
||||
node.payload.uiObject.setPercentage(percentage.toFixed(2),
|
||||
UI.projects.governance.globals.designer.SET_PERCENTAGE_COUNTER
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -472,18 +479,20 @@ function newGovernanceFunctionLibraryVotingProgram() {
|
||||
node.payload.uiObject.valueAngleOffset = 180
|
||||
node.payload.uiObject.valueAtAngle = true
|
||||
|
||||
node.payload.uiObject.setValue(outgoingPowerText + ' Voting Power')
|
||||
node.payload.uiObject.setValue(outgoingPowerText + ' Voting Power', UI.projects.governance.globals.designer.SET_VALUE_COUNTER)
|
||||
|
||||
node.payload.uiObject.percentageAngleOffset = 180
|
||||
node.payload.uiObject.percentageAtAngle = true
|
||||
|
||||
node.payload.uiObject.setPercentage(percentage)
|
||||
node.payload.uiObject.setPercentage(percentage,
|
||||
UI.projects.governance.globals.designer.SET_PERCENTAGE_COUNTER
|
||||
)
|
||||
|
||||
if (node.payload.referenceParent !== undefined) {
|
||||
node.payload.uiObject.statusAngleOffset = 0
|
||||
node.payload.uiObject.statusAtAngle = true
|
||||
|
||||
node.payload.uiObject.setStatus(outgoingPowerText + ' ' + ' Outgoing Power')
|
||||
node.payload.uiObject.setStatus(outgoingPowerText + ' ' + ' Outgoing Power', UI.projects.governance.globals.designer.SET_STATUS_COUNTER)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -502,7 +511,7 @@ function newGovernanceFunctionLibraryVotingProgram() {
|
||||
node.payload.uiObject.statusAngleOffset = 0
|
||||
node.payload.uiObject.statusAtAngle = false
|
||||
|
||||
node.payload.uiObject.setStatus(ownPowerText + ' Own Power' + ' + ' + incomingPowerText + ' Incoming Voting Power' + ' + ' + reputationPowerText + ' Reputation Power')
|
||||
node.payload.uiObject.setStatus(ownPowerText + ' Own Power' + ' + ' + incomingPowerText + ' Incoming Voting Power' + ' + ' + reputationPowerText + ' Reputation Power', UI.projects.governance.globals.designer.SET_STATUS_COUNTER)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -510,7 +519,10 @@ function newGovernanceFunctionLibraryVotingProgram() {
|
||||
function installMissingVotes(node, rootNodes) {
|
||||
if (node.payload === undefined) { return }
|
||||
if (node.payload.referenceParent === undefined) {
|
||||
node.payload.uiObject.setErrorMessage('To install votes you need a Reference Parent')
|
||||
node.payload.uiObject.setErrorMessage(
|
||||
'To install votes you need a Reference Parent',
|
||||
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
|
||||
)
|
||||
return
|
||||
}
|
||||
scanNodeBranch(node, node.payload.referenceParent)
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
function newGovernanceGlobalsDesigner() {
|
||||
let thisObject = {
|
||||
SET_VALUE_COUNTER: 1000,
|
||||
SET_STATUS_COUNTER: 1000,
|
||||
SET_ERROR_COUNTER_FACTOR: 10,
|
||||
SET_INFO_COUNTER_FACTOR: 10,
|
||||
SET_WARNING_COUNTER: 1000,
|
||||
SET_PERCENTAGE_COUNTER: 1000
|
||||
}
|
||||
return thisObject
|
||||
}
|
||||
@@ -365,7 +365,10 @@ function newGovernanceUserProfileSpace() {
|
||||
function onResponse(err, data) {
|
||||
/* Lets check the result of the call through the http interface */
|
||||
if (err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
|
||||
userProfile.payload.uiObject.setErrorMessage('Call via HTTP Interface failed.')
|
||||
userProfile.payload.uiObject.setErrorMessage(
|
||||
'Call via HTTP Interface failed.',
|
||||
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -373,7 +376,10 @@ function newGovernanceUserProfileSpace() {
|
||||
|
||||
/* Lets check the result of the method call */
|
||||
if (response.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
|
||||
userProfile.payload.uiObject.setErrorMessage('Call to WEB3 Server failed. ' + response.error)
|
||||
userProfile.payload.uiObject.setErrorMessage(
|
||||
'Call to WEB3 Server failed. ' + response.error,
|
||||
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
|
||||
)
|
||||
console.log('Call to WEB3 Server failed. ' + response.error)
|
||||
return
|
||||
}
|
||||
@@ -403,7 +409,9 @@ function newGovernanceUserProfileSpace() {
|
||||
if (data.result === "Max rate limit reached, please use API Key for higher rate limit") {
|
||||
userProfile.payload.blockchainTokens = undefined // This enables this profile to query the blockchain again.
|
||||
} else {
|
||||
userProfile.payload.uiObject.setInfoMessage(data)
|
||||
userProfile.payload.uiObject.setInfoMessage(data,
|
||||
UI.projects.governance.globals.designer.SET_INFO_COUNTER_FACTOR
|
||||
)
|
||||
userProfile.payload.blockchainTokens = Number(data.result) / 1000000000000000000
|
||||
userProfile.payload.reputation = Math.min(reputationByAddress.get(blockchainAccount.toLowerCase()) | 0, userProfile.payload.blockchainTokens)
|
||||
}
|
||||
@@ -412,7 +420,9 @@ function newGovernanceUserProfileSpace() {
|
||||
const message = err.message + ' - ' + 'Can not access BSC SCAN servers.'
|
||||
console.log(message)
|
||||
if (userProfile.payload !== undefined) {
|
||||
userProfile.payload.uiObject.setErrorMessage(message, 1000)
|
||||
userProfile.payload.uiObject.setErrorMessage(message,
|
||||
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
|
||||
)
|
||||
}
|
||||
waitingForResponses--
|
||||
});
|
||||
|
||||
@@ -101,8 +101,13 @@ function newGovernanceUtilitiesBonusProgram() {
|
||||
userProfile.payload.blockchainTokens === undefined
|
||||
) {
|
||||
node.payload[programPropertyName].isActive = false
|
||||
userProfile.payload.uiObject.setErrorMessage("You need to setup this profile with the Profile Constructor, to access the Token Power of your account at the Blockchain.")
|
||||
userProfile.payload.uiObject.setErrorMessage(
|
||||
"Bonus Program: You need to setup this profile with the Profile Constructor, to access the Token Power of your account at the Blockchain.",
|
||||
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
|
||||
)
|
||||
return
|
||||
} else {
|
||||
userProfile.payload.uiObject.resetErrorMessage()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,7 +140,10 @@ function newGovernanceUtilitiesBonusProgram() {
|
||||
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 Bonus Program Pool.")
|
||||
programNode.payload.uiObject.setErrorMessage(
|
||||
"Tokens Bonus Node is needed in order for this Program to get Tokens from the Bonus Program Pool.",
|
||||
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
|
||||
)
|
||||
return
|
||||
}
|
||||
programNode.payload[programPropertyName].bonus.tokens = programNode.payload[programPropertyName].bonusPower / totalPowerRewardRatio
|
||||
@@ -152,7 +160,7 @@ function newGovernanceUtilitiesBonusProgram() {
|
||||
node.tokensBonus.payload.uiObject.valueAngleOffset = 0
|
||||
node.tokensBonus.payload.uiObject.valueAtAngle = true
|
||||
|
||||
node.tokensBonus.payload.uiObject.setValue(tokensBonusText + ' SA Tokens' + tokensAwardedBTC)
|
||||
node.tokensBonus.payload.uiObject.setValue(tokensBonusText + ' SA Tokens' + tokensAwardedBTC, UI.projects.governance.globals.designer.SET_VALUE_COUNTER)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,8 +168,13 @@ function newGovernanceUtilitiesDecendentProgram() {
|
||||
userProfile.payload.blockchainTokens === undefined
|
||||
) {
|
||||
node.payload[programPropertyName].isActive = false
|
||||
userProfile.payload.uiObject.setErrorMessage("You need to setup this profile with the Profile Constructor, to access the Token Power of your account at the Blockchain.")
|
||||
userProfile.payload.uiObject.setErrorMessage(
|
||||
"Decendent Program: You need to setup this profile with the Profile Constructor, to access the Token Power of your account at the Blockchain.",
|
||||
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
|
||||
)
|
||||
return
|
||||
} else {
|
||||
userProfile.payload.uiObject.resetErrorMessage()
|
||||
}
|
||||
/*
|
||||
As per the system rules, the Program will not give tokens
|
||||
@@ -182,7 +187,10 @@ function newGovernanceUtilitiesDecendentProgram() {
|
||||
(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.")
|
||||
node.payload.uiObject.setErrorMessage(
|
||||
"In order to enable this program you need to add " + userNodeType + " nodes and reference a User Profile from each one.",
|
||||
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
|
||||
)
|
||||
} else {
|
||||
node.payload[programPropertyName].isActive = true
|
||||
}
|
||||
@@ -282,7 +290,10 @@ function newGovernanceUtilitiesDecendentProgram() {
|
||||
}
|
||||
}
|
||||
if (totalPercentage > 100) {
|
||||
node.payload.uiObject.setErrorMessage('Program Power Switching Error. Total Percentage of children nodes is grater that 100.')
|
||||
node.payload.uiObject.setErrorMessage(
|
||||
'Program Power Switching Error. Total Percentage of children nodes is grater that 100.',
|
||||
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
|
||||
)
|
||||
return
|
||||
}
|
||||
let defaultPercentage = 0
|
||||
@@ -371,7 +382,10 @@ function newGovernanceUtilitiesDecendentProgram() {
|
||||
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.")
|
||||
programNode.payload.uiObject.setErrorMessage(
|
||||
"Tokens Awarded Node is needed in order for this Program to get Tokens from the Program Pool.",
|
||||
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
|
||||
)
|
||||
return
|
||||
}
|
||||
programNode.payload[programPropertyName].awarded.tokens = programNode.payload[programPropertyName].incomingPower / totalPowerRewardRatio
|
||||
@@ -387,17 +401,19 @@ function newGovernanceUtilitiesDecendentProgram() {
|
||||
node.payload.uiObject.valueAngleOffset = 180
|
||||
node.payload.uiObject.valueAtAngle = true
|
||||
|
||||
node.payload.uiObject.setValue(outgoingPowerText + ' ' + programPowerName)
|
||||
node.payload.uiObject.setValue(outgoingPowerText + ' ' + programPowerName, UI.projects.governance.globals.designer.SET_VALUE_COUNTER)
|
||||
|
||||
node.payload.uiObject.percentageAngleOffset = 180
|
||||
node.payload.uiObject.percentageAtAngle = true
|
||||
|
||||
node.payload.uiObject.setPercentage(percentage)
|
||||
node.payload.uiObject.setPercentage(percentage,
|
||||
UI.projects.governance.globals.designer.SET_PERCENTAGE_COUNTER
|
||||
)
|
||||
|
||||
node.payload.uiObject.statusAngleOffset = 0
|
||||
node.payload.uiObject.statusAtAngle = true
|
||||
|
||||
node.payload.uiObject.setStatus(outgoingPowerText + ' ' + ' Outgoing Power')
|
||||
node.payload.uiObject.setStatus(outgoingPowerText + ' ' + ' Outgoing Power', UI.projects.governance.globals.designer.SET_STATUS_COUNTER)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -410,7 +426,7 @@ function newGovernanceUtilitiesDecendentProgram() {
|
||||
node.payload.uiObject.statusAngleOffset = 0
|
||||
node.payload.uiObject.statusAtAngle = false
|
||||
|
||||
node.payload.uiObject.setStatus(ownPowerText + ' Own Power' + ' + ' + incomingPowerText + ' Incoming ' + programPowerName)
|
||||
node.payload.uiObject.setStatus(ownPowerText + ' Own Power' + ' + ' + incomingPowerText + ' Incoming ' + programPowerName, UI.projects.governance.globals.designer.SET_STATUS_COUNTER)
|
||||
}
|
||||
if (node.tokensAwarded !== undefined && node.tokensAwarded.payload !== undefined) {
|
||||
|
||||
@@ -422,8 +438,8 @@ function newGovernanceUtilitiesDecendentProgram() {
|
||||
node.tokensAwarded.payload.uiObject.valueAngleOffset = 0
|
||||
node.tokensAwarded.payload.uiObject.valueAtAngle = true
|
||||
|
||||
node.tokensAwarded.payload.uiObject.setValue(tokensAwardedText + ' SA Tokens' + tokensAwardedBTC)
|
||||
node.tokensAwarded.payload.uiObject.setStatus('From ' + node.payload[programPropertyName].count + ' Descendants.')
|
||||
node.tokensAwarded.payload.uiObject.setValue(tokensAwardedText + ' SA Tokens' + tokensAwardedBTC, UI.projects.governance.globals.designer.SET_VALUE_COUNTER)
|
||||
node.tokensAwarded.payload.uiObject.setStatus('From ' + node.payload[programPropertyName].count + ' Descendants.', UI.projects.governance.globals.designer.SET_STATUS_COUNTER)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,10 @@ function newGovernanceUtilitiesValidations () {
|
||||
let programs = UI.projects.foundations.utilities.branches.nodeBranchToArray(userProfile, programNodeType)
|
||||
if (programs !== undefined) {
|
||||
if (programs.length > 1) {
|
||||
userProfile.payload.uiObject.setErrorMessage('Only one ' + programNodeType + ' is allowed.')
|
||||
userProfile.payload.uiObject.setErrorMessage(
|
||||
'Only one ' + programNodeType + ' is allowed.',
|
||||
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
|
||||
)
|
||||
return
|
||||
}
|
||||
if (programs.length === 1) {
|
||||
|
||||
@@ -1079,6 +1079,11 @@
|
||||
"propertyName": "governance",
|
||||
"UI": {
|
||||
"globals": [
|
||||
{
|
||||
"name": "Designer",
|
||||
"propertyName": "designer",
|
||||
"functionName": "newGovernanceGlobalsDesigner"
|
||||
},
|
||||
{
|
||||
"name": "Reports",
|
||||
"propertyName": "reports",
|
||||
|
||||
Reference in new issue
Block a user