> ## Documentation Index
> Fetch the complete documentation index at: https://docs.railnet.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Deposits & withdrawals

> 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.

## Deposit through a Conduit

Users deposit base assets (e.g., USDC) and receive Conduit shares representing their proportional ownership.

<Steps>
  <Step title="Approve the Conduit">
    <CodeGroup>
      ```solidity Solidity theme={null}
      IERC20(usdc).approve(address(conduit), amount);
      ```

      ```typescript TypeScript theme={null}
      // Coming soon
      ```
    </CodeGroup>
  </Step>

  <Step title="Create the deposit">
    <CodeGroup>
      ```solidity Solidity theme={null}
      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 Vehicles
      conduit.create(query, userAddress);
      ```

      ```typescript TypeScript theme={null}
      // Coming soon
      ```
    </CodeGroup>

    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.
  </Step>
</Steps>

## Withdraw through a Conduit

Users return Conduit shares and receive base assets.

<Steps>
  <Step title="Approve Conduit shares">
    <CodeGroup>
      ```solidity Solidity theme={null}
      conduit.approve(address(conduit), shareAmount);
      ```

      ```typescript TypeScript theme={null}
      // Coming soon
      ```
    </CodeGroup>
  </Step>

  <Step title="Create the withdrawal">
    <CodeGroup>
      ```solidity Solidity theme={null}
      Query memory query = Query({
          owner: address(conduit),
          receiver: address(conduit),
          mode: Mode.REDEEM,
          input: new Asset[](1),
          output: new Asset[](0),
          salt: bytes32(uint256(nonce)),
          data: ""
      });
      query.input[0] = Asset({
          asset: address(conduit),
          value: shareAmount
      });

      // Create the withdrawal — auto-processes for sync Vehicles
      conduit.create(query, userAddress);
      ```

      ```typescript TypeScript theme={null}
      // Coming soon
      ```
    </CodeGroup>

    Same behavior as deposits: sync strategies settle immediately, async strategies are settled automatically by keepers.
  </Step>
</Steps>

## Automated settlement

For async operations, **keepers** call `process()` on your Conduit's active queries when the underlying protocol is ready to settle. This means:

* Your platform doesn't need to build async monitoring infrastructure
* Users never need to return to manually claim after cooldown periods
* The experience is the same for sync and async strategies from the user's perspective

```mermaid theme={null}
sequenceDiagram
    participant User
    participant Conduit
    participant Vehicle
    participant Keeper

    User->>Conduit: create(deposit)
    Conduit->>Vehicle: create(DEPOSIT)
    Vehicle-->>Conduit: PROCESSING (async)

    Note over Vehicle: Cooldown period...

    Keeper->>Conduit: process(query)
    Conduit->>Vehicle: unlock()
    Vehicle-->>Conduit: SETTLED
    Conduit-->>User: Shares minted
```

<Card title="Keeper setup" icon="robot" href="/developers/contracts/keeper">
  How keeper automation works and how to configure it.
</Card>

## Preview operations

Use `estimate()` to preview deposits and withdrawals including fees before executing:

<CodeGroup>
  ```solidity Solidity theme={null}
  // 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)
  ```

  ```typescript TypeScript theme={null}
  // Coming soon
  ```
</CodeGroup>

<Note>
  `estimate()` includes fees and slippage. For pure share-to-asset conversion without fees, use `convert()` instead.
</Note>
