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.
/** * @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. */functionestimateBridgeFee(uint256 dstChainId,uint64 dstGasLimit,uint16 customPayloadLength,bytescalldata protocolPayload) publicviewvirtualreturns(uint256 paymentAmount,uint64 dstMinGasLimit)
Name
Meaning
Destination chain Id
Destination gas limit
Length of your custom payload
UTS protocol payload
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.
/*** @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}.*/functiondstMinGasLimit(uint256 dstChainId) publicviewreturns(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.
/** * @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}. */functionestimateDeploy(uint256[] calldata dstTokenChainIds,uint256[] calldata dstConnectorChainIds) externalviewreturns(uint256[] memory tokenPaymentAmount,uint256[] memory connectorPaymentAmount,uint256 totalPaymentAmount)
Name
Meaning
Array of chain ids where UTS Tokens will be deployed
Array of chain ids where UTS Connectors will be deployed
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.
/** * @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. */functionestimateDeployNative(uint256[] calldata dstTokenChainIds,uint256[] calldata dstConnectorChainIds) externalviewreturns(uint256[] memory tokenPaymentAmountNative,uint256[] memory connectorPaymentAmountNative,uint256 totalPaymentAmountNative)