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

fix: Whitelist with-delegation strategies and use checksum addresses #4933

Merged
merged 2 commits into from
Nov 16, 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
20 changes: 15 additions & 5 deletions src/views/DelegateView.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { debouncedWatch } from '@vueuse/core';
import { isAddress } from '@ethersproject/address';
import { getAddress, isAddress } from '@ethersproject/address';
import networks from '@snapshot-labs/snapshot.js/src/networks.json';
import {
getScores,
Expand Down Expand Up @@ -125,7 +125,9 @@ const delegationStrategies = [
'delegation',
'erc20-balance-of-delegation',
'delegation-with-cap',
'delegation-with-overrides'
'delegation-with-overrides',
'with-delegation',
'erc20-balance-of-delegation-with-delegation'
];

async function getDelegatesWithScore() {
Expand All @@ -145,9 +147,17 @@ async function getDelegatesWithScore() {

const uniqueDelegators = Array.from(
new Set(delegations.map(d => d.delegate))
).map(delegate => {
return delegations.find(a => a.delegate === delegate);
});
)
.map(delegate => {
return delegations.find(a => a.delegate === delegate);
})
.map(delegation => {
return {
...delegation,
delegate: getAddress(delegation.delegate),
delegator: getAddress(delegation.delegator)
};
});

const delegatesAddresses = uniqueDelegators.map(d => d.delegate);

Expand Down
Loading