feat(commission): add configurable base fees for fundsIn and fundsOut - #140
Open
sh3ifu wants to merge 5 commits into
Open
feat(commission): add configurable base fees for fundsIn and fundsOut#140sh3ifu wants to merge 5 commits into
sh3ifu wants to merge 5 commits into
Conversation
|
Heads-up for the bridge side, @gutmann03: this changes
Current callers only read Found during the signer audit; no action needed on the contract side. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Commissions previously supported only a proportional component. This could not reliably cover fixed per-operation costs, such as a Bitcoin transaction fee, especially for small transfers.
Commission rules now support an optional flat baseFee:
fee = amount × stablePercent / multiplier² + baseFeeChanges
Added
baseFeeto global defaults and per-route commission configurations. It applies to bothfundsInandfundsOut; either the proportional or flat component may be zero, and setting both to zero disables the commission.Added separate configurable
minFundsInAmountandminFundsOutAmountlimits. Bridge rejects operations below the corresponding minimum.CommissionManager validates that the combined fee at the applicable minimum leaves a positive net amount:
percentageFee(minAmount) + baseFee < minAmountThis is checked during configuration and again during quoting because Bridge minimums can be changed later.
FUNDS_INsupports token or native commission; for native commission, the complete proportional plus flat fee is converted through the ETH/USD feed.FUNDS_OUTremains token-only.Also: added
calculateTotalFee, exposed the Bridge deposit/release floors, includedbaseFeeingetGlobalDefaults, and updated deployment scripts, environment variables, tests, interfaces, and README documentation.