# MultiChainTellerBase

[Git Source](https://github.com/Ion-Protocol/nucleus-boring-vault/blob/cc0b494b83e17b9b169a73b96050d2810b690477/src/base/Roles/CrossChain/MultiChainTellerBase.sol)

**Inherits:** CrossChainTellerBase

Base contract for the MultiChainTellers, We've noticed that many bridge options are L1 -> L2 only, which are quite simple IE Optimism Messenger While others like LZ that can contact many bridges, contain lots of additional complexity to manage the configuration for these chains To keep this separated we are using this MultiChain syntax for the > 2 chain messaging while only CrossChain for 2 chain messengers like OP

## State Variables

### selectorToChains

```solidity
mapping(uint32 => Chain) public selectorToChains;
```

## Functions

### constructor

```solidity
constructor(address _owner, address _vault, address _accountant) CrossChainTellerBase(_owner, _vault, _accountant);
```

### addChain

adds an acceptable chain to bridge to

*Callable by OWNER\_ROLE.*

```solidity
function addChain(
    uint32 chainSelector,
    bool allowMessagesFrom,
    bool allowMessagesTo,
    address targetTeller,
    uint64 messageGasLimit,
    uint64 messageGasMin
)
    external
    requiresAuth;
```

**Parameters**

| Name                | Type      | Description                                      |
| ------------------- | --------- | ------------------------------------------------ |
| `chainSelector`     | `uint32`  | chainSelector of chain                           |
| `allowMessagesFrom` | `bool`    | allow messages from this chain                   |
| `allowMessagesTo`   | `bool`    | allow messages to the chain                      |
| `targetTeller`      | `address` | address of the target teller on this chain       |
| `messageGasLimit`   | `uint64`  | to pass to bridge                                |
| `messageGasMin`     | `uint64`  | to require a minimum provided gas for this chain |

### stopMessagesFromChain

block messages from a particular chain

*Callable by OWNER\_ROLE.*

```solidity
function stopMessagesFromChain(uint32 chainSelector) external requiresAuth;
```

**Parameters**

| Name            | Type     | Description |
| --------------- | -------- | ----------- |
| `chainSelector` | `uint32` | of chain    |

### allowMessagesFromChain

allow messages from a particular chain

*Callable by OWNER\_ROLE.*

```solidity
function allowMessagesFromChain(uint32 chainSelector, address targetTeller) external requiresAuth;
```

**Parameters**

| Name            | Type      | Description |
| --------------- | --------- | ----------- |
| `chainSelector` | `uint32`  | of chain    |
| `targetTeller`  | `address` |             |

### removeChain

Remove a chain from the teller.

*Callable by OWNER\_ROLE.*

*Callable by OWNER\_ROLE.*

```solidity
function removeChain(uint32 chainSelector) external requiresAuth;
```

### allowMessagesToChain

Allow messages to a chain.

*Callable by OWNER\_ROLE.*

```solidity
function allowMessagesToChain(
    uint32 chainSelector,
    address targetTeller,
    uint64 messageGasLimit
)
    external
    requiresAuth;
```

### stopMessagesToChain

Stop messages to a chain.

*Callable by OWNER\_ROLE.*

```solidity
function stopMessagesToChain(uint32 chainSelector) external requiresAuth;
```

### setChainGasLimit

Set the gas limit for messages to a chain.

*Callable by OWNER\_ROLE.*

```solidity
function setChainGasLimit(uint32 chainSelector, uint64 messageGasLimit) external requiresAuth;
```

### \_beforeBridge

override beforeBridge to check Chain struct

```solidity
function _beforeBridge(BridgeData calldata data) internal override;
```

**Parameters**

| Name   | Type         | Description |
| ------ | ------------ | ----------- |
| `data` | `BridgeData` | bridge data |

## Events

### ChainAdded

```solidity
event ChainAdded(
    uint256 chainSelector,
    bool allowMessagesFrom,
    bool allowMessagesTo,
    address targetTeller,
    uint64 messageGasLimit,
    uint64 messageGasMin
);
```

### ChainRemoved

```solidity
event ChainRemoved(uint256 chainSelector);
```

### ChainAllowMessagesFrom

```solidity
event ChainAllowMessagesFrom(uint256 chainSelector, address targetTeller);
```

### ChainAllowMessagesTo

```solidity
event ChainAllowMessagesTo(uint256 chainSelector, address targetTeller);
```

### ChainStopMessagesFrom

```solidity
event ChainStopMessagesFrom(uint256 chainSelector);
```

### ChainStopMessagesTo

```solidity
event ChainStopMessagesTo(uint256 chainSelector);
```

### ChainSetGasLimit

```solidity
event ChainSetGasLimit(uint256 chainSelector, uint64 messageGasLimit);
```
