Let users deposit, view balances, and withdraw through your Conduit
Your users interact with Railnet through the Conduit you deployed. The Conduit provides a simplified deposit and withdrawal interface — the same experience regardless of whether the underlying strategy uses sync protocols (Aave), async protocols (Ethena), or a mix of both.
Users deposit base assets (e.g., USDC) and receive Conduit shares representing their proportional ownership.
1
Approve the Conduit
IERC20(usdc).approve(address(conduit), amount);
2
Create the deposit
Query memory query = Query({ owner: address(conduit), receiver: address(conduit), mode: Mode.DEPOSIT, input: new Asset[](1), output: new Asset[](0), salt: bytes32(uint256(nonce)), data: ""});query.input[0] = Asset({ asset: address(usdc), value: amount});// Create the deposit — auto-processes for sync Vehiclesconduit.create(query, userAddress);
For sync underlying strategies, the deposit settles in the same transaction — the user receives shares immediately.For async underlying strategies, the query enters PROCESSING. A keeper will call process() automatically when the operation is ready to settle.
Use estimate() to preview deposits and withdrawals including fees before executing:
// Preview: how many shares will the user get for 100 USDC?Asset[] memory input = new Asset[](1);input[0] = Asset({asset: address(usdc), value: 100e6});Asset[] memory estimated = conduit.estimate( input, Mode.DEPOSIT, EstimationType.OUTPUT);// estimated[0].value = shares the user will receive (after fees)
estimate() includes fees and slippage. For pure share-to-asset conversion without fees, use convert() instead.