Skip to content

Commit be3db6d

Browse files
Hiksangclaude
andcommitted
Add gauge discover: scan V2+CL pools for emission gauges
- gauge discover scans both V2 factory (allPairs) and CL factory (getPool × tickSpacings) - Filters pools with non-zero gauges via voter.gaugeForPool - Fix cl_factory config key (was reading V2 factory for CL) - Fix USDC address (was wrong, now matches config) - Fix 4 checksum mismatches (WETH, mETH, hyperRAM, UBTC) - Ramses: 7 gauged pools found (5 V2 + 2 CL) - CL10 WHYPE/USDT0 + CL1 USDC/USDT0 = emission pools Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent fb6e9fa commit be3db6d

17 files changed

Lines changed: 1395 additions & 121 deletions

File tree

ts/config/protocols/dex/ramses_hl.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ description = "Ramses V2 AMM (x(3,3) model) on HyperEVM ($2.6M TVL)"
1010
[protocol.contracts]
1111
# V2 AMM
1212
factory = "0xd0a07E160511c40ccD5340e94660E9C9c01b0D27"
13+
pair_factory = "0xd0a07E160511c40ccD5340e94660E9C9c01b0D27"
1314
router = "0xdcC44285fBc236457A5cd91C2f77AD8421B0D8ED"
15+
# CL AMM (shared voter)
16+
cl_factory = "0x07E60782535752be279929e2DFfDd136Db2e6b45"
1417
# x(3,3) governance (shared with Ramses CL)
1518
voter = "0x9aab8C415aF5936b09C595B09B1ff15cbaDCD843"
1619
ve_token = "0xAE6D5FcE541216BDA471D311425B5412D9f1DEb9"

ts/packages/defi-cli/config/protocols/dex/ramses_hl.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ description = "Ramses V2 AMM (x(3,3) model) on HyperEVM ($2.6M TVL)"
1010
[protocol.contracts]
1111
# V2 AMM
1212
factory = "0xd0a07E160511c40ccD5340e94660E9C9c01b0D27"
13+
pair_factory = "0xd0a07E160511c40ccD5340e94660E9C9c01b0D27"
1314
router = "0xdcC44285fBc236457A5cd91C2f77AD8421B0D8ED"
15+
# CL AMM (shared voter)
16+
cl_factory = "0x07E60782535752be279929e2DFfDd136Db2e6b45"
1417
# x(3,3) governance (shared with Ramses CL)
1518
voter = "0x9aab8C415aF5936b09C595B09B1ff15cbaDCD843"
1619
ve_token = "0xAE6D5FcE541216BDA471D311425B5412D9f1DEb9"

ts/packages/defi-cli/dist/index.js

Lines changed: 261 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ts/packages/defi-cli/dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ts/packages/defi-cli/dist/main.js

Lines changed: 261 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ts/packages/defi-cli/dist/main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ts/packages/defi-cli/dist/mcp-server.js

Lines changed: 252 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ts/packages/defi-cli/dist/mcp-server.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ts/packages/defi-cli/src/commands/gauge.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,20 @@ function resolveAccount(): Address | undefined {
1818
export function registerGauge(parent: Command, getOpts: () => OutputMode, makeExecutor: () => Executor): void {
1919
const gauge = parent.command("gauge").description("Gauge operations: find, deposit, withdraw, claim, earned");
2020

21+
gauge.command("discover")
22+
.description("Find all pools with emission gauges (scans V2 + CL factories)")
23+
.requiredOption("--protocol <protocol>", "Protocol slug")
24+
.action(async (opts) => {
25+
const chainName = parent.opts<{ chain?: string }>().chain ?? "hyperevm";
26+
const registry = Registry.loadEmbedded();
27+
const chain = registry.getChain(chainName);
28+
const protocol = registry.getProtocol(opts.protocol);
29+
const adapter = createGauge(protocol, chain.effectiveRpcUrl());
30+
if (!adapter.discoverGaugedPools) throw new Error(`${protocol.name} does not support gauge discovery`);
31+
const pools = await adapter.discoverGaugedPools();
32+
printOutput(pools, getOpts());
33+
});
34+
2135
gauge.command("find")
2236
.description("Find gauge address for a pool via voter contract")
2337
.requiredOption("--protocol <protocol>", "Protocol slug")

ts/packages/defi-core/dist/index.d.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,16 @@ interface OptionParams {
238238
is_call: boolean;
239239
amount: bigint;
240240
}
241+
/** A pool that has an active emission gauge */
242+
interface GaugedPool {
243+
pool: Address;
244+
gauge: Address;
245+
token0: string;
246+
token1: string;
247+
type: "V2" | "CL";
248+
tickSpacing?: number;
249+
stable?: boolean;
250+
}
241251
interface RewardInfo {
242252
token: Address;
243253
symbol: string;
@@ -492,6 +502,8 @@ interface IGauge {
492502
getPendingRewards(gauge: Address, user: Address): Promise<RewardInfo[]>;
493503
/** Get pending rewards for a CL gauge NFT position */
494504
getPendingRewardsByTokenId?(gauge: Address, tokenId: bigint): Promise<bigint>;
505+
/** Discover all pools that have active emission gauges */
506+
discoverGaugedPools?(): Promise<GaugedPool[]>;
495507
}
496508
/** ve(3,3) Vote-escrow operations — lock tokens for veNFT */
497509
interface IVoteEscrow {
@@ -679,4 +691,4 @@ declare class Registry {
679691
resolvePool(protocolSlug: string, poolName: string): PoolInfo;
680692
}
681693

682-
export { type ActionResult, type AddLiquidityParams, type AdjustCdpParams, type BorrowParams, type CdpInfo, ChainConfig, type CloseCdpParams, type DeFiTx, DefiError, type DefiErrorCode, type DefiPosition, type DerivativesPositionParams, type GaugeInfo, type ICdp, type IDerivatives, type IDex, type IGauge, type IGaugeSystem, type ILending, type ILiquidStaking, type INft, type IOptions, type IOracle, type IVault, type IVoteEscrow, type IVoter, type IYieldAggregator, type IYieldSource, InterestRateMode, type LendingRates, MULTICALL3_ADDRESS, type NftCollectionInfo, type NftTokenInfo, type OpenCdpParams, type OptionParams, type PoolInfo, type PortfolioPnL, type PortfolioSnapshot, type PositionAsset, type PriceData, ProtocolCategory, type ProtocolEntry, type QuoteParams, type QuoteResult, Registry, type RemoveLiquidityParams, type RepayParams, type Result, type RewardInfo, type Slippage, type StakeParams, type StakingInfo, type SupplyParams, type SwapParams, type TokenAmount, type TokenBalance, type TokenChange, type TokenEntry, TxStatus, type UnstakeParams, type UserPosition, type VaultInfo, type VeNftInfo, type WithdrawParams, type YieldInfo, applyMinSlippage, buildApprove, buildMulticall, buildTransfer, clearProviderCache, decodeU128, decodeU256, defaultSwapSlippage, erc20Abi, formatHuman, getProvider, jsonReplacer, jsonReplacerDecimal, jsonStringify, multicallRead, newSlippage, parseBigInt, protocolCategoryLabel };
694+
export { type ActionResult, type AddLiquidityParams, type AdjustCdpParams, type BorrowParams, type CdpInfo, ChainConfig, type CloseCdpParams, type DeFiTx, DefiError, type DefiErrorCode, type DefiPosition, type DerivativesPositionParams, type GaugeInfo, type GaugedPool, type ICdp, type IDerivatives, type IDex, type IGauge, type IGaugeSystem, type ILending, type ILiquidStaking, type INft, type IOptions, type IOracle, type IVault, type IVoteEscrow, type IVoter, type IYieldAggregator, type IYieldSource, InterestRateMode, type LendingRates, MULTICALL3_ADDRESS, type NftCollectionInfo, type NftTokenInfo, type OpenCdpParams, type OptionParams, type PoolInfo, type PortfolioPnL, type PortfolioSnapshot, type PositionAsset, type PriceData, ProtocolCategory, type ProtocolEntry, type QuoteParams, type QuoteResult, Registry, type RemoveLiquidityParams, type RepayParams, type Result, type RewardInfo, type Slippage, type StakeParams, type StakingInfo, type SupplyParams, type SwapParams, type TokenAmount, type TokenBalance, type TokenChange, type TokenEntry, TxStatus, type UnstakeParams, type UserPosition, type VaultInfo, type VeNftInfo, type WithdrawParams, type YieldInfo, applyMinSlippage, buildApprove, buildMulticall, buildTransfer, clearProviderCache, decodeU128, decodeU256, defaultSwapSlippage, erc20Abi, formatHuman, getProvider, jsonReplacer, jsonReplacerDecimal, jsonStringify, multicallRead, newSlippage, parseBigInt, protocolCategoryLabel };

0 commit comments

Comments
 (0)