Estimations

Bridge and deploy estimations

We have several functions to help you with setting up cluster configs and deploy.

Estimate bridge fees

On your Token or Connector there is a function that will help you to setup gas for your bridge:

/**
 * @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.
 */
function estimateBridgeFee(
    uint256 dstChainId,
    uint64 dstGasLimit,
    uint16 customPayloadLength,
    bytes calldata protocolPayload
) public view virtual returns(uint256 paymentAmount, uint64 dstMinGasLimit)
Name
Meaning

Destination chain Id

Destination gas limit

Length of your custom payload

UTS protocol payload

dstGasLimit is gas limit that will be used by our Executor on destination chain. We have minimal gas limit that we are accepting. You can find it in UTS Router:

function dstMinGasLimit(uint256 dstChainId) public view returns(uint64 dstMinGasLimitAmount)

You can set custom gas limit for destination chain

Estimate deploy

If you want to do cross-chain deploy using our UTSDeploymentRouter, you can use a function in this contract:

/**
 * @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
)
Name
Meaning

Array of chain ids where UTS Tokens will be deployed

Array of chain ids where UTS Connectors will be deployed

As a return you will get amount, that you need to provide in PAYMENT_TOKEN. As for now it is NGL token.

Also you can retrieve price in native currency using:

/**
 * @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
)

As a return you will get amount, that you need to provide in native currency.

Last updated