Add BlindPay shadow quote for USDC↔BRLA rebalances#1258
Closed
ebma wants to merge 2 commits into
Closed
Conversation
…ute comparison Adds an observational BlindPay payin FX quote (BRL -> USDT/USDB) alongside the existing SquidRouter/Avenia/Nabla route quotes in compareRoutesUpfront, to evaluate whether BlindPay is a cheaper source of stablecoin over time. - New apps/rebalancer/src/services/blindpay: FX-rate client + types - fetchBlindpayShadowQuoteUsdc returns a USDC-equivalent (6dp) quote, or null when unconfigured or below BlindPay's 5 BRL minimum - Shadow only: logged in the route comparison but never added to candidates, so it is never actually routed through - Optional BLINDPAY_* config; documented in .env.example
…otification Threads the observational BlindPay shadow quote from compareRoutesUpfront through the preflight quotes and rebalance state into the Base completion Slack message, rendered as a 'BlindPay shadow (not routed)' line with the delta vs the executed route. Absent when BlindPay is unconfigured.
✅ Deploy Preview for vortex-sandbox ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for vortexfi ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Member
Author
|
Superseded by #1257, which already merged this feature (plus unit tests + a request timeout) into staging. Nothing left to merge here. |
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.
What
Adds an observational BlindPay price comparison to the `usdc-brla-usdc-base` rebalancing route, to evaluate whether BlindPay is a cheaper source of stablecoin (USDT to feed into Nabla) than the routes we already use.
On each route comparison, `compareRoutesUpfront` now fetches a BlindPay shadow quote (payin BRL → USDT/USDB) in parallel with the SquidRouter / Avenia / Nabla quotes. It's:
```
BlindPay shadow (not routed): 95.220000 USDC-eq | vs SquidRouter 95.400000: -0.180000
```
Not routed
The shadow quote is never added to `candidates`, so BlindPay is never actually selected/executed — this is a data-gathering feature only. It never throws, and skips cleanly when BlindPay is unconfigured or the amount is below BlindPay's 5 BRL minimum.
Implementation
Config
```
BLINDPAY_API_KEY=...
BLINDPAY_INSTANCE_ID=in_...
BLINDPAY_BASE_URL=https://api.blindpay.com/v1 # optional
BLINDPAY_TOKEN=USDT # sandbox/dev instances only support USDB
```
When `BLINDPAY_API_KEY`/`BLINDPAY_INSTANCE_ID` are unset, the shadow quote is skipped and the rebalancer behaves exactly as before.
Testing
Notes for reviewers / before prod
0.1%) + flat fee ($0.10 on the test instance). Re-confirm fees on the production instance.