Skip to content

Commit

Permalink
Make addresses unique (snapshot-labs#1626)
Browse files Browse the repository at this point in the history
  • Loading branch information
xavikh authored Nov 7, 2024
1 parent c414a07 commit 0de704d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/strategies/polygon-self-staked-pol/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export async function strategy(
snapshot
): Promise<Record<string, number>> {
const blockTag = typeof snapshot === 'number' ? snapshot : 'latest';
const uniqueAddresses = new Set<string>(addresses);

const multi = new Multicaller(network, provider, stakeManagerABI, {
blockTag
Expand Down Expand Up @@ -53,7 +54,7 @@ export async function strategy(
const result = await multi.execute();

const votingPower: Record<string, BigNumber> = {};
for (const address of addresses) {
for (const address of uniqueAddresses) {
votingPower[address] = BigNumber.from(0);
}

Expand All @@ -73,7 +74,7 @@ export async function strategy(
isNotDeactivated &&
validatorContract !== '0x0000000000000000000000000000000000000000'
) {
for (const address of addresses) {
for (const address of uniqueAddresses) {
stakesMulti.call(
`${address}_${i}`,
validatorContract,
Expand All @@ -86,7 +87,7 @@ export async function strategy(

const stakes = await stakesMulti.execute();

for (const address of addresses) {
for (const address of uniqueAddresses) {
for (let i = 0; i < validatorCount; i++) {
const key = `${address}_${i}`;
if (stakes[key]) {
Expand Down

0 comments on commit 0de704d

Please sign in to comment.