# CCIPLocalSimulator v0.2.2 API Reference
Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator

> For the complete documentation index, see [llms.txt](/llms.txt).

<Common callout="importPackage022" />

## CCIPLocalSimulator

A contract that simulates local CCIP (Cross-Chain Interoperability Protocol) operations for testing and development purposes.

[`CCIPLocalSimulator`](https://github.com/smartcontractkit/chainlink-local/blob/cd3bfb8c42716cfb791174314eba2c0d178551b9/src/ccip/CCIPLocalSimulator.sol)

## Errors

### CCIPLocalSimulator\_\_MsgSenderIsNotTokenOwner

```solidity
error CCIPLocalSimulator__MsgSenderIsNotTokenOwner()
```

Thrown when a caller attempts to add a token but is not the token owner or CCIP admin.

## Variables

### CHAIN\_SELECTOR

```solidity
uint64 constant CHAIN_SELECTOR = 16015286601757825753
```

> \*\*NOTE\*\*
>
>
>
> The unique CCIP Chain Selector constant.

### i\_ccipBnM

```solidity
BurnMintERC677Helper internal immutable i_ccipBnM
```

> \*\*NOTE\*\*
>
>
>
> The BurnMintERC677Helper instance for CCIP-BnM token.

### i\_ccipLnM

```solidity
BurnMintERC677Helper internal immutable i_ccipLnM
```

> \*\*NOTE\*\*
>
>
>
> The BurnMintERC677Helper instance for CCIP-LnM token.

### i\_linkToken

```solidity
LinkToken internal immutable i_linkToken
```

> \*\*NOTE\*\*
>
>
>
> The LINK token instance.

### i\_mockRouter

```solidity
MockCCIPRouter internal immutable i_mockRouter
```

> \*\*NOTE\*\*
>
>
>
> The mock CCIP router instance.

### i\_wrappedNative

```solidity
WETH9 internal immutable i_wrappedNative
```

> \*\*NOTE\*\*
>
>
>
> The wrapped native token instance.

### s\_supportedTokens

```solidity
address[] internal s_supportedTokens
```

> \*\*NOTE\*\*
>
>
>
> The list of supported token addresses.

## Functions

### constructor

Initializes the contract by deploying and configuring all required token instances.

```solidity
constructor()
```

> \*\*NOTE\*\*
>
>
>
> Constructor to initialize the contract and pre-deployed token instances.

### configuration

Retrieves the complete configuration for local CCIP simulations.

```solidity
function configuration()
    public
    view
    returns (
        uint64 chainSelector_,
        IRouterClient sourceRouter_,
        IRouterClient destinationRouter_,
        WETH9 wrappedNative_,
        LinkToken linkToken_,
        BurnMintERC677Helper ccipBnM_,
        BurnMintERC677Helper ccipLnM_
    )
```

> \*\*NOTE\*\*
>
>
>
> Returns configuration details for pre-deployed contracts and services needed for local CCIP simulations.

#### Returns

| Parameter           | Type                 | Description                                              |
| ------------------- | -------------------- | -------------------------------------------------------- |
| chainSelector\_     | uint64               | The unique CCIP Chain Selector                           |
| sourceRouter\_      | IRouterClient        | The source chain Router contract                         |
| destinationRouter\_ | IRouterClient        | The destination chain Router contract                    |
| wrappedNative\_     | WETH9                | The wrapped native token which can be used for CCIP fees |
| linkToken\_         | LinkToken            | The LINK token                                           |
| ccipBnM\_           | BurnMintERC677Helper | The ccipBnM token                                        |
| ccipLnM\_           | BurnMintERC677Helper | The ccipLnM token                                        |

### getSupportedTokens

Retrieves the list of tokens supported for cross-chain transfers.

```solidity
function getSupportedTokens(uint64 chainSelector) external view returns (address[] memory tokens)
```

> \*\*NOTE\*\*
>
>
>
> Gets a list of token addresses that are supported for cross-chain transfers by the simulator.

#### Parameters

| Parameter     | Type   | Description                    |
| ------------- | ------ | ------------------------------ |
| chainSelector | uint64 | The unique CCIP Chain Selector |

#### Returns

| Parameter | Type       | Description                                                                                     |
| --------- | ---------- | ----------------------------------------------------------------------------------------------- |
| tokens    | address\[] | Returns a list of token addresses that are supported for cross-chain transfers by the simulator |

### isChainSupported

Verifies if a given chain selector is supported by the simulator.

```solidity
function isChainSupported(uint64 chainSelector) public pure returns (bool supported)
```

> \*\*NOTE\*\*
>
>
>
> Checks whether the provided `chainSelector` is supported by the simulator.

#### Parameters

| Parameter     | Type   | Description                    |
| ------------- | ------ | ------------------------------ |
| chainSelector | uint64 | The unique CCIP Chain Selector |

#### Returns

| Parameter | Type | Description                                                   |
| --------- | ---- | ------------------------------------------------------------- |
| supported | bool | Returns true if `chainSelector` is supported by the simulator |

### requestLinkFromFaucet

Transfers LINK tokens from the faucet to a specified recipient address.

```solidity
function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success)
```

> \*\*NOTE\*\*
>
>
>
> Requests LINK tokens from the faucet. The provided amount of tokens are transferred to provided destination address.

#### Parameters

| Parameter | Type    | Description                                     |
| --------- | ------- | ----------------------------------------------- |
| to        | address | The address to which LINK tokens are to be sent |
| amount    | uint256 | The amount of LINK tokens to send               |

#### Returns

| Parameter | Type | Description                                                            |
| --------- | ---- | ---------------------------------------------------------------------- |
| success   | bool | Returns true if the transfer of tokens was successful, otherwise false |

### supportNewTokenViaGetCCIPAdmin

Adds support for a new token using CCIP admin verification.

```solidity
function supportNewTokenViaGetCCIPAdmin(address tokenAddress) external
```

> \*\*NOTE\*\*
>
>
>
> Allows user to support any new token, besides CCIP BnM and CCIP LnM, for cross-chain transfers.
> Reverts if token does not implement getCCIPAdmin() function.
> Reverts if the caller is not the token CCIPAdmin.

#### Parameters

| Parameter    | Type    | Description                                                     |
| ------------ | ------- | --------------------------------------------------------------- |
| tokenAddress | address | The address of the token to add to the list of supported tokens |

### supportNewTokenViaOwner

Adds support for a new token using owner verification.

```solidity
function supportNewTokenViaOwner(address tokenAddress) external
```

> \*\*NOTE\*\*
>
>
>
> Allows user to support any new token, besides CCIP BnM and CCIP LnM, for cross-chain transfers.
> Reverts if token does not implement owner() function.
> Reverts if the caller is not the token owner.

#### Parameters

| Parameter    | Type    | Description                                                     |
| ------------ | ------- | --------------------------------------------------------------- |
| tokenAddress | address | The address of the token to add to the list of supported tokens |