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

# Create a Conduit

> Build a shared entry point that aggregates flows from multiple Multi-Vehicles

A **Conduit** wraps an existing Vehicle and issues its own ERC20 shares. This lets multiple Multi-Vehicles access the same yield source while the Conduit manages position aggregation, deposits, and redeems through the STEAM lifecycle.

<Note>
  Platforms also deploy Conduits as distribution channels for existing strategies. See [Deploy a Conduit as a platform](/conduits/quick-start) for the platform-focused guide.
</Note>

## When to use a Conduit

Use a Conduit when:

* Multiple Multi-Vehicles need access to the **same** underlying yield source
* You want a **single shared position** instead of separate per-Multi-Vehicle positions
* You need ERC20 transferable shares representing a pro-rata claim on the underlying Vehicle

If only one Multi-Vehicle will ever use a yield source, a regular Vehicle is simpler.

## Prerequisites

* A deployed STEAM Vehicle (e.g., an `ERC4626Vehicle`)
* A deployed `CoreFactory` and `FreezablePausableBeacon` for the Conduit implementation
* The deposit asset authorized in the [AssetRegistry](/developers/contracts/asset-registry) — the factory reads the initial deposit size from there at spawn time
* Familiarity with the [STEAM standard](/developers/contracts/steam-standard)

## Deploy a Conduit

<Steps>
  <Step title="Deploy the ConduitFactory">
    The `ConduitFactory` is responsible for spawning new Conduit instances.

    <CodeGroup>
      ```solidity Solidity theme={null}
      ConduitFactory factory = new ConduitFactory(
          coreFactory,
          conduitBeacon,
          accessControl
      );
      ```

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

  <Step title="Configure spawn parameters">
    Define the Conduit's configuration including the underlying Vehicle and transfer mode. The initial deposit size is read from the [AssetRegistry](/developers/contracts/asset-registry) — it is not passed here.

    <CodeGroup>
      ```solidity Solidity theme={null}
      ConduitFactory.SpawnParams memory params = ConduitFactory.SpawnParams({
          name: "My Conduit",
          symbol: "mCON",
          vehicle: IVehicle(VEHICLE_ADDRESS),
          feeManager: IFeeManager(address(0)),       // No fees for now
          accountList: IAccountList(address(0)),       // No access control
          ownerRegistry: IOwnerRegistry(address(0)),   // No external registry
          accessControl: accessControl,
          transferMode: ConduitStructs.TransferMode.ALLOW_TRANSFER,
          initialExpectedSupply: 1e18,
          depositAsset: IERC20(underlyingAsset),
          querySalt: bytes32(0),
          deploymentSalt: keccak256("my-conduit-salt")
      });
      ```

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

  <Step title="Spawn the Conduit">
    Look up the initial deposit amount in the AssetRegistry, approve the factory for that amount, then spawn.

    <CodeGroup>
      ```solidity Solidity theme={null}
      // Read the configured initial deposit from the AssetRegistry
      uint256 initialDeposit = assetRegistry.getInitialDepositAmount(underlyingAsset);

      // Approve the factory to spend it
      IERC20(underlyingAsset).approve(address(factory), initialDeposit);

      // Spawn the Conduit — factory pulls the initial deposit and burns the minted shares
      Conduit conduit = Conduit(
          address(factory.spawn(params, keccak256("deployment-salt")))
      );
      ```

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

    <Note>
      The initial deposit protects against inflation attacks by bootstrapping the share supply. The initial shares are burned automatically. The registry also dampens cumulative rounding losses from nested vault accounting — see [Asset registry](/developers/contracts/asset-registry) for sizing guidance.
    </Note>
  </Step>
</Steps>

## Make a deposit

After deployment, deposit into the Conduit. The Conduit handles pulling assets and creating the STEAM query in the underlying Vehicle.

<CodeGroup>
  ```solidity Solidity theme={null}
  // Approve the Conduit to spend your tokens
  IERC20(underlyingAsset).approve(address(conduit), 100e18);

  // Define the deposit query
  Query memory depositQuery = Query({
      owner: address(conduit),
      receiver: address(conduit),
      mode: Mode.DEPOSIT,
      input: new Asset[](1),
      output: new Asset[](0),
      salt: bytes32(uint256(1)),
      data: ""
  });
  depositQuery.input[0] = Asset({
      asset: address(underlyingAsset),
      value: 100e18
  });

  // Create and auto-process the deposit
  conduit.create(depositQuery, msg.sender);
  ```

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

After the deposit settles, check your shares:

<CodeGroup>
  ```solidity Solidity theme={null}
  uint256 shares = conduit.balanceOf(msg.sender);
  uint256 assets = conduit.totalAssets();
  ```

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

## Redeem from a Conduit

Provide Conduit shares as input, and the Conduit handles the interaction with the underlying Vehicle.

<CodeGroup>
  ```solidity Solidity theme={null}
  // Approve the Conduit to burn your shares
  conduit.approve(address(conduit), shares);

  // Define the redeem query
  Query memory redeemQuery = Query({
      owner: address(conduit),
      receiver: address(conduit),
      mode: Mode.REDEEM,
      input: new Asset[](1),
      output: new Asset[](0),
      salt: bytes32(uint256(2)),
      data: ""
  });
  redeemQuery.input[0] = Asset({
      asset: address(conduit),
      value: shares
  });

  // Create and auto-process the redeem
  conduit.create(redeemQuery, msg.sender);
  ```

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

## Next steps

<CardGroup cols={2}>
  <Card title="Configure fees" icon="percent" href="/developers/contracts/fee-manager">
    Add fee structures to your Conduit.
  </Card>

  <Card title="Learn about Conduits" icon="graduation-cap" href="/developers/contracts/conduit">
    Understand Conduit architecture in depth.
  </Card>
</CardGroup>
