Conversation
murderteeth
left a comment
There was a problem hiding this comment.
Summary
This PR fixes Frax APY calculations for Convex strategies by replacing the FraxPid() call with a proper contract chain lookup: Strategy → userVault → stakingToken → convexPoolId.
Issues
Incomplete fix in getConvexRewardAPY
getConvexRewardAPY (lines 33-44) still uses the old FraxPid fallback pattern. This function is called on line 53 of forward.convex.go for the same Frax strategies. The same fix should likely be applied here.
Manual testing shows one vault still broken
Tested locally with the two vaults visible in the PR screenshots:
✅ eUSD-FRAXBP (0x468C76f16B7735303f7215b3839D270d058b3d7a)
curl -s http://localhost:3000/1/vaults/0x468C76f16B7735303f7215b3839D270d058b3d7a | jq '.apr.forwardAPR.netAPR'
0.199858839456339
❌ ZUSDFBP3CRV (0xc52d44abA4B7739173821afF175aEb53367E629E)
curl -s http://localhost:3000/1/vaults/0xc52d44abA4B7739173821afF175aEb53367E629E | jq '.apr.forwardAPR.netAPR'
116132303628549560000000
The second vault is returning an obviously incorrect APY value.
Suggestions
- Consider extracting the PID lookup logic into a shared helper function since it's needed in both
getCVXPoolAPYandgetConvexRewardAPY - Include vault/contract addresses in PR descriptions when testing specific contracts - makes review easier
Reviewed using review-pr skill
The obviously incorrect APR is not a calculation issue. It is caused by the underlying pool being devalued with a shitty depegged asset. We need to retire that vault (will do that right now). The APY value is "correct" if you price the rewards relative to the pool value. |
|
|
converting this to draft while I continue to work out the kinks |
Factory Vault forward APY calculations for Frax strategies were being incorrectly calculated due to a misconfiguration of a call to get convex PIDs. They were getting frax PIDs instead of convex PIDs.
This has been fixed by falling back to finding the Convex PID via a chain of contract calls. ABIs and new contracts to make these calls have been added.
This PR also adds a helper file called apy_trace.go, which allows trace logs to be saved for particular vaults as they flow through the program. I know that there are probably more serious ways to debug, but I could not figure out how to get the general debugger to focus only on specific contracts as the program runs and this solution allows for it.
Before:

after:
