Skip to content

Commit

Permalink
fix: Whitelist with-delegation strategies and use checksum addresses (#…
Browse files Browse the repository at this point in the history
…4933)

* fix: Whitelist with-delegation strategies and use checksum addresses

* refactor
  • Loading branch information
ChaituVR authored Nov 16, 2024
1 parent 36df1ab commit 45becbf
Showing 1 changed file with 15 additions and 5 deletions.
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

0 comments on commit 45becbf

Please sign in to comment.