Sygma allows granular control of handling fees for each resource. Even though specific implementations differ based on chain architecture, general functionality is the same. The concept is that each resource is assigned a fee strategy for every potential destination domain, with this mapping also outlining all potential bridging routes for a given resource.
Fee strategy defines a set of rules on how fees should be charged when executing deposits on the source chain.
This strategy always requires a predefined fixed fee amount per deposit. EVM imlementation can only collect fees in the native currency of the source chain, while Substrate implementation allows for fee to be collected in any configured asset.
On the diagram below, we use Sygma SDK for interaction with all services.
- Calculate the final fee
- Based on resourceID and domainsID, request a final fee amount that will be required to execute the deposit.
- Execute deposit
- Send the appropriate base currency amount based on the calculated final fee when executing the deposit.
This strategy calculates fee amount based on the amount of token being transferred.
It always collects fee in token that is being transferred, so it only makes sense for fungible token routes.
On the diagram below, we use Sygma SDK for interaction with all services.
- Calculate the final fee
- Based on resourceID, domainsID and amount, request a final fee amount that will be required to execute the deposit.
- Execute deposit
- Send the appropriate token amount based on the calculated final fee when executing the deposit.
This strategy utilizes the Sygma Fee Oracle service, which issues fee estimates with details on the gas price for the destination chain. In addition, fee oracle can provide price information for different tokens, enabling paying bridging fees in the not native currency. Each issued gas estimate has a limited time validity in which it needs to be executed.
Check out the Sygma Fee Oracle technical documentation for more details on the service and the format of the issued fee estimates.
On the diagram below, we use Sygma SDK for interaction with all services.
- Fetch fee estimate
- Based on resource ID and domains ID, request fee estimate from Fee Oracle service. This fee estimate is valid
until
expiresAt
.
- Based on resource ID and domains ID, request fee estimate from Fee Oracle service. This fee estimate is valid
until
- Validate fee estimate and calculate the final fee
- Validate the signature on the fee estimate.
- Get the final fee amount that will be collected on deposit.
- Execute deposit
- Provide fee estimate data as an argument when executing the deposit.
Check out the solidity documentation for details on EVM implementation.
Check out the substrate pallet documentation for details on Substrate implementation.