-
-
Notifications
You must be signed in to change notification settings - Fork 239
feat: enhance pool storage with token addresses and fees #528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
fengtality
wants to merge
18
commits into
development
Choose a base branch
from
feat/pools
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit refactors pool storage to include authoritative on-chain data: - Add baseTokenAddress, quoteTokenAddress, and feePct to pool objects - POST /pools now fetches pool-info to get token addresses and fees - Update validation to require new fields - Create migration script for existing pool templates - Migrate Raydium (14 pools), Meteora (3 pools), and Uniswap (33 pools) - Add Pancakeswap pools (4 pools) with new format - Add missing BSC tokens (ASTER, CAKE, BUSD) - Update documentation (CLAUDE.md, README.md) The new pool format ensures stored data matches actual on-chain state, eliminating runtime lookups and preventing token ordering mismatches. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Add support for configurable EIP-1559 gas parameters (maxFeePerGas and maxPriorityFeePerGas) for Ethereum and EVM-compatible networks. This allows users to control transaction costs by setting custom gas values or using network-fetched prices. Changes: - Add maxFeePerGas and maxPriorityFeePerGas config parameters - Separate EIP-1559 (Type 2) and legacy (Type 0) transaction handling - Enhance gas estimation with network fee logging and comparison - Update estimate-gas API to return gasType and EIP-1559 details - Add comprehensive gas configuration guide Networks affected: - EIP-1559: mainnet, base, polygon, arbitrum, optimism - Legacy: bsc, avalanche, celo, sepolia 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Updated test/pools/pools.routes.test.ts to work with the enhanced Pool interface that now includes baseTokenAddress, quoteTokenAddress, and feePct fields. Changes: - Added required fields (baseTokenAddress, quoteTokenAddress, feePct) to all mock Pool objects - Updated POST /pools test expectation to use expect.objectContaining() since the route now fetches and adds pool info automatically - Removed outdated planning documents (POOL_MIGRATION_OUTSTANDING.md, POOL_STORAGE_REFACTOR_PLAN.md) All 13 tests now passing. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
- Replace per-network scanAPIKey with single etherscanAPIKey in ethereum.yml - Migrate from V1 to V2 API endpoint (https://api.etherscan.io/v2/api) - Add automatic chain support detection (Ethereum, Polygon, BSC verified) - Implement chainId-based service initialization instead of network names - Add comprehensive test suite with 17 tests covering API calls and error handling - Update gas configuration guide with Etherscan V2 integration details - Gracefully fall back to RPC for unsupported chains (Base, Arbitrum, Optimism) This change provides more accurate EIP-1559 gas estimates using Etherscan's gastracker module across all supported chains with a single API key. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
- Replace per-network scanAPIKey references with unified etherscanAPIKey - Clarify that etherscanAPIKey is set once in ethereum.yml, not per network - Document which chains support Etherscan gastracker (Ethereum, Polygon, BSC) - Add explicit notes about unsupported chains (Base, Arbitrum, Optimism) - Update all examples and troubleshooting sections - Fix minGasPrice default description to reference network templates - Update API key setup guide with V2 approach - Add Etherscan V2 API migration guide to references 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
- Update Base/Optimism/Arbitrum examples to use 0.01 GWEI (from 0.1) - Update BSC example to use 3.0 GWEI for legacy transactions - Update all log examples to reflect actual configured values - Clarify network-specific examples in configuration strategies - Update API response examples with correct gas values - Add notes explaining minGasPrice floor behavior for each network type 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
- Change Polygon minGasPrice from 30 to 10 GWEI - Update maxFeePerGas and maxPriorityFeePerGas to 10 GWEI - Update nodeURL to rpc.ankr.com/polygon - Update nativeCurrencySymbol from MATIC to POL 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Remove legacy pool lookup code from CLMM open-position routes to align with the existing schema requirement that poolAddress is mandatory. Changes: - Remove unused baseTokenSymbol and quoteTokenSymbol parameters from Raydium CLMM openPosition function - Remove dead pool lookup code (12 lines) from Raydium implementation - Remove misleading baseToken/quoteToken examples from Uniswap schema - Update Uniswap poolAddress example to show real address This is a non-breaking change since the schema already requires poolAddress. All existing tests pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
…itions Update minGasPrice values to reflect current network requirements: - BSC: 0.1 → 3 GWEI - Polygon: 0.1 → 10 GWEI (align with conf template) These values match the actual network conditions and align with the values already documented in the configuration templates. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Move getPool querystring schema to src/pools/schemas.ts and use Type.String with enum property instead of inline definition to enable proper dropdown selection in Swagger UI. Changes: - Add GetPoolRequestSchema to src/pools/schemas.ts - Use enum: ['amm', 'clmm'] for type field to create dropdown - Import and use schema in getPool route This allows users to select pool type from a dropdown in Swagger UI instead of having the value hardcoded. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Update GetPoolRequestSchema to default to 'mainnet-beta' instead of 'mainnet' to align with Solana connector defaults (raydium, meteora). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
- Explicitly override network default to 'mainnet-beta' in querystring - Change tradingPair examples to show SOL-USDC first instead of ETH-USDC - Ensure Swagger UI displays correct defaults for Solana connectors 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
commit 4374adb34541f4198ab52e52c296b9ff3fddedd6 + commit 75beff7
![]() |
…ate pairs Update POST /pools route to include all pool schema fields and allow multiple pools with the same trading pair but different addresses. Changes: - Add baseTokenAddress, quoteTokenAddress, feePct as optional fields in PoolAddRequestSchema (fetched from pool-info if not provided) - Update PoolAddRequest interface to include new optional fields - Remove duplicate token pair check from PoolService.addPool - Only prevent duplicate pool addresses, not duplicate pairs - Update addPool route to use provided fields or fetch from pool-info - Set mainnet-beta as default network in PoolAddRequestSchema - Include fee percentage in success messages This allows users to add multiple pools for the same token pair with different fee tiers (e.g., JUP-USDC with 0.01%, 0.25%, 1% fees). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
…T /pools Change baseTokenAddress and quoteTokenAddress from optional to required fields in the add pool endpoint to ensure data consistency. Changes: - Remove Type.Optional wrapper from baseTokenAddress and quoteTokenAddress in PoolAddRequestSchema - Update PoolAddRequest interface to make these fields required (not optional) - Simplify addPool route logic since token addresses are now always provided - Only fetch pool-info if feePct is missing This ensures all pools have validated token addresses and prevents inconsistencies in pool data. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Add metadata-based duplicate detection to prevent multiple pools with the same characteristics (type, network, feePct, token addresses) but different addresses. Changes: - Add getPoolByMetadata method to PoolService to find pools by metadata instead of just address - Update addPool route to check for existing pools with matching metadata - If pool with same metadata exists but different address: remove old pool and add new one (replacement) - If pool with same metadata and address exists: update it - If no matching metadata: add as new pool This ensures the pool database doesn't contain duplicate entries with identical trading characteristics but different addresses. Example: Prevents having two JUP-USDC CLMM 0.01% pools on mainnet-beta with different addresses. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Change pool duplicate detection to match only on type, network, and token addresses (baseTokenAddress, quoteTokenAddress), ignoring feePct. When a new pool is added with the same token pair but different fee tier, it replaces the existing pool. Changes: - Remove feePct parameter from getPoolByMetadata method - Match pools based only on type, network, and token pair - When same token pair with different fee tier is added: replace old pool - When same token pair with same address is added: update fee tier - Updated success messages to show old and new fee tiers on replacement This ensures only one pool per token pair (per type/network) exists, preventing duplicate entries with different fee tiers. Example: Adding JUP-USDC 0.25% will replace existing JUP-USDC 0.01% 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Update pool routes tests to match new required fields (baseTokenAddress, quoteTokenAddress) and new pool duplicate detection logic. Changes: - Add getPoolByMetadata and updatePool to mock PoolService - Update POST /pools test payloads to include required baseTokenAddress and quoteTokenAddress fields - Add feePct to test payloads - Update "duplicate pool" test to "update existing pool" test since duplicate addresses now trigger updates instead of errors - Add proper mocks for getPoolByMetadata and getPoolByAddress All 13 pool routes tests now pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
The third parameter to sendAndConfirmTransaction was being interpreted as priority fee per compute unit (lamports/CU) instead of total compute units, resulting in an excessive 7.838 SOL transaction fee (400000 lamports/CU × 19595 CU) that caused transactions to fail. Now uses auto-estimated priority fee like other Meteora operations. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Change 1: Reformat Pools
Sumamry
Enhanced pool storage format to include authoritative on-chain data (token addresses and fees) from pool-info endpoints. This ensures stored pool data always matches actual on-chain state and eliminates runtime lookups.
Changes
Core Pool Storage Refactoring
baseTokenAddress
,quoteTokenAddress
, andfeePct
fields to Pool typepool-info-helpers.ts
with connector-agnostic pool info fetchingPool Template Migration
migrate-pool-templates.ts
)Pancakeswap Pool Addition
add-pancakeswap-pools.ts
script for automated pool additionBSC Token Addition
bsc.json
:add-bsc-tokens.ts
script for automated token metadata fetchingDocumentation
New Pool Format
Change 2:Improve Gas Pricing for Ethereum Networks
Summary
Problem
Previously, Gateway always fetched gas prices from the network at transaction time, ignoring any configured gas price parameters for
EIP-1559 networks. This made it impossible to:
Solution
1. Configuration Layer
Example configuration (conf/chains/ethereum/base.yml):
2. Gas Estimation (estimateGasPrice)
Example logs showing transparency:
Network EIP-1559 fees: baseFee=0.0012 GWEI, maxFee=1.5043 GWEI, priority=0.0001 GWEI
Using configured EIP-1559 fees: maxFee=0.1 GWEI, priority=0.01 GWEI
Estimated: 0.1 GWEI for network base
3. Transaction Preparation (prepareGasOptions)
4. API Response Enhancement
Updated /chains/ethereum/estimate-gas endpoint to return:
{
"feePerComputeUnit": 0.1,
"denomination": "gwei",
"computeUnits": 300000,
"feeAsset": "ETH",
"fee": 0.00003,
"timestamp": 1760553074872,
"gasType": "eip1559",
"maxFeePerGas": 0.1,
"maxPriorityFeePerGas": 0.01
}
Network Support
EIP-1559 Networks (Type 2 transactions):
Legacy Networks (Type 0 transactions):
Documentation
Added comprehensive GAS_CONFIGURATION_GUIDE.md covering: