Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[polygon-self-staked-pol] Make addresses unique #1626

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading