BTB
/

Derive

Derivativeswebsite
Options (and perps and spot) on Derive v3, formerly Lyra. An agent deposits collateral from Ethereum, then trades options through the signed JSON-RPC API, using a session key. Matching happens off-chain and settles through Derive's zk-vApp on Ethereum.

What you can do

depositDeposit USDC or another supported collateral from Ethereumapprove ACTION_MANAGER for the ERC20, then call deposit(asset, amount, subaccountId, fallbackRecipient) or depositToNewSubaccount(asset, amount, managerId, owner). Use the protocol asset address from get_all_currencies. Credit shows up after 1 to 2 minutes. Alternative: public/register_deposit_address for a deposit address with no signature.
trade-optionBuy or sell an option (or perp or spot) on the orderbooklist instruments with public/get_all_instruments (option names look like ETH-20240914-2400-C), sign the order Action with a registered session key (EIP-712, see action signing docs), then call private/order with instrument_name, direction, amount, limit_price, max_fee and subaccount_id. Cancel with private/cancel or private/cancel_all.
quote-and-pricePrice an order before sending itpublic/order_quote or private/order_quote returns projected fill price, fees and margin impact without placing the order. Read ticker data with public/get_ticker or public/get_tickers.
check-positionsRead subaccount positions, collateral and marginprivate/get_positions, private/get_collaterals, private/get_subaccount and private/get_margin for a subaccount ID. Options also show Greeks in get_positions.
withdrawWithdraw collateral to an Ethereum addressprivate/withdraw with a signed action (withdraw scope) and recipient set to the L1 address. For other chains use a registered withdraw address from private/register_withdraw_address. If the operator is offline, the escape hatch is a claim on WITHDRAWAL_OUTBOX (see docs; function not confirmed here).
session-keyCreate a session key that signs trades for a walletprivate/set_session_key (signed by the wallet, or submitted through ACTION_MANAGER.submit for contract or multisig owners) with scopes and an expiry. Then log in with session login. Use private/session_keys to list keys.
Options are cash-settled and expire at 08:00 UTC on the expiry date. Positions can be liquidated if margin falls below maintenance. Liquidations run as auctions.
Trading and matching are off-chain. Deposits and withdrawals depend on the operator and on the zk-vApp settlement. If the operator goes offline, the escape hatch on the withdrawal outbox is the fallback exit.
Session keys have an expiry, an IP allowlist option and scopes. A leaked session key can trade within its scopes until it expires or is revoked.
Margin type differs by market (SM or PM2). Check private/get_margin before opening large option positions.

Contracts

Read any function, or build a write and sign it. Amounts are in base units (1 USDC = 1000000).
ACTION_MANAGER (OnchainActionManager)other on ethereum0xE366CcA474968e33b777E13905829A3b800CFAD3
write deposit(address,uint256,uint64,address)
Deposit collateral into an existing subaccount. Arguments: protocol spot asset address (collaterals[].address from get_all_currencies, not the ERC20), amount in the ERC20's own decimals, subaccountId, fallbackRecipient (receives the funds if the deposit cannot be applied). Approve this contract for the ERC20 first. Crediting is asynchronous and takes 1 to 2 minutes.
write depositToNewSubaccount(address,uint256,uint32,address)
Deposit collateral and create a new subaccount under a margin manager. Arguments: protocol spot asset address, amount in ERC20 decimals, managerId (the SM-margin manager id), owner (the wallet that owns the subaccount). Approve this contract for the ERC20 first.
write submit(uint256,bytes)
Generic action entry point used by multisig or smart-contract owners, for example to authorize or revoke a session key. The first argument is the action type and the second is its ABI-encoded data. Follow the docs for the exact action types.
VAPP (zk-vApp settlement)other on ethereum0xd330145C17fB6EF2a21ACf1275Ce683A305F58BB
WITHDRAWAL_OUTBOXbridge on ethereum0x7c743D79C9C595cE332314503d84cBBb4E85FA63
SPOT_VAULTvault on ethereum0x2e7dF4fAf35a1599979C7E764444e112d936ec42
WITHDRAW_FACTORYfactory on ethereum0xFec48bBC648bd2284520d862Ec67fc68F709915e
read getWithdrawAddress(bytes32,uint256)
Returns the forwarding withdraw address for a recipient and chain ID. Register it with private/register_withdraw_address before using a forwarded withdrawal.