Conversation
lib/cron/cache-pools.ts
Outdated
| const limits = await contract.getLimits(pool.token0.id, pool.token1.id) | ||
| ;(pool as V4SubgraphPool).tvlUSD = limits[0].toNumber() | ||
| ;(pool as V4SubgraphPool).tvlETH = limits[1].toNumber() |
There was a problem hiding this comment.
@jsy1218 this doesn't quite make sense to me now.
based on the documentation: https://github.com/euler-xyz/euler-swap/blob/be4f1d50018da4dafbaffe19f77faa9dc883ade6/src/interfaces/IEulerSwap.sol
/// @notice Upper-bounds on the amounts of each token that this pool can currently support swaps for.
/// @return limitIn Max amount of `tokenIn` that can be sold.
/// @return limitOut Max amount of `tokenOut` that can be bought.
function getLimits(address tokenIn, address tokenOut) external view returns (uint256 limitIn, uint256 limitOut);
How should we map those values with tvlETH and tvlUSD?
There was a problem hiding this comment.
good call - we will have to make additional call to get the spot prices of tokenIn and of tokenOut
There was a problem hiding this comment.
i think two ways - calling coingecko via gql or calling routing endpoint for ETH and for USDC pricing.
There was a problem hiding this comment.
synced offline - to ship the feature, we can split into two parts -
- if the pool contains USDC or WETH, calculating from the eth<>usd average price from the top 3 tvl pools
2 if the pool does not, then make additional calls to get tvlETH & tvlUSDC (later in the future)
380fd43 to
49d0f0c
Compare
| ;(pool as V4SubgraphPool).tvlETH = 5500000 | ||
| } | ||
|
|
||
| log.info(`Pool TVL USD: ${pool.tvlUSD}, Pool TVL ETH: ${pool.tvlETH}`) |
There was a problem hiding this comment.
can you share the logs from your local AWS, as to make sure the above algo works?
There was a problem hiding this comment.
the current getLimits method is always getting 0s for both token in and out.
The usd<>eth rate logline looks like:
2025-10-02T16:45:53.959-04:00 | {"name":"RoutingLambda","hostname":"169.254.35.123","pid":14,"level":30,"msg":"Eth to USD rate: 4474.563832095389","time":"2025-10-02T20:45:53.9
-- | --
The rest of the log lines look like:
2025-10-02T16:45:54.372-04:00 | {"name":"RoutingLambda","hostname":"169.254.35.123","pid":14,"level":30,"msg":"Pool 0x92df19cc123fa5eb658f0a43866f34293353fdcffc898beed3e1e946e0b13440 has 0 TVL","time":"2025-10-02T20:45:54.372Z","v":0}
-- | --
| 2025-10-02T16:45:54.372-04:00 | {"name":"RoutingLambda","hostname":"169.254.35.123","pid":14,"level":30,"msg":"Pool TVL USD: 1000, Pool TVL ETH: 5500000","time":"2025-10-02T20:45:54.372Z","v":0}
| 2025-10-02T16:45:54.379-04:00 | {"name":"RoutingLambda","hostname":"169.254.35.123","pid":14,"level":30,"msg":"Limits: [{\"type\":\"BigNumber\",\"hex\":\"0x00\"},{\"type\":\"BigNumber\",\"hex\":\"0x00\"}]","time":"2025-10-02T20:45:54.379Z","v":0}
| 2025-10-02T16:45:54.379-04:00 | {"name":"RoutingLambda","hostname":"169.254.35.123","pid":14,"level":30,"msg":"Pool 0x32719c81952962e513b8e1067780051bd17db0dec5bcab069b2c340204b1279e has 0 TVL","time":"2025-10-02T20:45:54.379Z","v":0}
| 2025-10-02T16:45:54.379-04:00 | {"name":"RoutingLambda","hostname":"169.254.35.123","pid":14,"level":30,"msg":"Pool TVL USD: 1000, Pool TVL ETH: 5500000","time":"2025-10-02T20:45:54.379Z","v":0}
| 2025-10-02T16:45:54.380-04:00 | {"name":"RoutingLambda","hostname":"169.254.35.123","pid":14,"level":30,"msg":"Limits: [{\"type\":\"BigNumber\",\"hex\":\"0x00\"},{\"type\":\"BigNumber\",\"hex\":\"0x00\"}]","time":"2025-10-02T20:45:54.380Z","v":0}
| 2025-10-02T16:45:54.380-04:00 | {"name":"RoutingLambda","hostname":"169.254.35.123","pid":14,"level":30,"msg":"Pool 0xb29e822eeea2ec9b75bb91d6c133fed78ba560251e85cd89233ebfc06df6a7f3 has 0 TVL","time":"2025-10-02T20:45:54.380Z","v":0}
| 2025-10-02T16:45:54.380-04:00 | {"name":"RoutingLambda","hostname":"169.254.35.123","pid":14,"level":30,"msg":"Pool TVL USD: 1000, Pool TVL ETH: 5500000","time":"2025-10-02T20:45:54.380Z","v":0}
| 2025-10-02T16:45:54.382-04:00 | {"name":"RoutingLambda","hostname":"169.254.35.123","pid":14,"level":30,"msg":"Limits: [{\"type\":\"BigNumber\",\"hex\":\"0x00\"},{\"type\":\"Big
We are always falling back to your previous implementation
ROUTE-651 Get Euler TVL