npm package: @silo-finance/address-book
Description: Contract addresses and ABIs for Silo Finance protocol across all supported chains
Latest version: 0.0.1

# @silo-finance/address-book

<a href="https://www.npmjs.com/package/@silo-finance/address-book">
    <picture>
        <source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/npm/v/@silo-finance/address-book?colorA=21262d&colorB=21262d&style=flat">
        <img src="https://img.shields.io/npm/v/@silo-finance/address-book?colorA=f6f8fa&colorB=f6f8fa&style=flat" alt="Version">
    </picture>
</a>
<a href="https://github.com/silo-finance/silo-sdk/blob/main/LICENSE">
    <picture>
        <source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/npm/l/@silo-finance/address-book?colorA=21262d&colorB=21262d&style=flat">
        <img src="https://img.shields.io/npm/l/@silo-finance/address-book?colorA=f6f8fa&colorB=f6f8fa&style=flat" alt="MIT License">
    </picture>
</a>
<br />
<br />

Contract addresses and ABIs for Silo Finance protocol across all supported chains.

## Installation

```bash
npm install @silo-finance/address-book
```

```bash
pnpm add @silo-finance/address-book
```

## Supported Chains

| Chain | Key | Chain ID |
|-------|-----|----------|
| Ethereum | `ethereum` | 1 |
| Arbitrum | `arbitrum` | 42161 |
| Optimism | `optimism` | 10 |
| Base | `base` | 8453 |
| Sonic | `sonic` | 146 |
| Ink | `ink` | 57073 |
| Avalanche | `avalanche` | 43114 |
| XDC | `xdc` | 50 |
| Injective | `injective` | 2525 |

## Usage

### Import Everything

```typescript
import { siloLensAddress, siloAbi, ChainKey } from "@silo-finance/address-book";
```

### Import Specific Modules

```typescript
// Addresses only
import { siloLensAddress, siloRouterV2Address } from "@silo-finance/address-book/addresses";

// ABIs only
import { siloAbi, siloLensAbi } from "@silo-finance/address-book/abis";

// Chain utilities
import { chainKeys, chainIds, getChainKeyFromId } from "@silo-finance/address-book/chains";
```

## Addresses

Each address export is a `Record<ChainKey, Address>`:

```typescript
import { siloLensAddress, siloRouterV2Address } from "@silo-finance/address-book";

// Access by chain key
const lens = siloLensAddress.arbitrum;    // "0x8509b92145Bb2645F47c6847Bb61A46bE61AE3F2"
const router = siloRouterV2Address.sonic; // "0x21CfE326634c6ba3737F513ecaDCcCbB7500B59c"
```

### Available Addresses

**Core Contracts**
- `siloAddress` - Silo implementation
- `siloLensAddress` - SiloLens (view functions)
- `siloRouterV2Address` - Router for user interactions

**Factory Contracts**
- `siloFactoryAddress` - SiloFactory v1
- `siloFactoryV2Address` - SiloFactory v2
- `siloVaultsFactoryAddresses` - SiloVaultsFactory (array per chain)

**Interest Rate Models**
- `interestRateModelV2Address` - InterestRateModelV2 (PI model)
- `dynamicKinkModelFactoryAddress` - DynamicKinkModelFactory

**Share Tokens**
- `shareDebtTokenAddress` - ShareDebtToken implementation
- `shareProtectedCollateralTokenAddress` - ShareProtectedCollateralToken

**Incentives**
- `siloIncentivesControllerFactoryAddresses` - Incentives controllers (array per chain)

**xSilo**
- `xSiloAddress` - xSilo staking contract
- `siloTokenAddress` - SILO token

**Leverage**
- `leverageRouterAddress` - Leverage router

**Utilities**
- `MULTICALL3_ADDRESS` - Multicall3 (same on all chains)
- `ADDRESS_ZERO` - Zero address constant

### Utility Functions

```typescript
import {
  getContractAddress,
  hasContractDeployed,
  ADDRESS_ZERO,
} from "@silo-finance/address-book";

// Get address, returns null if not deployed
const address = getContractAddress(siloLensAddress, "arbitrum");

// Check if deployed on chain
const isDeployed = hasContractDeployed(siloFactoryV2Address, "ethereum"); // true
const notDeployed = hasContractDeployed(siloFactoryV2Address, "base");     // false
```

## ABIs

TypeScript-typed ABIs for viem/wagmi compatibility:

```typescript
import {
  siloAbi,
  siloLensAbi,
  siloConfigAbi,
  siloRouterAbi,
  siloOracleAbi,
  erc20Abi,
  shareTokenAbi,
  siloVaultAbi,
  interestRateModelV2Abi,
  dynamicKinkModelAbi,
  xSiloAbi,
  leverageRouterAbi,
  siloIncentivesControllerAbi,
  gaugeHookReceiverAbi,
} from "@silo-finance/address-book/abis";
```

### Usage with Viem

```typescript
import { createPublicClient, http } from "viem";
import { arbitrum } from "viem/chains";
import { siloLensAddress } from "@silo-finance/address-book";
import { siloLensAbi } from "@silo-finance/address-book/abis";

const client = createPublicClient({ chain: arbitrum, transport: http() });

const result = await client.readContract({
  address: siloLensAddress.arbitrum,
  abi: siloLensAbi,
  functionName: "someFunction",
  args: [...],
});
```

## Chain Utilities

```typescript
import {
  ChainKey,
  chainKeys,
  chainIds,
  chainConfigs,
  isChainKey,
  getChainKeyFromId,
  getChainConfig,
  DEFAULT_CHAIN,
} from "@silo-finance/address-book/chains";

// Type
const chain: ChainKey = "arbitrum";

// All supported chains
chainKeys; // ["ethereum", "arbitrum", "optimism", ...]

// Chain IDs
chainIds.arbitrum; // 42161

// Get chain key from ID
getChainKeyFromId(42161); // "arbitrum"
getChainKeyFromId(999);   // null

// Type guard
if (isChainKey(userInput)) {
  // userInput is ChainKey
}

// Full chain config
const config = getChainConfig("arbitrum");
// { key: "arbitrum", chainId: 42161, label: "Arbitrum", slug: "arbitrum" }

// Default chain
DEFAULT_CHAIN; // "arbitrum"
```

## License

[MIT](/LICENSE)