Stacking Program Fixed
This commit is contained in:
1 parent
28a89d012e
commit
45bbc0b368
1 file changed
+21
-17
@@ -28,39 +28,43 @@ function newGovernanceFunctionLibraryStackingProgram() {
|
||||
let userProfile = userProfiles[i]
|
||||
|
||||
if (userProfile.tokenPowerSwitch === undefined) { continue }
|
||||
if (userProfile.tokenPowerSwitch.stackingProgram === undefined) { continue }
|
||||
if (userProfile.tokenPowerSwitch.stackingProgram.payload === undefined) { continue }
|
||||
let program = UI.projects.governance.utilities.validations.onlyOneProgram(userProfile, "Staking Program")
|
||||
if (program === undefined) { continue }
|
||||
if (program.payload === undefined) { continue }
|
||||
|
||||
resetProgram(userProfile.tokenPowerSwitch.stackingProgram)
|
||||
resetProgram(program)
|
||||
}
|
||||
for (let i = 0; i < userProfiles.length; i++) {
|
||||
let userProfile = userProfiles[i]
|
||||
|
||||
if (userProfile.tokenPowerSwitch === undefined) { continue }
|
||||
if (userProfile.tokenPowerSwitch.stackingProgram === undefined) { continue }
|
||||
if (userProfile.tokenPowerSwitch.stackingProgram.payload === undefined) { continue }
|
||||
let program = UI.projects.governance.utilities.validations.onlyOneProgram(userProfile, "Staking Program")
|
||||
if (program === undefined) { continue }
|
||||
if (program.payload === undefined) { continue }
|
||||
|
||||
validateProgram(userProfile.tokenPowerSwitch.stackingProgram)
|
||||
validateProgram(program, userProfile)
|
||||
}
|
||||
for (let i = 0; i < userProfiles.length; i++) {
|
||||
let userProfile = userProfiles[i]
|
||||
|
||||
if (userProfile.tokenPowerSwitch === undefined) { continue }
|
||||
if (userProfile.tokenPowerSwitch.stackingProgram === undefined) { continue }
|
||||
if (userProfile.tokenPowerSwitch.stackingProgram.payload === undefined) { continue }
|
||||
if (userProfile.tokenPowerSwitch.stackingProgram.payload.stackingProgram.isActive === false) { continue }
|
||||
let program = UI.projects.governance.utilities.validations.onlyOneProgram(userProfile, "Staking Program")
|
||||
if (program === undefined) { continue }
|
||||
if (program.payload === undefined) { continue }
|
||||
if (program.payload.stackingProgram.isActive === false) { continue }
|
||||
|
||||
distributeProgram(userProfile.tokenPowerSwitch.stackingProgram)
|
||||
distributeProgram(program)
|
||||
}
|
||||
for (let i = 0; i < userProfiles.length; i++) {
|
||||
let userProfile = userProfiles[i]
|
||||
|
||||
if (userProfile.tokenPowerSwitch === undefined) { continue }
|
||||
if (userProfile.tokenPowerSwitch.stackingProgram === undefined) { continue }
|
||||
if (userProfile.tokenPowerSwitch.stackingProgram.payload === undefined) { continue }
|
||||
if (userProfile.tokenPowerSwitch.stackingProgram.payload.stackingProgram.isActive === false) { continue }
|
||||
let program = UI.projects.governance.utilities.validations.onlyOneProgram(userProfile, "Staking Program")
|
||||
if (program === undefined) { continue }
|
||||
if (program.payload === undefined) { continue }
|
||||
if (program.payload.stackingProgram.isActive === false) { continue }
|
||||
|
||||
calculateProgram(userProfile.tokenPowerSwitch.stackingProgram)
|
||||
calculateProgram(program)
|
||||
}
|
||||
|
||||
function resetProgram(node) {
|
||||
@@ -79,17 +83,17 @@ function newGovernanceFunctionLibraryStackingProgram() {
|
||||
}
|
||||
}
|
||||
|
||||
function validateProgram(node) {
|
||||
function validateProgram(node, userProfile) {
|
||||
/*
|
||||
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
|
||||
userProfile.payload.blockchainTokens === undefined
|
||||
) {
|
||||
node.payload.stackingProgram.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.")
|
||||
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.")
|
||||
return
|
||||
}
|
||||
node.payload.stackingProgram.isActive = true
|
||||
|
||||
Reference in new issue
Block a user