> For the complete documentation index, see [llms.txt](https://docs.nucleusearn.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nucleusearn.io/nucleus-architecture/smart-contracts/contracts/base/roles/cross-chain/cross-chain-teller-base/crosschaintellerbase.md).

# CrossChainTellerBase

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

**Inherits:** TellerWithMultiAssetSupport

Base contract for the CrossChainTeller, includes functions to overload with specific bridge method

## Functions

### constructor

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

### depositAndBridge

function to deposit into the vault AND bridge crosschain in 1 call

```solidity
function depositAndBridge(
    ERC20 depositAsset,
    uint256 depositAmount,
    uint256 minimumMint,
    BridgeData calldata data
)
    external
    payable
    requiresAuth
    nonReentrant;
```

**Parameters**

| Name            | Type         | Description                        |
| --------------- | ------------ | ---------------------------------- |
| `depositAsset`  | `ERC20`      | ERC20 to deposit                   |
| `depositAmount` | `uint256`    | amount of deposit asset to deposit |
| `minimumMint`   | `uint256`    | minimum required shares to receive |
| `data`          | `BridgeData` | Bridge Data                        |

### previewFee

Preview fee required to bridge shares in a given feeToken.

```solidity
function previewFee(uint256 shareAmount, BridgeData calldata data) external view returns (uint256 fee);
```

### bridge

bridging code to be done without deposit, for users who already have vault tokens

```solidity
function bridge(
    uint256 shareAmount,
    BridgeData calldata data
)
    public
    payable
    requiresAuth
    returns (bytes32 messageId);
```

**Parameters**

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

### \_bridge

the virtual bridge function to be overridden

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

**Parameters**

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

**Returns**

| Name     | Type      | Description |
| -------- | --------- | ----------- |
| `<none>` | `bytes32` | messageId   |

### \_quote

the virtual function to override to get bridge fees

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

**Parameters**

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

### \_beforeBridge

after bridge code, just an emit but can be overridden

the before bridge hook to perform additional checks

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

**Parameters**

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

### \_afterBridge

after bridge code, just an emit but can be overridden

```solidity
function _afterBridge(uint256 shareAmount, BridgeData calldata data, bytes32 messageId) internal virtual;
```

**Parameters**

| Name          | Type         | Description                      |
| ------------- | ------------ | -------------------------------- |
| `shareAmount` | `uint256`    | share amount burned              |
| `data`        | `BridgeData` | bridge data                      |
| `messageId`   | `bytes32`    | message id returned when bridged |

### \_beforeReceive

a before receive hook to call some logic before a receive is processed

```solidity
function _beforeReceive() internal virtual;
```

### \_afterReceive

a hook to execute after receiving

```solidity
function _afterReceive(uint256 shareAmount, address destinationChainReceiver, bytes32 messageId) internal virtual;
```

**Parameters**

| Name                       | Type      | Description                     |
| -------------------------- | --------- | ------------------------------- |
| `shareAmount`              | `uint256` | the shareAmount that was minted |
| `destinationChainReceiver` | `address` | the receiver of the shares      |
| `messageId`                | `bytes32` | the message ID                  |

## Events

### MessageSent

```solidity
event MessageSent(bytes32 messageId, uint256 shareAmount, address to);
```

### MessageReceived

```solidity
event MessageReceived(bytes32 messageId, uint256 shareAmount, address to);
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.nucleusearn.io/nucleus-architecture/smart-contracts/contracts/base/roles/cross-chain/cross-chain-teller-base/crosschaintellerbase.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
