Skip to content

Commit

Permalink
fixes requested
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiolalombardim committed Feb 3, 2024
1 parent 5beadc2 commit 9c73493
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
4 changes: 2 additions & 2 deletions components/choices/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const updateChoiceById = async (req, response) => {
let i = 0;

try {
const {votesData, isXTZ} = getInputFromSigPayload(payloadBytes);
const { votesData } = getInputFromSigPayload(payloadBytes);
let db_connect = dbo.getDb("Lite");

const pollID = votesData[0].pollID;
Expand Down Expand Up @@ -95,7 +95,7 @@ const updateChoiceById = async (req, response) => {
token.tokenID,
block,
address,
isXTZ
poll.isXTZ
);

if (!total) {
Expand Down
6 changes: 4 additions & 2 deletions components/tokens/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ const getVotingPowerAtLevel = async (req, response) => {
daoContract,
tokenID,
level,
userAddress
userAddress,
isXTZ = false
);

const votingXTZWeight = await getUserTotalVotingPowerAtReferenceBlock(
Expand All @@ -84,7 +85,8 @@ const getVotingPowerAtLevel = async (req, response) => {
daoContract,
tokenID,
level,
userAddress
userAddress,
isXTZ = true
);

response.json({ votingWeight, votingXTZWeight });
Expand Down
12 changes: 3 additions & 9 deletions utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,15 @@ const getUserTotalVotingPowerAtReferenceBlock = async (
tokenID,
level,
userAddress,
isXTZ
isXTZ = false
) => {
try {

let userVotingPower = new BigNumber(0);
if (!isXTZ) {
let userVotingPower = new BigNumber(0);

const isTokenDelegation = await isTokenDelegationSupported(
network,
address
);

if (isTokenDelegation) {
const userVotePower = await getUserTotalVotingWeightAtBlock(
network,
Expand Down Expand Up @@ -184,15 +181,12 @@ const getUserTotalVotingPowerAtReferenceBlock = async (

return userVotingPower;
} else {
let userVotingPower = new BigNumber(0);

const selfBalance = await getUserXTZBalanceAtLevel(
network,
level,
userAddress
);
userVotingPower = userVotingPower.plus(selfBalance);
return userVotingPower;
return userVotingPower.plus(selfBalance);
}
} catch (error) {
console.log("error: ", error);
Expand Down

0 comments on commit 9c73493

Please sign in to comment.