Skip to content

Commit

Permalink
feat: undelegate to zero address instead of self
Browse files Browse the repository at this point in the history
  • Loading branch information
Sekhmet committed Jan 27, 2025
1 parent 524d6d7 commit beba92e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
13 changes: 4 additions & 9 deletions apps/ui/src/components/SpaceDelegates.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import removeMarkdown from 'remove-markdown';
import { getDelegationNetwork } from '@/helpers/delegation';
import { getGenericExplorerUrl } from '@/helpers/explorer';
import { getNames } from '@/helpers/stamp';
import { _n, _p, _vp, compareAddresses, shorten } from '@/helpers/utils';
import { _n, _p, _vp, shorten } from '@/helpers/utils';
import { getNetwork, supportsNullCurrent } from '@/networks';
import { SNAPSHOT_URLS } from '@/networks/offchain';
import { RequiredProperty, Space, SpaceMetadataDelegation } from '@/types';
Expand Down Expand Up @@ -133,8 +133,7 @@ async function fetchDelegateRegistryDelegatee() {
id: delegation.delegate,
balance,
share: apiDelegate ? balance / Number(apiDelegate.delegatedVotes) : 1,
name: names[delegation.delegate],
canUndelegate: true
name: names[delegation.delegate]
};
}
Expand Down Expand Up @@ -166,8 +165,7 @@ async function fetchGovernorSubgraphDelegatee() {
share: apiDelegate
? Number(delegateeData.balance) / Number(apiDelegate.delegatedVotesRaw)
: 1,
name: names[delegateeData.address],
canUndelegate: !compareAddresses(delegateeData.address, web3.value.account)
name: names[delegateeData.address]
};
}
Expand Down Expand Up @@ -332,10 +330,7 @@ watchEffect(() => setTitle(`Delegates - ${props.space.name}`));
<div class="text-[17px]" v-text="_p(delegatee.share)" />
</div>
</AppLink>
<div
v-if="delegatee.canUndelegate"
class="flex items-center justify-center"
>
<div class="flex items-center justify-center">
<UiDropdown>
<template #button>
<UiButton class="!p-0 !border-0 !h-[auto] !bg-transparent">
Expand Down
2 changes: 1 addition & 1 deletion apps/ui/src/networks/evm/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ export function createActions(
};

if (delegationType === 'governor-subgraph') {
delegatee = delegatee ?? (await web3.getSigner().getAddress());
delegatee = delegatee ?? '0x0000000000000000000000000000000000000000';

contractParams = {
address: delegationContract,
Expand Down
2 changes: 1 addition & 1 deletion apps/ui/src/networks/starknet/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ export function createActions(

const { account }: { account: Account } = web3.provider;

delegatee = delegatee ?? account.address;
delegatee = delegatee ?? '0x0';

let calls: AllowArray<Call> = {
contractAddress: delegationContract,
Expand Down

0 comments on commit beba92e

Please sign in to comment.