Multichain
  • Getting Started
    • Introduction
      • Supported Chains
      • Supported Tokens
    • How it works
      • Cross-Chain Bridge
      • Cross-Chain Router
    • Governance Token
      • VeMulti
      • How to Convert ANY to MULTI
    • Security
      • Security model
      • Bug bounty (Immunefi)
      • Bug bounty (alternative)
    • How to Use
      • Fees
    • Road Map
    • FAQ
    • Careers
      • Front-end developer
      • Back-end developer
      • Test Engineer
      • Test Development Engineer
      • Security Engineer (Code Auditing)
      • Blockchain Development Engineer
      • Senior Content Editor
      • Event Manager
  • Listing and Integration
    • Token Listing
      • ERC20 Cross-chain Options
      • Difference between V2&V3
    • Chain Integration
      • EVM Networks Integration
      • Non-EVM Networks Integration
    • FAQ
  • Developer Guide
    • How to Integrate Front-end Router
    • Bridge API (Token list/Tx Status)
    • Scan API (Tx Status/Account History)
    • Token Router Testnet
    • anyCall V7
      • How to integrate anyCall V7?
      • API/Explorer
      • Quickstart (Cross-chain text example)
      • Estimate Fee/Pay Fees on destination chain
    • anyCall V6
      • How to integrate anyCall V6?
      • anyFallback
      • anyCall V6 Testnet Environments
      • Fees Paid on Source Chain
      • Context (Verify msg.sender)
    • $USDC CCTP X anyCall
      • Contract Addresses and example
    • anyCall NFT Bridge
    • Permissionless Token bridging
    • How to develop under Anyswap ERC20 standards
    • Bridge funds and anyCall (Router V7)
      • Mainnet
      • Testnet (Quick Start Example)
    • How to Integrate Front-end Bridges
Powered by GitBook
On this page
  • Parameter for fee:
  • Fee paid on source chain.
  • Fee paid on destination chain.
  1. Developer Guide
  2. anyCall V7

Estimate Fee/Pay Fees on destination chain

Fee information is checked on a contract called AnycallConfig

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

Fees are handled in anyCallConfig contracts in V7.

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

6: Gas fee paid on destination chain. Allow fallback

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

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.

PreviousQuickstart (Cross-chain text example)NextanyCall V6

Last updated 2 years ago