Skip to main content

Respond to Borrow RFQs (coming soon)

:::caution Coming soon Borrow is not live. The trading Borrow (/borrow) page shows a coming-soon notice when VITE_MARGIN_COMING_SOON is set. Do not treat the endpoints, topics, or on-chain borrow flow below as available in production. Names and payloads may change. :::

When it ships, Borrow RFQs will let a borrower post collateral positions (typically ERC-6909 opshuns, especially ITM) and receive competing signed loan offers from lenders without selling the option.

SDK helpers already exist for the planned path (signMarginLoanOffer, createMarginQuoteSession) in @opshuns/sdk: do not treat them as production-ready until Borrow is live.

Planned lifecycle​

Borrower: POST /api/margin/quote
→ margin:<chain_id>:requests (filler feed)
→ borrower joins margin_rfq_stream:<stream_token>

Lender: builds SignedLoan + lender_signature
→ POST /api/margin/quote/:id

Borrower: POST /api/margin/quote/:id/select { offer_id }
→ signs LoanRequest, calls MarginRFQCore.borrow on-chain

Planned create quote (borrower)​

POST /api/margin/quote (planned: no login)

{
"chain_id": 31337,
"borrower_address": "0x...",
"expires_in": 60,
"token_loaned": "0x…",
"amount": "1000000000",
"positions": [
{
"standard": 0,
"token_address": "0x…",
"id": "12345",
"amount": "1000000000000000000"
}
]
}

standard: 0 ERC-6909, 1 ERC-20, 2 ERC-721, 3 ERC-1155.

token_loaned and amount are optional together: the ERC-20 the borrower wants and the size in that token's base units. When both are set, lenders should offer that currency and size. Omit both to let lenders choose.

Planned response includes borrower_hash, borrower_nonce_salt, stream_token, and topic margin_rfq_stream:<token>.

Planned lender listen​

  1. Maker rights + POST /api/pubsub/premium
  2. Join margin:<chain_id>:requests for margin_rfq_request
  3. Optionally join margin_lender:<your_address> with api_key

Filler payloads would include borrower_hash and positions, not the raw borrower address.

Planned lender offer​

POST /api/margin/quote/:id (authenticated maker)

{
"signed_loan": {
"token_loaned": "0x…",
"amount": "500000000000000000",
"lender_nonce": "1",
"early_liquidation_time_stamp": "0",
"expiry": "1786000000",
"interest_rate_bps_per_annum": "500",
"trusted_oracle": "0x…",
"haircut_bps": "1000",
"vault": "0x…",
"borrower_hash": "0x…",
"positions": [ /* same positions */ ]
},
"lender_signature": "0x…"
}

vault is the lender (EOA or ERC-1271 vault). Signature verification would use the Borrow RFQ EIP-712 domain when enabled.

Planned borrower select​

POST /api/margin/quote/:id/select
Auth as the borrower address.

{ "offer_id": "…" }

Response would include next_step describing on-chain borrow(request, borrowerSignature).

Planned on-chain​

After selection, the borrower signs the full LoanRequest and calls MarginRFQCore.borrow. Collateral transfer / haircut / oracle rules are enforced on-chain. The API only auctions and relays signed offers.

Until this is announced as live, use options RFQ only.

Protocol borrow and liquidation rates: Borrow fees.