From b97db15d8fa4b5dfa779dd00efcad55ab509338a Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 1 Oct 2021 11:19:29 +0200 Subject: [PATCH] Reputation bug fixed --- .../UI/Spaces/User-Profile-Space/UserProfile.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Projects/Governance/UI/Spaces/User-Profile-Space/UserProfile.js b/Projects/Governance/UI/Spaces/User-Profile-Space/UserProfile.js index a40745969..109ad5f96 100644 --- a/Projects/Governance/UI/Spaces/User-Profile-Space/UserProfile.js +++ b/Projects/Governance/UI/Spaces/User-Profile-Space/UserProfile.js @@ -121,11 +121,15 @@ function newGovernanceUserProfileSpace() { if (transfer.contractAddress !== UI.projects.governance.globals.saToken.SA_TOKEN_BSC_CONTRACT_ADDRESS) { continue } if (transfer.from !== UI.projects.governance.globals.saToken.SA_TOKEN_BSC_TREASURY_ACCOUNT_ADDRESS) { continue } + if (transfer.to === '0x9F25cc5f3e70b907269CebbB45D812313b3e9143'.toLowerCase()) { + console.log(JSON.stringify(transfer)) + } let currentReputation = Number(transfer.value) / UI.projects.governance.globals.saToken.SA_TOKEN_BSC_DECIMAL_FACTOR - let previousReputation = reputationByAddress.get(transfer.to) + let previousReputation = reputationByAddress.get(transfer.to.toLowerCase()) let newReputation = previousReputation | 0 + currentReputation - reputationByAddress.set(transfer.to, newReputation) + reputationByAddress.set(transfer.to.toLowerCase(), newReputation) } + console.log('[INFO] tokenTransfers = ' + JSON.stringify(tokenTransfers)) if (tokenTransfers.length > 9000) { console.log('[WARN] The total amount of BSC SA Token transfers is above 9000. After 10k this method will need pagination or otherwise users will not get their reputation calculated correctly.') } else { @@ -408,7 +412,7 @@ function newGovernanceUserProfileSpace() { } function getBlockchainTokens(userProfile, blockchainAccount) { - console.log('blockchainAccount ', blockchainAccount) + console.log('User Profile Name: ', userProfile.name, 'blockchainAccount: ', blockchainAccount) const url = "https://api.bscscan.com/api?module=account&action=tokenbalance&contractaddress=" + UI.projects.governance.globals.saToken.SA_TOKEN_BSC_CONTRACT_ADDRESS + "&address=" + blockchainAccount + "&tag=latest&apikey=YourApiKeyToken" fetch(url).then(function (response) {