Function calculateDynamicFee

  • Calculates the dynamic fee for a transaction using the provided parameters and the Fee Oracle.

    Example

    const provider = new ethers.providers.JsonRpcProvider();
    const result = await calculateDynamicFee({
    provider,
    sender: '0x123...',
    recipientAddress: '0x456...',
    fromDomainID: 1,
    toDomainID: 2,
    resourceID: 'resource-id',
    tokenAmount: '1000',
    feeOracleBaseUrl: 'https://fee-oracle.example.com/',
    feeOracleHandlerAddress: '0x789...',
    });
    console.log(result);

    Returns

    The result of the calculation, containing the fee, calculated rate, ERC20 token address, fee data, and type.

    Parameters

    • options: {
          dynamicERC20FeeHandlerAddress: string;
          feeOracleBaseUrl: string;
          fromDomainID: number;
          provider: Provider;
          recipientAddress: string;
          resourceID: string;
          sender: string;
          toDomainID: number;
          tokenAmount: string;
      }

      An object containing the following properties:

      • dynamicERC20FeeHandlerAddress: string

        The address of dynamic fee handler

      • feeOracleBaseUrl: string

        The base URL of the Fee Oracle.

      • fromDomainID: number

        The domainId of the home network

      • provider: Provider

        The ethers provider to use.

      • recipientAddress: string

        The address of the recipient.

      • resourceID: string

        The resourceId of the token/asset

      • sender: string

        The address of the sender.

      • toDomainID: number

        The domainId of the destination network

      • tokenAmount: string

        The amount of tokens being transferred.

    Returns Promise<FeeDataResult>

Generated using TypeDoc