Voter
The Voter class provides calldata builders for gauge weight voting and read helpers for inspecting voting state. All write transactions target VOTER_ADDRESSES[chainId].
Write: Calldata Builders
typescript
import { Voter, VOTER_ADDRESSES, ChainId } from '@hydrexfi/hydrex-sdk';
// Vote on pools — weights define relative proportions summing to 100%
const { calldata } = Voter.voteCallParameters({
pools: ['0xPool1', '0xPool2'],
weights: [6000, 4000], // 60% / 40%
});
// Recast saved votes at current voting power (no weight changes)
const { calldata: poke } = Voter.pokeCallParameters();
// Clear all votes for this epoch
const { calldata: reset } = Voter.resetCallParameters();
// All transactions send to:
const voterAddress = VOTER_ADDRESSES[ChainId.Base];
// 0xc69E3eF39E3fFBcE2A1c570f8d3ADF76909ef17bℹ
Voting weights
Weights are integers that represent proportions. They must sum to a consistent total — typically use 10000 as a base (e.g. 6000 = 60%, 4000 = 40%).
Read: Contract State
typescript
// Current epoch details
const epoch: EpochDetails = await Voter.getEpochDetails(readContracts);
// User's vote allocation by pool (as percentages)
const percents: UserVotePercents = await Voter.getUserVotePercents('0xUser', readContracts);
// percents.byPool => { '0xPool1': '60', '0xPool2': '40' }
// Whether user has voted in current epoch
const voted: boolean = Voter.hasVotedForEpoch(epoch, percents.lastVotedTimestamp);
// Aggregate vote stats
const stats: VoteStats = await Voter.getVoteStats(readContract);
// Per-pool weights for a set of pools
const weights: PoolWeights = await Voter.getPoolWeights(['0xPool1', '0xPool2'], readContracts);
// Total gauge weight across all pools
const totalWeight: bigint = await Voter.getTotalWeight(readContract);
// Weight for a single pool
const poolWeight: bigint = await Voter.getWeight('0xPool', readContract);Vote Status & Power Breakdown
getUserVoteStatus derives a compact status summary from a UserVoteSnapshot. Use getVotePowerBreakdown to separate automated conduit power from manual user power.
typescript
import { Voter, UserVoteStatus, UserVotePowerBreakdown } from '@hydrexfi/hydrex-sdk';
// Get vote status from a snapshot
const snapshot = await VeNFTLens.getUserVoteSnapshot('0xUser', readContract);
const epoch = await Voter.getEpochDetails(readContracts);
// Optional: power breakdown to separate automated from manual power
const breakdown: UserVotePowerBreakdown = Voter.getVotePowerBreakdown(accounts, {
conduitAddresses: ['0xConduit1'],
});
const status: UserVoteStatus = Voter.getUserVoteStatus(snapshot, epoch, breakdown);
// status.needsToVote — true if manual power > 0 and no vote this epoch
// status.hasVotingPower — total power > 0
// status.hasVotedForCurrentEpoch — true if vote falls within current epoch
// status.totalVotingPower — bigint
// status.manualVotingPower — bigint
// status.automatedVotingPower — bigintKey Types
EpochDetails
| Parameter | Type | Required | Description |
|---|---|---|---|
epochNumber | number | required | Current epoch index. |
epochStart | number | required | Unix timestamp of epoch start. |
epochEnd | number | required | Unix timestamp of epoch end. |
epochDuration | number | required | Duration of each epoch in seconds. |
nextEpochStart | number | required | Unix timestamp of next epoch start. |
UserVoteStatus
| Parameter | Type | Required | Description |
|---|---|---|---|
needsToVote | boolean | required | True if the user has manual voting power and has not yet voted this epoch. |
hasVotingPower | boolean | required | True if total voting power is greater than zero. |
hasVotedForCurrentEpoch | boolean | required | True if the most recent vote timestamp falls within the current epoch window. |
totalVotingPower | bigint | required | Combined manual + automated voting power. |
manualVotingPower | bigint | required | Power not delegated to any known conduit. |
automatedVotingPower | bigint | required | Power delegated to conduit addresses. |
| Type | Description |
|---|---|
UserVotePercents | byPool record mapping pool address → percentage string, plus lastVotedTimestamp |
VoteStats | Total weight and pool count |
PoolWeights | Record<poolAddress, bigint> — per-pool gauge weight |
UserVotePowerBreakdown | totalVotingPower, manualVotingPower, automatedVotingPower |