Skip to content

Commit

Permalink
fix: fix invalid decimal voting power
Browse files Browse the repository at this point in the history
  • Loading branch information
wa0x6e committed Mar 12, 2024
1 parent e456b85 commit 51794c7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion apps/ui/src/networks/offchain/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export function createActions(

return result.map((value: bigint, index: number) => {
const strategy = strategiesOrValidationParams[index];
const decimals = parseInt(strategy.params.decimals || 0);
const decimals = parseInt(strategy.params.decimals || 18);

return {
address: strategy.name,
Expand Down
4 changes: 2 additions & 2 deletions packages/sx.js/src/strategies/offchain/remote-vp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ export default function createRemoteVpStrategy(): Strategy {

return result.vp_by_strategy.map((vp: number, i: number) => {
const strategy = params[i];
const decimals = parseInt(strategy.params.decimals || 0);
const decimals = parseInt(strategy.params.decimals || 18);

return BigInt(vp * 10 ** decimals);
return BigInt(Math.floor(vp * 10 ** decimals));
});
}
};
Expand Down

0 comments on commit 51794c7

Please sign in to comment.