Skip to content

Commit

Permalink
🔨🐛 use ethers conversion (snapshot-labs#519)
Browse files Browse the repository at this point in the history
  • Loading branch information
refcell authored Apr 2, 2022
1 parent 72d2515 commit 3189a03
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/strategies/reverse-voting-escrow/examples.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"params": {
"symbol": "RVE",
"club": "0xF76d80200226AC250665139B9E435617e4Ba55F9",
"vesting": "0xD46f00d9F1f6d2e65D9572F9ce283ba925FE591a"
"vesting": "0xD46f00d9F1f6d2e65D9572F9ce283ba925FE591a",
"decimals": 18
}
},
"network": "1",
Expand Down
10 changes: 8 additions & 2 deletions src/strategies/reverse-voting-escrow/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { BigNumber } from '@ethersproject/bignumber';
import { Multicaller } from '../../utils';
import fetch from 'cross-fetch';
import { formatUnits } from '@ethersproject/units';

export const author = 'nascentxyz';
export const version = '0.1.0';
Expand Down Expand Up @@ -170,12 +171,17 @@ export async function strategy(
: addedVotingPower;
});

// ** Return [address, balance] pairs ** //
// ** Return address, balance mapping ** //
const scores = Object.fromEntries(
addresses.map((address) => [
address,
reverseVotingBalance[address]
? parseFloat(reverseVotingBalance[address].toString())
? parseFloat(
formatUnits(
reverseVotingBalance[address].toString(),
options.decimals
)
)
: 0
])
);
Expand Down

0 comments on commit 3189a03

Please sign in to comment.