# Estimate Fee/Pay Fees on destination chain

**AnycallConfig Mainnets Address**:

(Available Chains: Ethereum, Optimism, BNB Chain, Fantom, Polygon, Arbitrum, Avalanche)

0xc75b1860f553012a16de727b2bb2402aaf73eb03

**AnycallConfig Testnet Address**:

Goerli (5): 0x7EA2be2df7BA6E54B1A9C70676f668455E329d29

BNB Testnet (97): 0x5E2FeA0D1D06cD52cF949f1732bcC440AdCa459E

Fantom Testnet (4002): 0x470BFEE42A801Abb9a1492482d609fB84713d60F

Avalanche Fuji Testnet (43113): 0x6aB6d61428fde76768D7b45D8BFeec19c6eF91A8

{% hint style="info" %}
Fees are handled in anyCallConfig contracts in V7.
{% endhint %}

### Parameter for fee:

`function anyCall( address _to, bytes calldata _data, uint256 _toChainID, uint256`` `**`_flags`**`, bytes calldata )`

**The flags parameter determines the fee structure.**

**0**: Gas fee paid on source chain. Fallback not allowed.

\
**2**: Gas fee paid on destination chain. Fallback not allowed.

**4**: Gas fee paid on source chain. Allow fallback&#x20;

6: Gas fee paid on destination chain. Allow fallback&#x20;

### Fee paid on source chain.

When you use flag 0 or 4 in anyCall, you're paying fees on the source chain in gas tokens (Ether, BNB, MATIC etc).

```
function calcSrcFees(
        address _app,
        uint256 _toChainID,
        uint256 _dataLength
    ) external view returns (uint256) {
        string memory _appID = appIdentifier[_app];
        return _calcSrcFees(_appID, _toChainID, _dataLength);
    }

```

\_app can be 0 when it's not specified.

\_toChainID is the chain you're going to

\_dataLength is the length of data you're passing to the funciton anycall

The amount of fee needed for such anyCall tx would then be returned. You can pass in that amount in the source chain tx.

### Fee paid on destination chain.

When you use flag 2 or 6 in anyCall, you're indicating fees should be paid on the destination chain. This is done often to make UX more smooth by abstracting fees away for end users. The fees would be the exact gas cost used by the tx.

You would call the following function on the above contract on the destination chian to add fees.

`_account` would be your contract on the destination chain. This is different from V6.

`function deposit(address _account) external payable { executionBudget[_account] += msg.value; emit Deposit(_account, msg.value); }`

Example:

If I want to call anyCall from goerli to bnb testnet and my destination contract address for bnb testnet is *0xmock000000000000000000000000000000000000*&#x20;

I would call `deposit(`*0xmock000000000000000000000000000000000000* `)` with the appropriate gas fees.

If the gas fee isn't enough when you call anycall, the tx wouldn't execute until you top up with enough gas fees. This status would be reflected in the api. &#x20;


---

# 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.multichain.org/developer-guide/anycall-v7/estimate-fee-pay-fees-on-destination-chain.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.
