Skip to content

Instantly share code, notes, and snippets.

View patcito's full-sized avatar

patcito patcito

View GitHub Profile
@patcito
patcito / leverage-executor-guide.md
Created April 4, 2026 22:05
Flying Tulip Leverage Executor - Setup & Test Guide

Flying Tulip Leverage Executor - Setup & Test Guide

Prerequisites

  • Go 1.25+
  • Docker (for PostgreSQL)
  • Foundry (anvil, cast)
  • Node.js / bun (for TypeScript examples)

Clone

API Updates (2026-03-30)

1. circuitBreakerLimitRaw — raw integer CB limit

Added to both /mm/lend and /mm/lend/cb endpoints. Use this instead of the float circuitBreakerLimit for MAX button / validation to avoid float rounding mismatches.

/mm/lend/cb

{
  "data": {

API Updates (2026-03-28)

1. Per-chain series in /status/ftusd/dashboard

Series data (price, ftUsdSupply, sftUsdSupply, apy) is now available per chain inside each chains[] entry.

GET /status/ftusd/dashboard?days=360&include_series=true&chain_ids=146

Lending API Updates (2026-03-26)

1. New: GET /mm/lend/cb?chain_id={chainId}&token={tokenAddress}

Lightweight circuit breaker polling endpoint. Use when a withdraw drawer is open to get real-time CB limits without fetching the full /mm/lend payload.

Params:

  • chain_id — chain ID (e.g. 146)
  • token — token contract address (e.g. 0x29219dd400f2Bf60E5a23d13Be72B486D4038894)
@patcito
patcito / gist:e6a455a352aec69b754e32edf13bae2e
Last active March 24, 2026 14:14
Lending Dashboard API - Series & New Fields

Lending Dashboard API Changes

Endpoint: GET /mm/lend

New: chains[].series

Each chain now includes a series object with daily historical data (last 30 days):

{
@patcito
patcito / change.md
Created March 23, 2026 17:34
Frontend Changelog: main → staging

Frontend Changelog (main → staging)

New Features

PUT Dashboard

  • FT Burn Chart — Cumulative FT burned over time with USD values, period selector (1w/1m/3m/6m/1y)
  • FT/Capital Ratio Chart — Shows FT Value / Investment Value ratio over time
  • Dashboard period dropdown and UI fixes
  • stS token added to token config
@patcito
patcito / gist:6909eca82cccc01dfdbf7dc2c9c4dea3
Last active March 18, 2026 22:49
FT Burn Tracking - New/Modified Endpoints for PUT Dashboard

PUT Dashboard - Burn Chart & FT/Capital Ratio

API Endpoints

Burn totals (in existing /tge/metrics response)

GET /tge/metrics

Response now includes ft_burns with per-chain cumulative totals and cross-chain total (chain_id: 0).

Swap Collateral — Frontend Integration Guide

Overview

Users can swap one collateral type for another within the FlyingTulip lending protocol. For example, swap USDC collateral to wS collateral (or any supported pair). The frontend signs an EIP-712 order and submits it to the executor API. The executor handles DEX routing and on-chain execution.

User Flow

  1. User has collateral deposited in PositionsManager (e.g., USDC)
  2. User signs an EIP-712 swap order specifying sellToken → buyToken

Swap Collateral via LeverageRfqEngine — Infra / Multisig Guide

Overview

The swapCollateralFlashWithSession function on the LeverageRfqEngine contract allows users to swap one collateral type for another within the FlyingTulip lending protocol (PositionsManager). The executor service acts as the filler, routing swaps through DEX aggregators (Odos) via a flash callback pattern.

Architecture

User signs EIP-712 order → Executor API → Service picks up order
@patcito
patcito / gist:c8e2b555c24e077a649ea8cb3054dd58
Last active March 18, 2026 22:45
ftUSD user activity: USD-based sorting changes
# ftUSD User Activity — USD Sorting Changes
## What changed
The `/ftusd/user/{address}/transactions` endpoint now sorts by **USD value** instead of raw token amounts when using amount-based sorting.
## Sorting
Use the `sort` query parameter: