-
Notifications
You must be signed in to change notification settings - Fork 1
Refactor pools schema with state tables and VIEW pattern #54
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
Conversation
- Updated pools table to use Nullable(UInt32) for fee column - Added Uniswap V1 pool creation materialized view - Added SunPump pool creation materialized views (TokenCreate and TokenCreateLegacy) - Added CurveFi pool creation materialized views (PlainPoolDeployed and MetaPoolDeployed) - Added Balancer pool creation materialized view (PoolRegistered) - Added Bancor pool creation materialized view (Activation) - Created pools_fees table with ReplacingMergeTree(block_num) for dynamic fee tracking - Added fee tracking MVs for Balancer (SwapFeePercentage, AggregateSwapFeePercentage) - Added fee tracking MVs for Bancor (ConversionFeeUpdate) - Added fee tracking MVs for CurveFi (CommitNewFee, NewFee) - Added fee tracking MVs for SunPump (PurchaseFeeSet, SaleFeeSet) Co-authored-by: DenisCarriere <550895+DenisCarriere@users.noreply.github.com>
- Fix Balancer fee conversion: divide by 1e14 (not 1e16) to convert from 1e18 fixed-point to basis points - Add validation for CurveFi token extraction to ensure non-empty token addresses - Remove build binary and update .gitignore Co-authored-by: DenisCarriere <550895+DenisCarriere@users.noreply.github.com>
|
@copilot Rename Additionally to Rename Then create a |
- Rename `pools` table to `state_pools_initialize` and remove fee column - Change token structure to use Array(String) with materialized columns for token0-token3 - Rename `pools_fees` to `state_pools_fees` and add initialize events for initial fees - Create `pools` VIEW combining state_pools_initialize and state_pools_fees - Update all materialized views to use new tokens array structure Co-authored-by: DenisCarriere <550895+DenisCarriere@users.noreply.github.com>
Done in c9e3987. Changes made:
|
- Update all fee update MVs to reference state_pools_fees (not pools_fees) - Fix protocol enum values to use hyphens (uniswap-v1) matching existing convention in swaps table Co-authored-by: DenisCarriere <550895+DenisCarriere@users.noreply.github.com>
Refactors the pools schema to use separate state tables for initialization and fees, combined through a unified VIEW. Extends support to all DEX protocols (Uniswap V1-V4, SunPump, CurveFi, Balancer, Bancor).
Schema Refactoring
state_pools_initialize (renamed from pools)
Array(String)fortokenswith materialized columns fortoken0,token1,token2,token3state_pools_fees (renamed from pools_fees)
ReplacingMergeTree(block_num)to maintain latest fee per poolpools VIEW
state_pools_initializewith latest fees fromstate_pools_feesPool Creation MVs
mv_uniswap_v1_new_exchange- Zero address + token pairmv_uniswap_v2_pair_created- Token pair arraymv_uniswap_v3_pool_created- Token pair arraymv_uniswap_v4_initialize- Currency pair arraymv_sunpump_token_create,mv_sunpump_token_create_legacy- Zero address + token pairmv_curvefi_plain_pool_deployed,mv_curvefi_meta_pool_deployed- Multi-token support via splitByCharmv_balancer_pool_registered- Empty array (variable tokens)mv_bancor_activation- Empty array (variable reserve tokens)Implementation Notes
splitByChar(',', coins)to convert comma-separated coins to arrayOriginal prompt
poolsMV #53✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.