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
name | description |
---|---|
| address of the Chainlink native token / USD price feed (i.e. AVAX/USD) |
| address of the Chainlink gas price feed |
| uint256 estimated gas consumed to make a swap on the specified chain |
| uint256 estimated gas consumed in updating a payload on the chain |
| uint256 estimated gas consumed in calling |
| uint256 estimated gas consumed in calling |
| uint256 price of the native token to use as fallback if Chainlink price feed not available |
| uint256 average gas price to use as fallback if Chainlink gas feed not available |
| uint256 gas per size of data |
| uint256 gas cost for processing ack on the source chain |
| unit256 cost for processing time-locked payloads |
| uint256 cost for processing withdrawals sent to the emergency queue if Forms are paused |
addRemoteChain
This function allows for the addition of new chains, including setting same chain parameters, for use in estimation.
name | description |
---|---|
| uint64 of the EVM chain id |
|
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.
name | description |
---|---|
| uint64 EVM chain id to update |
| uint256 from 1-11 for the config type 1 = native token price feed oracle 2 = gas price feed oracle 3 = cost to swap 4 = cost to update payloads 5 = cost to deposit into vaults 6 = cost to withdraw from vaults 7 = default native token price 8 = default, average gas price 9 = gas price per byte 10 = acknowledgment gas cost 11 = timelocked gas cost 12 = emergency queue gas cost |
|
aERC20 Payments
updateRegisterAERC20Params
This function allows the EmergencyAdmin
to adjust the cost required to create an an aERC20
position from a SuperPosition id.
name | description |
---|---|
| unit256 fees to charge |
| bytes |
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.
name | description |
---|---|
| uint64 EVM chain ID of where to send the message |
| uint8 array of AMB ids to send the message through, can also send in just one AMB |
| bytes encoded message to send |
estimateAMBFees
Function to return the native tokens to be sent alongside the transaction in order for the transaction to be properly processed on destination.
name | description |
---|---|
| uint8 array of AMB ids to send the message through, can also send in just one AMB |
| uint64 EVM chain id of where to send the message |
| bytes encoded message to send |
| bytes AMB-specific data |
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 -> Functions, there 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.
name | description |
---|---|
| |
| boolean of True if deposit, False if withdrawal |
estimateMultiDstSingleVault
This function returns the native token breakdown assuming a multiple destination, single vault deposit or withdrawal.
name | description |
---|---|
| |
| boolean of True if deposit, False if withdrawal |
estimateSingleXChainMultiVault
This function returns the native token breakdown assuming a single cross-chain transaction for a multiple vault deposit or withdrawal.
name | description |
---|---|
| |
| boolean of True if deposit, False if withdrawal |
estimateSingleXChainSingleVault
This function returns the native token breakdown assuming a single cross-chain transaction for a single vault deposit or withdrawal.
name | description |
---|---|
| |
| boolean of True if deposit, False if withdrawal |
estimateSingleDirectSingleVault
This function returns the native token breakdown assuming a same-chain, single vault deposit or withdrawal.
name | description |
---|---|
| |
| boolean of True if deposit, False if withdrawal |
estimateSingleDirectMultiVault
This function returns the native token breakdown assuming a same-chain, multiple vault deposit or withdrawal.
name | description |
---|---|
| |
| boolean of True if deposit, False if withdraw |
Last updated