Transfer Hooks Redefined
DEXes with delayed settlement enable a new degree of composability, via offer-as-code.
What are Transfer Hooks on Fermi?
Transfer Hooks on Fermi refer to the ability to specify a middleware program, that can automatically be called by Fermi DEX to fetch liquidity from other exchanges/platforms when an order is filled. This enables a delayed settlement system where liquidity is pulled just in the nick of time, thus optimizing capital utilization by not locking it preemptively.
This is a new take on "transfer hooks"- On Fermi, hooks are invoked before the swap, and utilized to perform the swap itself. In contrast, on traditional exchanges like Uniswap, transfer hooks allow the execution of code after a swap has been completed.
Automated on-chain Liquidity Management
Transfer Hooks in Fermi allow you to deploy arbitrary liquidity management programs on chain. Say you place multiple orders on Fermi - you can activate transfer-hooks on all of them, and specify one (or more) liquidity management programs (LMPs). These LMPs can be empowered to manage your positions on various platforms. When an order is partially (or fully) filled, Fermi will make a request to your programs, with values of the currency and amount sought. Based on this information, the LMP can withdraw the required amount of liquidity from platforms in multiple ways, such as:
By cancelling open orders on other CLOBs
By withdrawing LP liquidity supplied to other AMMs
By withdrawing yield-bearing capital on platforms such as Solend
Benefits
Enhanced Capital Efficiency: Liquidity is no longer locked and dormant. Funds are utilized across different platforms and only engaged when fulfilling an order.
Augmented Liquidity: By tapping into the liquidity from various platforms, Fermi DEX enhances its own liquidity pool, facilitating larger trades with minimized slippage.
Innovative Composability: Interact and compose new financial products and trading strategies by combining the capabilities of various DeFi platforms through Offer-as-Code.
How it Works
Place Your Order: On Fermi DEX, place your order without locking up your liquidity upfront.
Select Offer-as-Code & Specify a program: When your order matches with a counterparty, your provided Offer-as-Code middleware program is activated.
Fetch Liquidity: The middleware program automatically interacts with various platforms to fetch the required liquidity, adhering to the specified logic and conditions youโve programmed.
Settle the Trade: Fermi DEX utilizes the fetched liquidity to settle the trade on a JIT basis, ensuring smooth and efficient trade execution.
Automate and Innovate: With Offer-as-Code, enable automated strategies that can dynamically respond to market conditions, fetching liquidity from sources offering the best yield or lowest cost.
Example Use-Case: Dynamic Yield Farming
Imagine you wish to place a trade on Fermi DEX but want your capital to simultaneously be employed in a yield farming strategy until the very moment your order is filled.
Step 1: You place an order on Fermi DEX without locking any liquidity.
Step 2: Your Offer-as-Code is configured to deploy your capital into a yield farming protocol, earning yield.
Step 3: Upon order matching, your Offer-as-Code withdraws the liquidity from the yield farming protocol.
Step 4: Fermi DEX utilizes the fetched liquidity to settle the trade, ensuring your capital was yield-generating until the moment of trade execution.
Last updated