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    — bigint

Key Types

EpochDetails

ParameterTypeRequiredDescription
epochNumbernumberrequiredCurrent epoch index.
epochStartnumberrequiredUnix timestamp of epoch start.
epochEndnumberrequiredUnix timestamp of epoch end.
epochDurationnumberrequiredDuration of each epoch in seconds.
nextEpochStartnumberrequiredUnix timestamp of next epoch start.

UserVoteStatus

ParameterTypeRequiredDescription
needsToVotebooleanrequiredTrue if the user has manual voting power and has not yet voted this epoch.
hasVotingPowerbooleanrequiredTrue if total voting power is greater than zero.
hasVotedForCurrentEpochbooleanrequiredTrue if the most recent vote timestamp falls within the current epoch window.
totalVotingPowerbigintrequiredCombined manual + automated voting power.
manualVotingPowerbigintrequiredPower not delegated to any known conduit.
automatedVotingPowerbigintrequiredPower delegated to conduit addresses.
TypeDescription
UserVotePercentsbyPool record mapping pool address → percentage string, plus lastVotedTimestamp
VoteStatsTotal weight and pool count
PoolWeightsRecord<poolAddress, bigint> — per-pool gauge weight
UserVotePowerBreakdowntotalVotingPower, manualVotingPower, automatedVotingPower
Hydrex

Hydrex is an Omni-Liquidity MetaDEX built on Base for Base, designed to bring new users onchain.

Paragraph

© 2026 Hydrex. All rights reserved.