# Estimations

We offer several functions to help you estimate costs, including bridging and deployment fees.

## Bridge Costs

To estimate bridge fees and minimum gas limits, we provide the `estimateBridgeFee` function. See below for more information.

<pre class="language-solidity"><code class="lang-solidity">/**
 * @notice Returns estimated minimal amount to pay for bridging and minimal gas limit.
 * @param dstChainId destination chain Id.
 * @param dstGasLimit {redeem} call gas limit on the destination chain.
 * @param customPayloadLength user's additional data length.
 * @param protocolPayload UTS protocol's additional data.
 * @return paymentAmount source chain native currency amount to pay for bridging.
 * @return dstMinGasLimit destination chain minimal {redeem} call gas limit.
 */
<strong>function estimateBridgeFee(
</strong>    uint256 dstChainId,
    uint64 dstGasLimit,
    uint16 customPayloadLength,
    bytes calldata protocolPayload
) public view virtual returns(uint256 paymentAmount, uint64 dstMinGasLimit)
</code></pre>

<table><thead><tr><th>Name</th><th>Meaning</th></tr></thead><tbody><tr><td><pre><code>dstChainId
</code></pre></td><td>Destination chain Id</td></tr><tr><td><pre><code>dstGasLimit
</code></pre></td><td>Destination gas limit</td></tr><tr><td><pre><code>customPayloadLength
</code></pre></td><td>Length of your custom payload</td></tr><tr><td><pre><code>protocolPayload 
</code></pre></td><td>UTS protocol payload</td></tr></tbody></table>

## Gas Limits

The UTS Router provides a function called `dstMinGasLimit` which returns the amount of gas required to execute the {redeem} function on the destination chain.

```solidity
/**
* @notice Returns the amount of gas required to execute {redeem} function on the destination chain.
* @param dstChainId destination chain Id.
* @return dstMinGasLimitAmount the amount of gas required to execute {redeem} function on the provided {dstChainId}.
*/
function dstMinGasLimit(
    uint256 dstChainId
) public view returns(uint64 dstMinGasLimitAmount)
```

## Deployment Costs

If you want to perform a cross-chain deploying using our `UTSDeploymentRouter`, you can use the `estimateDeploy` function to estimate the separated payments required for sending crosschain deployment requests in the payment token. The function will return the fees you need to pay in `PAYMENT_TOKEN.`

```solidity
/**
 * @notice Estimates the separated payments required for send crosschain deployment requests in the {PAYMENT_TOKEN}.
 * @param dstTokenChainIds destination chain Ids for {UTSToken} deployments.
 * @param dstConnectorChainIds destination chain Ids for {UTSConnector} deployments.
 * @return tokenPaymentAmount array of estimated payment amount in the {PAYMENT_TOKEN} for each {dstChainId}.
 * @return connectorPaymentAmount array of estimated payment amount in the {PAYMENT_TOKEN} for each {dstChainId}.
 * @return totalPaymentAmount estimated total payment amount in the {PAYMENT_TOKEN}.
 */
function estimateDeploy(
    uint256[] calldata dstTokenChainIds,
    uint256[] calldata dstConnectorChainIds
) external view returns(
    uint256[] memory tokenPaymentAmount, 
    uint256[] memory connectorPaymentAmount, 
    uint256 totalPaymentAmount
)
```

<table><thead><tr><th>Name</th><th>Meaning</th></tr></thead><tbody><tr><td><pre><code>dstTokenChainIds
</code></pre></td><td>Array of chain ids where UTS Tokens will be deployed</td></tr><tr><td><pre><code>dstConnectorChainIds
</code></pre></td><td>Array of chain ids where UTS Connectors will be deployed</td></tr></tbody></table>

## Deployment Costs in Native Currency

If you want to perform a cross-chain deploying using our `UTSDeploymentRouter`, you can use the `estimateDeployNative` function to estimate the separated payments required for sending crosschain deployment requests in the payment token. The function will return the fees you need to pay in native currency.

```solidity
/**
 * @notice Estimates the separated payments required for send crosschain deployment requests in native currency.
 * @param dstTokenChainIds destination chain Ids for {UTSToken} deployments.
 * @param dstConnectorChainIds destination chain Ids for {UTSConnector} deployments.
 * @return tokenPaymentAmountNative array of estimated payment amount in native currency for each {dstChainId}.
 * @return connectorPaymentAmountNative array of estimated payment amount in native currency for each {dstChainId}.
 * @return totalPaymentAmountNative estimated total payment amount in native currency.
 */
function estimateDeployNative(
    uint256[] calldata dstTokenChainIds,
    uint256[] calldata dstConnectorChainIds
) external view returns(
    uint256[] memory tokenPaymentAmountNative, 
    uint256[] memory connectorPaymentAmountNative, 
    uint256 totalPaymentAmountNative
)
```


---

# 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.entangle.fi/universal-token-standard/developer-guides/estimations.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.
