Add Flying Tulip ftUSD APY adapter#2631
Conversation
sftUSD is the staked form of ftUSD, Flying Tulip's yield-bearing stablecoin. APY is funded entirely by FT rewards: protocol fees from ftUSD MintAndRedeem are used to buy FT on the open market and FT is distributed to stakers per epoch through the EpochRewardsVault. FT total supply is fixed so nothing is minted. The adapter reads sftUSD.totalSupply() for tvlUsd (1:1 with USD because ftUSD is dollar pegged and the vault is a 1:1 ERC4626) and sums the rewardAmount field of EpochSettled events from the trailing 30 days, priced via coins.llama.fi. APY is annualised over the 30 day window. Reads on chain only, no centralised API dependency. Verified locally: Ethereum: tvlUsd=$496,429.90, apyReward=2.19% Sonic: tvlUsd=$340,619.84, apyReward=2.44% TVL matches api.flyingtulip.com/ftusd/staking exactly.
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Error while running flying-tulip-ftusd adapter: Test Suites: 1 failed, 1 total |
- Sum rewards in the BigInt domain and only convert to Number after scaling down by 10^12 wei. The previous direct Number(totalRewardWei) cast lost precision once a single epoch's rewardAmount went past 2^53 (around 0.009 FT). - Treat a missing or zero FT price from coins.llama.fi as soft fail (apyReward = 0) instead of throwing. A transient pricing miss shouldn't drop both pools.
|
Error while running flying-tulip-ftusd adapter: Test Suites: 1 failed, 1 total |
|
Heads up on the failing CI: the project-slug validation is expected to fail until DefiLlama/defillama-server#11839 merges and api.llama.fi starts returning the |
Summary
Adds `src/adaptors/flying-tulip-ftusd/index.js` exposing the sftUSD pool on Ethereum and Sonic. ftUSD is Flying Tulip's yield-bearing stablecoin and `sftUSD` is its staked form. Yield is paid in FT via the EpochRewardsVault: protocol fees from the ftUSD MintAndRedeem engine are used to buy FT on the open market and distributed to stakers per epoch. FT total supply is fixed so nothing is minted.
How it works
For each chain:
`rewardTokens` is set to FT and `underlyingTokens` is set to ftUSD so the breakdown reads correctly in the UI.
Verified locally
```
Ethereum: tvlUsd=$496,429.90, apyReward=2.19%
Sonic: tvlUsd=$340,619.84, apyReward=2.44%
```
`tvlUsd` matches `api.flyingtulip.com/ftusd/staking` exactly. The Flying Tulip dashboard currently displays 0% APY because their indexer DB is behind the chain, but the on-chain events do contain non zero `rewardAmount` values. This adapter reads the events directly, which is the canonical approach for yield-server.
Companion PRs
Test plan