Open
Conversation
Contributor
|
@AndriiDiachuk can you please post sample input and output of the script? |
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
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.
Summary
Adds
get_pool_liquidity.cdc- a read-only Cadence script that reports liquidity status for a configurable list of Uniswap V3 pools deployed on Flow EVM.This script is consumed by the fcm-observer
monitoring service, which calls it on a periodic basis to expose Prometheus metrics
for pool health alerting.
For each pool the script performs three dry EVM calls:
factory.getPool(tokenA, tokenB, fee)— resolves the pool contract addresspool.liquidity()— checks whether there is any current in-range liquiditytokenA/tokenB.balanceOf(pool)— reads actual token reserves held by the poolToken balances are scaled to 8 decimal places (UFix64) using
FlowEVMBridgeUtils.uint256ToUFix64with floor rounding for tokens with more than8 decimals.
If any call fails (e.g. pool not yet deployed, RPC error), the pool entry is still
returned with
balanceA=0,balanceB=0,hasLiquidity=falseso the caller alwaysreceives a complete response and metrics are never absent.
Metrics exposed by fcm-observer (context)
fcm_pool_token_balance{pool, token}fcm_pool_has_liquidity{pool}1.0= in-range liquidity present,0.0= emptyRelated PR: https://github.com/onflow/fcm-observer/pull/111