Governance System, bug fixes for web3 calls.

This commit is contained in:
Luis Fernando Molina committed 2021-11-14 13:53:29 +01:00
1 parent c7d89ae6fa
commit 8d2c9d2646
5 files changed
+23 -10

No files matched your search

@@ -24,7 +24,7 @@ function newFoundationsTopSpace() {
logoImage = new Image()
loadImage('superalgos-header-background', backgroundImage)
loadImage('sa-beta12-logo-horiz-dark', logoImage)
loadImage('sa-v10-logo-horiz-dark', logoImage)
function loadImage(name, image) {
const PATH = 'Images/'
@@ -484,10 +484,15 @@ function newGovernanceUserProfileSpace() {
console.log('[WARN] Error fetching blockchain tokens of user profile ' + userProfile.name)
userProfile.payload.blockchainTokens = undefined
} else {
let commandResponse = JSON.parse(data)
if (commandResponse.result !== "Ok") {
console.log('[WARN] Web3 Error fetching blockchain tokens of user profile ' + userProfile.name)
return
}
userProfile.payload.uiObject.setInfoMessage('Blockchain Balance Successfully Loaded.',
UI.projects.governance.globals.designer.SET_INFO_COUNTER_FACTOR
)
userProfile.payload.blockchainTokens = Number(data)
userProfile.payload.blockchainTokens = Number(commandResponse.balance)
console.log('[INFO] SA Balance of ' + userProfile.name + ' is ', userProfile.payload.blockchainTokens)
userProfile.payload.reputation = Math.min(reputationByAddress.get(blockchainAccount.toLowerCase()) | 0, userProfile.payload.blockchainTokens)
console.log('[INFO] Reputation of ' + userProfile.name + ' is ', userProfile.payload.reputation)
@@ -514,10 +519,15 @@ function newGovernanceUserProfileSpace() {
console.log('[WARN] Error fetching liquidity tokens for asset ' + asset + ' of user profile ' + userProfile.name)
userProfile.payload.blockchainTokens = undefined
} else {
let commandResponse = JSON.parse(data)
if (commandResponse.result !== "Ok") {
console.log('[WARN] Web3 Error fetching liquidity tokens for asset ' + asset + ' of user profile ' + userProfile.name)
return
}
userProfile.payload.uiObject.setInfoMessage('Pancake Balance Successfully Loaded for asset ' + asset,
UI.projects.governance.globals.designer.SET_INFO_COUNTER_FACTOR
)
userProfile.payload.liquidityTokens[asset] = Number(data)
userProfile.payload.liquidityTokens[asset] = Number(commandResponse.balance)
console.log('[INFO] Liquidity of ' + userProfile.name + ' for asset ' + asset + ' is ', userProfile.payload.liquidityTokens[asset])
}
}
+1 -1
View File
@@ -22,7 +22,7 @@ exports.newNetworkModulesHttpInterface = function newNetworkModulesHttpInterface
SA.nodeModules.http.createServer(onHttpRequest).listen(port)
}
function onHttpRequest(httpRequest, httpResponse) {
async function onHttpRequest(httpRequest, httpResponse) {
try {
let requestPathAndParameters = httpRequest.url.split('?') // Remove version information
let requestPath = requestPathAndParameters[0].split('/')