Integrate Furnace quotes + enter
Goal:
- quote how much veCLAIM a user will receive for an entry
- execute a Furnace entry with a minVeOut slippage guard
Semantics (UI / docs alignment):
- This is Market buy (Buy now / Enter now): the user enters the Furnace immediately using a live quote.
- Mental model: “I’m willing to put 1000 CLAIM or 1 ETH into the Furnace. Tell me how much ve I’m getting in exchange.”
- Recommended user-facing labels:
- Input amount (user budget):
tokenIn+amountIn - Estimated output now (live quote):
estimatedVeOut(andprincipalClaim + bonusClaim) - Minimum output (
minVeOut) as the output slippage guard (derived from the quote) - short swap
deadline(TTL) on any swap path (when input token ≠ CLAIM)
- Input amount (user budget):
Canonical field names (docs-wide):
tokenIn,amountIn,estimatedVeOut,slippageBps,minVeOut,deadline
This tutorial covers:
- ETH entry (
enterWithEth) - CLAIM entry (
enterWithClaim) - optional token entry (
enterWithToken) viaEntryTokenRegistry
Recommended UI defaults (entry token selection)
Entry token goal: prevent “I have ETH but no CLAIM” dead ends, while staying honest that the asset being locked is CLAIM.
Recommended default selection (official app behavior):
- If connected user has
CLAIMbalance > 0: default to CLAIM entry (enterWithClaim). - Otherwise: default to ETH entry (
enterWithEth). - If the flow is launched from “Collect & Lock” (royalties): default to ETH and treat it as a compounding flow (no token selector).
- Remember the user’s last selection per wallet (override only for Collect & Lock entry).
Recommended preview labeling (trust requirement):
- Use Pay with (entry token) and You lock (always CLAIM).
- When entry token ≠ CLAIM, show an inline note: “Includes swap to CLAIM, then lock.”
Flow
Steps
1) Load addresses from the manifest
You need (at minimum):
FurnaceaddressVeClaimNFTaddress- (optional)
EntryTokenRegistryfor Furnace entries
2) Quote first, always
Use the view helper that matches the user’s input type:
quoteEnterWithEth(...)quoteEnterWithClaim(...)quoteEnterWithToken(...)
Each quote returns:
- principalClaim
- bonusClaim (net user bonus)
- veOut (expected ve delta)
- routeTokenId (0 if a new lock would be created)
3) Compute minVeOut
Client pattern:
minVeOut = floor(veOutQuote * (10_000 - slippageBps) / 10_000)
Typical defaults:
- 50–100 bps for normal conditions
4) Execute the entry
ETH entry:
- call
enterWithEth(targetTokenId, durationSeconds, createAutoMax, minVeOut) - set
msg.valueto the user’s ETH amount
CLAIM entry:
- approve CLAIM to the Furnace
- call
enterWithClaim(claimAmount, targetTokenId, durationSeconds, createAutoMax, minVeOut)
Token entry (optional):
- ensure token is enabled in the Furnace’s
EntryTokenRegistry - call
enterWithToken(tokenIn, amountIn, targetTokenId, durationSeconds, createAutoMax, minVeOut)
5) Post-tx: refresh lock state
After confirmation:
- read the lock by tokenId (new or existing)
- update:
- principal amount
- lock end
- autoMax
- ve balance (if you show it)
What success looks like
- Your quote and the official app quote match for the same inputs.
- Users can safely submit entries with a predictable
minVeOutguard.
Next reads
- Bonus model + constants: Furnace
- Token allowlisting and routing: EntryTokenRegistry and DexAdapter