Skip to main content
This optional page explains the contracts and keepers the Derive UX uses for gasless onboarding. Like on a centralized exchange, users deposit by sending funds to an address and withdraw straight to another chain.
You don’t need this to onboard. You can use these contracts directly, or as inspiration for your own onboarding experience.

Deposit addresses

Funds sent to a deposit address are swept by the SlowDeposit factory. It deposits them through OnchainActionManager into the user’s own subaccount.
1
Send tokens or ETH to your deposit address, directly on Ethereum or from a source chain through a custom bridge or bridge aggregator.
2
A keeper detects the transfer and waits for enough confirmations.
3
The keeper calls processSlowDeposit on the SlowDeposit factory.
4
The factory sweeps the deposit address and wraps native ETH to WETH.
5
It deposits through OnchainActionManager: deposit for an existing subaccount, or depositToNewSubaccount when subaccountId is 0.
6
OnchainActionManager moves the tokens into the SpotVault and queues the deposit.
7
The Derive exchange reads the queued deposit and credits the subaccount. The credit is final once its batch is proven.
To get a deposit address over the API, call public/register_deposit_address. See the Standard tab in Programmatic Onboarding.

Withdraw addresses

A withdrawal paid to a withdraw address is swept by the WithdrawFactory. It bridges the funds to the recipient on the destination chain.
Withdraw addresses only work for tokens with a custom bridge, such as HYPE, SOL and FXRP. The WithdrawFactory has no route for any other token. If one lands at a withdraw address, processWithdrawal reverts and the funds stay there. Only the factory owner can recover them.
1
Request a withdrawal with your withdraw address for the target chain as the recipient: a signed exchange operation, or OnchainActionManager.withdraw on L1.
2
The Derive exchange applies it and submits its batch to VerifiableApp.
3
VerifiableApp verifies the proof and hands the proven withdrawals to the WithdrawalOutbox.
4
The outbox pays out from the SpotVault to the withdraw address, subject to rate limits.
5
A keeper detects the funds at the withdraw address.
6
It calls processWithdrawal(recipient, chainId, token) on the WithdrawFactory.
7
The factory sweeps the withdraw address and wraps native ETH to WETH.
8
It sends the funds through the route configured for that token and chain, paying the bridge fee in ETH.
9
The recipient receives the tokens on the destination chain.

Contracts

Mainnet is Ethereum and testnet is Ethereum Sepolia. For the core contracts, see Contracts.

SlowDeposit

The deposit factory. getDepositAddress(owner, subaccountId, managerId) returns a deposit address.

WithdrawFactory

getWithdrawAddress(recipient, chainId) returns a withdraw address. getBridgeConfig(token, chainId) shows whether a token has a route to that chain.