-
Notifications
You must be signed in to change notification settings - Fork 39
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
Exchange: When settling orders, have the market provide the exchange fee in nhash. #1839
Comments
This approach [appears to] matches what was done for the capital commitments which greatly simplifies the process of handling fees since they stay in nhash and are explicitly paid during transaction submission... |
There's a small hickup with this approach when it comes to the A fix would be to require the user (that's calling |
If the bid/ask order fees are from the user and that flow is clear ... then the rates used for those actions should be set appropriately ... the settlement action of crossing orders would definitely be paid by the market though so it likely means that a shift in the configuration of fees is required to make all things line up as intended with this update. |
I was hoping that this could be a quick fix in the hopes that we could get it in with Rates aren't defined differently for settlement by the market vs by a user. And we already have eight different rate-related configuration fields. Splitting it between market settle vs user settle would add four more, which I'd rather not do. Until we get a fix, we can just say that all the fees can only be in The root of the problem is that the market is collecting settlement fees, and the exchange should receive a portion of them. But not all settlements are initiated by the market, so adding an extra We can currently take the settlement fees out of the users accounts because either there's a hold on those funds in their accounts (and they've acknowledged that that amount is going to be eventually taken), or the funds can come out of the price funds the account just received (which they implicitly approved of by creating the order). And we can currently take our cut from the market accounts because we know that they just received more than we're taking out, and they also knew that we would be taking that portion. But if the exchange is getting its fee in a denom not otherwise involved in the settlement or its fees, neither of those actions are possible anymore. With this issue, I was going to change it so that the fees that the exchange should receive would need to be included as part of the I should also point at that, even with this change, we'd still want to restrict order creation fees to I was curious to get a feel for the exchange's split amount, so I picked some numbers and did some math. Note that the exchange stuff doesn't allow for fractional amounts, but in these examples, I'm using Assume that:
Now, let's compare some For all three endpoints, here's what currently happens:
With this change, here's what would happen:
|
Summary
Update the
MsgMarketSettleRequest
endpoint to collect the exchange fees from the market in the chain's fee denom instead of the denoms that the market is collecting.Problem Definition
When a market collects fees during a
MsgMarketSettleRequest
, a portion of those fees go to the fee collector and then to validators. Those fees can be in any denom, though. When they are a restricted denom, there can be problems sending them to the fee collector and validators.Proposal
MsgMarketSettleRequest
that allows a market to provide NAVs that have a price with the fee denom. The assets can have a denom of anything being collected as a fee.MarketSettle
instead of applying the bips to each order fee denom, use NAVs (either provided or from state) to convert each order fee denom to the chain's fee denom and apply the bips to that. Consume this fee the same way that it's done for commitment settlement.MsgMarketSettleRequest
and returns the required fee amount.For Admin Use
The text was updated successfully, but these errors were encountered: