# CrossChainOPTellerWithMultiAssetSupport

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

**Inherits:** CrossChainTellerBase

LayerZero implementation of CrossChainTeller

## State Variables

### messenger

```solidity
ICrossDomainMessenger public immutable messenger;
```

### peer

```solidity
address public peer;
```

### maxMessageGas

```solidity
uint32 public maxMessageGas;
```

### minMessageGas

```solidity
uint32 public minMessageGas;
```

### nonce

```solidity
uint128 public nonce;
```

## Functions

### constructor

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

### setPeer

Callable by OWNER\_ROLE.

```solidity
function setPeer(address _peer) external requiresAuth;
```

**Parameters**

| Name    | Type      | Description     |
| ------- | --------- | --------------- |
| `_peer` | `address` | new peer to set |

### setGasBounds

*Callable by OWNER\_ROLE.*

```solidity
function setGasBounds(uint32 newMinMessageGas, uint32 newMaxMessageGas) external requiresAuth;
```

**Parameters**

| Name               | Type     | Description                 |
| ------------------ | -------- | --------------------------- |
| `newMinMessageGas` | `uint32` | the new minMessageGas bound |
| `newMaxMessageGas` | `uint32` | the new maxMessageGas bound |

### receiveBridgeMessage

Function for OP Messenger to call to receive a message and mint the shares on this chain

```solidity
function receiveBridgeMessage(address receiver, uint256 shareMintAmount, bytes32 messageId) external;
```

**Parameters**

| Name              | Type      | Description              |
| ----------------- | --------- | ------------------------ |
| `receiver`        | `address` | to receive the shares    |
| `shareMintAmount` | `uint256` | amount of shares to mint |
| `messageId`       | `bytes32` |                          |

### \_bridge

the virtual bridge function to execute Optimism messenger sendMessage()

```solidity
function _bridge(uint256 shareAmount, BridgeData calldata data) internal override returns (bytes32 messageId);
```

**Parameters**

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

**Returns**

| Name        | Type      | Description |
| ----------- | --------- | ----------- |
| `messageId` | `bytes32` | messageId   |

### \_beforeBridge

before bridge hook to check gas bound and revert if someone's paying a fee

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

**Parameters**

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

### \_quote

the virtual function to override to get bridge fees, always zero for OP

```solidity
function _quote(uint256 shareAmount, BridgeData calldata data) internal view override returns (uint256);
```

**Parameters**

| Name          | Type         | Description |
| ------------- | ------------ | ----------- |
| `shareAmount` | `uint256`    | to send     |
| `data`        | `BridgeData` | bridge data |

## Errors

### CrossChainOPTellerWithMultiAssetSupport\_OnlyMessenger

```solidity
error CrossChainOPTellerWithMultiAssetSupport_OnlyMessenger();
```

### CrossChainOPTellerWithMultiAssetSupport\_OnlyPeerAsSender

```solidity
error CrossChainOPTellerWithMultiAssetSupport_OnlyPeerAsSender();
```

### CrossChainOPTellerWithMultiAssetSupport\_NoFee

```solidity
error CrossChainOPTellerWithMultiAssetSupport_NoFee();
```

### CrossChainOPTellerWithMultiAssetSupport\_GasOutOfBounds

```solidity
error CrossChainOPTellerWithMultiAssetSupport_GasOutOfBounds(uint32);
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.nucleusearn.io/nucleus-architecture/smart-contracts/contracts/base/roles/cross-chain/cross-chain-op-teller-with-multi-asset-support/crosschainoptellerwithmultiassetsupport.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
