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

chore: percentage fee strategy docs #206

Merged
merged 10 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from 7 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
24 changes: 21 additions & 3 deletions docs/general/Fees.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ every potential destination domain, with this mapping also outlining all potenti

Fee strategy defines a set of rules on how fees should be charged when executing deposits on the source chain.

### Static fee strategy
### Fixed fee strategy

This strategy always requires a predefined static fee amount per deposit. **It can only collect fees in the native
This strategy always requires a predefined fixed fee amount per deposit. **It can only collect fees in the native
MakMuftic marked this conversation as resolved.
Show resolved Hide resolved
currency of the source chain**.

*On the diagram below, we use [Sygma SDK](https://github.com/sygmaprotocol/sygma-sdk) for interaction with all services.*
Expand All @@ -26,7 +26,25 @@ currency of the source chain**.
2) Execute deposit
- Send the appropriate base currency amount based on the calculated final fee when executing the deposit.

### Dynamic fee strategy
### Percentage based fee strategy

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.

<img src="/docs/resources/percentage-formula-general.png" data-canonical-src="/docs/resources/percentage-formula-general.png" width="386" height="267" />

*On the diagram below, we use [Sygma SDK](https://github.com/sygmaprotocol/sygma-sdk) for interaction with all services.*

![](/docs/resources/percentage-fee-general.png)

#### Deposit flow

1) Calculate the final fee
- Based on resourceID, domainsID and amount, request a final fee amount that will be required to execute the deposit.
2) Execute deposit
- Send the appropriate token amount based on the calculated final fee when executing the deposit.

### Dynamic fee strategy (EVM only)

This strategy utilizes the [Sygma Fee Oracle service](https://github.com/sygmaprotocol/sygma-fee-oracle), which issues
fee estimates with details on the gas price for the destination chain. In addition, fee oracle can provide price
Expand Down
Binary file added docs/resources/percentage-fee-general.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/resources/percentage-formula-general.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.