PaymentHelper
Introduction
This contract helps estimate various payments in the Superform Protocol.
Core Concepts
Chains are initiated with multiple variables to help with the estimation process by the PROTOCOL_ADMIN_ROLE
. There are all updatable by the EMERGENCY_ADMIN_ROLE
.
Config Data Type
addRemoteChain
This function allows for the addition of new chains, including setting same chain parameters, for use in estimation.
updateRemoteChain
This function allows the EmergencyAdmin
to update any of the above parameters at any given time for more accurate estimations. An event is emitted when any of these variables are updated.
aERC20 Payments
updateRegisterAERC20Params
This function allows the EmergencyAdmin
to adjust the cost required to create an an aERC20
position from a SuperPosition id.
calculateRegisterTransmuterAMBData
This function allows anyone to see the fees and data required to create a ERC20 position from a SuperPosition id.
AMB Fees
calculateAMBData
Function to return the cost and extraData
needed for a given message sent through various AMBs supported on Superform.
estimateAMBFees
Function to return the native tokens to be sent alongside the transaction in order for the transaction to properly process on destination.
Estimating Native Token Payments
For each type of SuperformRouter transaction (6 total combinations of cross-chain/same chain, single and multi-vault, and single and multi-destination) as found in Datatypes -> Functionsthere is a specific estimation function.
These functions all return the following:
liqAmount
: amount of native tokens contained in the liquidity requestsrcAmount
: total estimated gas expenditure on the source chaindstAmount
: total estimated gas expenditure on the destination chaintotalAmount
: total amount of native tokens to be sent alongside transaction
estimateMultiDstMultiVault
This function returns the native token breakdown assuming a multiple destination, multiple vault deposit or withdrawal.
estimateMultiDstSingleVault
This function returns the native token breakdown assuming a multiple destination, single vault deposit or withdrawal.
estimateSingleXChainMultiVault
This function returns the native token breakdown assuming a single cross-chain transaction for a multiple vault deposit or withdrawal.
estimateSingleXChainSingleVault
This function returns the native token breakdown assuming a single cross-chain transaction for a single vault deposit or withdrawal.
estimateSingleDirectSingleVault
This function returns the native token breakdown assuming a same-chain, single vault deposit or withdrawal.
estimateSingleDirectMultiVault
This function returns the native token breakdown assuming a same-chain, multiple vault deposit or withdrawal.
Last updated