@@ -9,11 +9,14 @@ import {
9
9
STAKING_FACTORY ,
10
10
VE_OLAS ,
11
11
} from 'libs/util-contracts/src/lib/abiAndAddresses' ;
12
- import { getEstimatedGasLimit , sendTransaction } from 'libs/util-functions/src' ;
12
+ import {
13
+ getAddressFromBytes32 ,
14
+ getEstimatedGasLimit ,
15
+ sendTransaction ,
16
+ } from 'libs/util-functions/src' ;
13
17
14
18
import { SUPPORTED_CHAINS , wagmiConfig } from 'common-util/config/wagmi' ;
15
19
16
- import { getAddressFromBytes32 } from './addresses' ;
17
20
import { getUnixNextWeekStartTimestamp } from './time' ;
18
21
import {
19
22
getGovernorContract ,
@@ -24,6 +27,7 @@ import {
24
27
getVoteWeightingContract ,
25
28
} from './web3' ;
26
29
import { RPC_URLS } from 'libs/util-constants/src' ;
30
+ import { Nominee } from 'types' ;
27
31
28
32
type VoteForNomineeWeightsParams = {
29
33
account : Address | undefined ;
@@ -54,9 +58,7 @@ export const voteForNomineeWeights = async ({
54
58
55
59
export const checkIfNomineeRemoved = async ( allocations : { address : Address } [ ] ) => {
56
60
const contract = getVoteWeightingContract ( ) ;
57
- const result : { account : Address ; chainId : number } [ ] = await contract . methods
58
- . getAllRemovedNominees ( )
59
- . call ( ) ;
61
+ const result : Nominee [ ] = await contract . methods . getAllRemovedNominees ( ) . call ( ) ;
60
62
61
63
if ( ! result ) return [ ] ;
62
64
@@ -415,3 +417,27 @@ export const voteForProposal = async ({
415
417
416
418
return result ;
417
419
} ;
420
+
421
+ /**
422
+ * Revoke voting power from a removed nominee
423
+ */
424
+ type RevokePowerParams = {
425
+ account : Address | undefined ;
426
+ nominee : string ;
427
+ chainId : number ;
428
+ } ;
429
+
430
+ export const revokePower = async ( { account, nominee, chainId } : RevokePowerParams ) => {
431
+ const contract = getVoteWeightingContract ( ) ;
432
+ const voteFn = contract . methods . revokeRemovedNomineeVotingPower ( nominee , chainId ) ;
433
+
434
+ const estimatedGas = await getEstimatedGasLimit ( voteFn , account ) ;
435
+ const fn = voteFn . send ( { from : account , estimatedGas } ) ;
436
+
437
+ const result = await sendTransaction ( fn , account , {
438
+ supportedChains : SUPPORTED_CHAINS ,
439
+ rpcUrls : RPC_URLS ,
440
+ } ) ;
441
+
442
+ return result ;
443
+ } ;
0 commit comments