Closed JakeUrban closed 2 years ago
Will Solution 2 Option 2, removing the endpoint, mean the client needs to first create the deposit/withdrawal to see the fees?
We probably still need some way to still communicate the fees earlier so that the user knows what the fees could be before they signup with an anchor. It could be as simple as raw text field that a wallet can choose to display or not. Max flex with min tech debt. Wdyt?
I'm also in favor of Solution 2 Option 2, removing the endpoint or replacing with idea above. It's clearly limited as it is and business should be able to innovate on fees. If we remove it, I think we can remove it gracefully by saying that clients shouldn't error if they get a 404 accessing it, and if it is not available, clients should rely on the fees defined in the deposit/withdraw response. If we replace with a raw text field we can add the text field as new and optional but recommended, deprecate old field.
Will Solution 2 Option 2, removing the endpoint, mean the client needs to first create the deposit/withdrawal to see the fees?
Yes. Fees calculations cannot happen until the anchor has all the information necessary.
It could be as simple as raw text field that a wallet can choose to display or not. Max flex with min tech debt. Wdyt?
I'm for it. We can add it to the fee
object in the GET /info
response as "description".
cc @tomerweller
I'm in favor of mostly not doing anything. Maybe add a note that the /fee
endpoint is not applicable for cross asset transfers.
Support fees for transactions using quotes
I actually like this idea but it'll be hard to get this right and there's no sufficient evidence yet that there's enough demand and it's worth the effort. I do think it's worth revisiting in the future if/when we have a better understanding of various fee structures and the input they require.
Deprecate the GET /fee endpoint
The cost of deprecation is that we might be denying this functionality from anchors that this is applicable for.
We probably still need some way to still communicate the fees earlier so that the user knows what the fees could be before they signup with an anchor. It could be as simple as raw text field that a wallet can choose to display or not. Max flex with min tech debt. Wdyt?
Sounds good. This can be a failover for anchors that don't implement the /fee
endpoint, right?
Bottom line is that a good wallet UX is conveying as much information as possible to the user before they enter the flow. I don't think should give up because of conforming to a lowest common denominator.
@leighmcculloch can you provide some examples of "good" raw text fee descriptions?
Problem Description
SEP-6's
GET /fee
endpoint states the following:However, SEP-6's
GET /transaction(s)
endpoints include theamount_fee
and optionalamount_fee_asset
attributes, implying that fixed fees can in fact be charged in addition to any margin included in the exchange rate between the assets used in the transaction.Possible Solutions
There are two ways we can resolve this contradiction in our protocol, each with their pros and cons.
Solution 1: Remove
amount_fee_asset
fromGET /transactions(s)
This is the simplest solution, although it technically is a breaking change. The statement made in the
GET /fee
endpoint description would remain as-is and the information contradicting that statement would be removed.However, I don't think this is the right approach. Businesses should be able to decide how to charge fees for their services, and requiring a subset of transactions they facilitate to use a different fee mechanism imposes unnecessary restrictions for the sake of avoiding a protocol adjustment.
For example, lets say a cryptocurrency exchange charges flat and/or percentage fees for buying XLM with fiat USD as well as selling XLM for USD. Now lets say that exchange wants to make their services interoperable with the various Stellar ecosystem wallets applications. SEP-6 doesn't support fixed or percentage fees for transactions involving different assets, so the exchange is either out of luck or has to adjust their fee mechanisms for Stellar.
Solution 2: Support fees for transactions using quotes
This solution allows businesses to charge fees in any manner they choose. However, our
GET /fee
endpoint, and the fee-related info inGET /info
endpoint, currently assumes fees are charged in units of the Stellar asset. There are a few ways we can resolve this.Option 1: Adjust the request and response attributes to
GET /fee
(andGET /info
)This is difficult to design. My first thought was we could do something like the following examples.
The request above means: I want to deposit 100 BRL for some unknown amount of USDC. The fee is 2 USDC.
The request above means: I want to withdraw some unknown amount of USDC and receive 100 BRL. The fee is 5 BRL.
This obviously is not ideal because the request info is incomplete: it doesn't provide the amount of the other asset. However adding a parameter for this would effectively allow the client to determine the exchange rate for a hypothetical transfer, which is nonsensical. Its also not clear if the anchor would even be able to give accurate fees without the amount of the other asset.
An adjustment could be to let the anchor decide the amount of the other asset and include it in the response. However, this requires indicative quote logic in the
GET /fee
endpoint, similar to SEP-38'sGET /price(s)
. Do we really want to require anchors to do this?Option 2: Deprecate the
GET /fee
endpointI'd like to go big here and question the real-world value of the
GET /fee
endpoint. The use case for it is as follows:What does it mean for a fee to be "complex"? It means there are many factors that go into its calculation. However, the
GET /fee
endpoint doesn't actually allow for many input factors. It has the following parameters:GET /info
)The
type
parameter is really the key parameter here, however because the values are custom (i.e. defined in each anchor'sGET /info
endpoint) its effectively not interoperable and therefore not very useable.Instead of continuing to try to standardize a method for calculating fees with complex structures, I vote to leave this feature behind and recognize that it does a poor job at what it aims to do.