Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

liquidity node v2 polish #5

Merged
merged 7 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions docs/helixbridge/fee.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,28 @@ group:
order: 2
---

## Fee for CBA model
# Fee

Under this model, Helix relies on generic messaging to deliver cross-chain information, with the cost of the underlying messaging accounting for most of the transfer costs. Currently, Helix does not charge protocol fees, so for this type of token bridge, the fees that the user needs to pay are limited to the cost of executing the message channel, which is usually paid by native tokens.
## Fee for CBA Model

Under the CBA model, Helix relies on generic cross-chain messaging channel to transmit cross-chain information, with the cost of the underlying messaging being the primary factor contributing to the transfer expenses. Currently, Helix Bridge does not charge protocol fees. Therefore, in this type of token bridge, the fees incurred by users are limited to the cost associated with executing the messaging channel, typically paid using native tokens.

## Fee for LnBridge

The fee consists of two parts, a base fee to cover the LnProvider's gas fee for executing transactions on the target chain and a liquidity fee to compensate the LnProvider for the loss of liquidity.
For LnBridge, the fee structure consists of two components: a base fee to cover the gas fees incurred by the LnProvider when executing transactions on the target chain and a liquidity fee designed to compensate the LnProvider for the loss of liquidity.

1. Base Fee

The base fee is determined and set by the LnProvider, remaining a fixed value until the LnProvider updates it. Users are required to pay this fee to the LnProvider at the time they initiate the transfer.

2. Liquidity Fee

- Base Fee
<br>It is configured by LnProvider, and the fee is a fixed value until the LnPriver is updated. This fee needs to be paid to the LnProvider at the moment the user initiates the transfer.
- Liquidity Fee
<br>Also configured by LnProvider, and this fee is related to the amount of transfer made by the user, and the higher the amount of transfer, the higher the fee charged.
Similar to the base fee, the liquidity fee is also determined by the LnProvider. However, this fee is directly related to the amount of the transfer initiated by the user. As the transfer amount increases, the corresponding fee also increases.

Assuming the user's transfer quantity is `Amount`, the base fee is `BaseFee`, and the liquidity rate is `LiquidityRate` then
Assuming the user's transfer quantity is denoted as "Amount," the base fee as "BaseFee," and the liquidity rate as "LiquidityRate," then the total fee for the transfer can be calculated as follows:

```
TotalFee = BaseFee + Amount * LiquidityRate
```

Fees are captured outside of the transfer, so users should set aside a portion of the Token to pay for cross-chain fees when transferring across the chain. LnProvider is open for registration and its fee is freely configurable, Helix backend will grab all the LnProvider information and will choose the one that makes sense for the user based on the configuration parameters. For example, an LnProvider with a lower execution fee will have a higher probability of being selected.
It's important to note that these fees are separate from the actual transfer and need to be accounted for by users. Users should set aside a portion of the token to cover the cross-chain fees. LnProvider registration is permission-less, and their fee is freely configurable. Helix's backend system will gather information from various LnProviders and choose the most suitable one for users based on their preferences. For instance, an LnProvider with a lower fee will have a higher chance of being recommended by the system.
Loading
Loading