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

# OP Stack

> Build on Optimism, Base, and OP Stack chains

<Warning>
  **Looking for Contributors!** This Skill needs an implementation.

  Contributing a Skill involves:

  1. Writing a reference implementation with full functionality
  2. Adding comprehensive tests
  3. Writing documentation with usage examples

  See the [ethers-provider Skill](https://github.com/evmts/voltaire/tree/main/examples/ethers-provider) for an example of a complete Skill implementation.

  Interested? Open an issue or PR at [github.com/evmts/voltaire](https://github.com/evmts/voltaire).
</Warning>

<Info>
  **Skill** — Copyable reference implementation. Use as-is or customize. See [Skills Philosophy](/concepts/skills).
</Info>

Build on Optimism, Base, and any OP Stack chain with native bridging.

## Planned Implementation

### Provider Setup

```typescript theme={null}
import { OpStack } from './OpStack.js';

const op = OpStack({
  l1Provider,
  l2Provider,
  l1CrossDomainMessenger: L1_MESSENGER,
  l2CrossDomainMessenger: L2_MESSENGER,
  l1StandardBridge: L1_BRIDGE,
  l2StandardBridge: L2_BRIDGE,
});
```

### Bridge Assets

```typescript theme={null}
// Deposit ETH
await op.depositETH({
  amount: parseEther('1'),
  signer: l1Signer,
});

// Deposit ERC20
await op.depositERC20({
  l1Token: USDC_L1,
  l2Token: USDC_L2,
  amount: parseUnits('1000', 6),
  signer: l1Signer,
});

// Withdraw (7 day challenge period)
await op.withdrawETH({
  amount: parseEther('1'),
  signer: l2Signer,
});
```

### Message Passing

```typescript theme={null}
// Send L1 -> L2 message
await op.sendMessage({
  target: l2Contract,
  message: encodedCall,
  gasLimit: 1000000,
  signer: l1Signer,
});

// Relay L2 -> L1 message after challenge period
await op.finalizeMessage({
  withdrawalTx,
  signer: l1Signer,
});
```

### Prove & Finalize Withdrawals

```typescript theme={null}
// Get withdrawal status
const status = await op.getWithdrawalStatus(withdrawalHash);
// 'waiting' | 'ready_to_prove' | 'in_challenge' | 'ready_to_finalize' | 'finalized'

// Prove withdrawal
await op.proveWithdrawal({
  withdrawalTx,
  signer: l1Signer,
});

// Finalize after challenge period
await op.finalizeWithdrawal({
  withdrawalTx,
  signer: l1Signer,
});
```

### L1 Block Info

```typescript theme={null}
// Get L1 block info on L2
const l1Info = await op.l1Block.number();
const l1Timestamp = await op.l1Block.timestamp();
const baseFee = await op.l1Block.basefee();
```

## Supported Chains

* Optimism Mainnet
* Base
* Zora
* Mode
* Any OP Stack chain

## Resources

* [Optimism Documentation](https://docs.optimism.io/)
* [OP Stack Specs](https://github.com/ethereum-optimism/optimism/tree/develop/specs)
* [Base Documentation](https://docs.base.org/)

## Related

* [arbitrum](/skills/arbitrum) — Arbitrum L2
* [tempo](/skills/tempo) — Tempo chain
