Skip to content

Instantly share code, notes, and snippets.

View patcito's full-sized avatar

patcito patcito

View GitHub Profile

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
Created March 16, 2026 16:07
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:

Wallet Widget Endpoint

GET /wallet/{address}

Returns FT token balance, puts/marketplace summary, and the 3 most recent user actions for the wallet widget.

No query parameters needed — aggregates across all chains automatically.


@patcito
patcito / ftusd-hook-architecture.md
Last active February 26, 2026 19:48
ftUSD Hook Architecture — useFTUSDActions consolidation guide for frontend devs

ftUSD Hook Architecture — useFTUSDActions

What changed

We replaced 6 legacy per-action hooks with a single consolidated useFTUSDActions hook. This mirrors the pattern used in lending (useLendingActions).

Deleted hooks

  • useMintWithPermitAndFee — buy (mint) ftUSD
  • useRedeemWithPermit — sell (redeem) ftUSD
  • useStakeWithPermit — stake ftUSD to vault

FT Withdrawals Report — Ethereum PutManager

Contract: 0xbA49d0AC42f4fBA4e24A8677a22218a4dF75ebaA Event: WithdrawFT(address user, uint256 putId, uint256 amount) Report generated: 2026-02-23 21:28 UTC

Summary

Stat Value
@patcito
patcito / ftusd-dashboard-changes.md
Last active February 23, 2026 20:18
ftUSD Dashboard API changes — new fields for frontend

ftUSD Dashboard API — Frontend Integration Guide

Endpoint

GET /status/ftusd/dashboard

Query params:

  • days — number of days for series (default 7, max 360)

/mm/lend — New userTransactions Field

What changed

When a ?user=0x... query param is provided, each chain object in the response now includes a userTransactions array containing the user's deposit/withdraw/borrow/repay history on that chain.

Response shape

{
@patcito
patcito / lend-overview-endpoint.md
Created February 19, 2026 18:18
GET /mm/lend — Lending Overview Endpoint

GET /mm/lend — Lending Overview Endpoint

Returns full lending data across all chains with per-asset metrics, APY rates, token prices, and optional user positions.

Parameters

Param Type Required Description
user string No User wallet address. If omitted, all user-specific fields are 0.
@patcito
patcito / lend-overview-endpoint.md
Created February 19, 2026 17:21
GET /mm/lend — Lending Overview Endpoint

GET /mm/lend — Lending Overview Endpoint

Returns full lending data across all chains with per-asset metrics, APY rates, token prices, and optional user positions.

Parameters

Param Type Required Description
user string No User wallet address. If omitted, all user-specific fields are 0.