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

app: Fix swap fee summary #2057

Merged
merged 2 commits into from
Jan 31, 2023
Merged

app: Fix swap fee summary #2057

merged 2 commits into from
Jan 31, 2023

Conversation

martonp
Copy link
Contributor

@martonp martonp commented Jan 20, 2023

The fee estimates for tokens on the UI was not accounting for the existance of tokens. When trading tokens, the fee is paid in the parent asset, so it doesn't make sense to display the fee as a percentage of the order amount. The fee summary pane now displays the actual fee estimate ranges instead of the percentage, and the fee details pane only shows percentages for non-token assets.

Screen Shot 2023-01-20 at 2 21 14 PM
Screen Shot 2023-01-20 at 2 21 05 PM

Closes #2041

The fee estimates for tokens on the UI was not accounting for
the existance of tokens. When trading tokens, the fee is paid in
the parent asset, so it doesn't make sense to display the fee as a
percentage of the order amount. The fee summary pane now displays
the actual fee estimate ranges instead of the percentage, and the
fee details pane only shows percentages for non-token assets.
Copy link
Member

@JoeGruffins JoeGruffins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the form, I think there could be an explanation for what the (%) is displaying for non-tokens. I don't think it is very obvious that it is the percent of total trade.

On simnet, eth will say "Order estimates and options unavailable" because "gas required exceeds allowance (big number)". Why was this?

@JoeGruffins

This comment was marked as resolved.

@martonp
Copy link
Contributor Author

martonp commented Jan 23, 2023

Trying this on testnets and seeing a little weirdness:

It seems like somehow the updates to the markets.tmpl did not make it into your build.

@JoeGruffins
Copy link
Member

JoeGruffins commented Jan 24, 2023

Let me try building again?

Oh yeah, looks ok after building again. Must have been a mistake on my side. Will hide the comment.

@buck54321 buck54321 added this to the 0.6 milestone Jan 24, 2023
"fee_projection_tooltip": "如果在您的订单匹配之前网络条件没有改变,则总费用(作为交易的百分比)应该在这个范围内。",
"fee_projection_tooltip": "如果在您的订单匹配之前网络条件没有改变,则总费用应该在这个范围内。",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No space?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha no spaces in Chinese.

<div class="d-flex flex-row align-items-center justify-content-center">
<img class="micro-icon mx-1" data-icon="from">
<span id="summarySwapFeesLow"></span>
-
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about <span class="px-1">&ndash;</span>

<td><span id="vSwapFeesLow"></span> (<span id="vSwapFeesLowPct"></span>)</td>
<td><span id="vRedeemFeesLow"></span> (<span id="vRedeemFeesLowPct"></span>)</td>
<td><span id="vSwapFeesLow"></span> <span id="vSwapFeesLowPct"></span></td>
<td><span id="vRedeemFeesLow"></span> <span id="vRedeemFeesLowPct"></span></td>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you are doing another commit, can you remove the weird extra space after span in this element tag?

@martonp
Copy link
Contributor Author

martonp commented Jan 25, 2023

On the form, I think there could be an explanation for what the (%) is displaying for non-tokens. I don't think it is very obvious that it is the percent of total trade.

I don't have time to fix this right now. I think this PR can go in without it though, because that issue was already existing.

On simnet, eth will say "Order estimates and options unavailable" because "gas required exceeds allowance (big number)". Why was this?

This is happening because when doing MaxOrder, we are attempting to estimate gas for a huge amount of lots, and the transaction will surpass the block gas limit.

@chappjc
Copy link
Member

chappjc commented Jan 25, 2023

I don't have time to fix this right now. I think this PR can go in without it though, because that issue was already existing.

Yup, all good here.

Copy link
Member

@chappjc chappjc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. @buck54321 pls merge when you're good with it, or we can push a fix to it if needed.

Comment on lines -1533 to +1539
for (const icon of Doc.applySelector(page.vDetailPane, '[data-icon]')) {
const setIcon = (icon: PageElement) => {
switch (icon.dataset.icon) {
case 'from':
icon.src = Doc.logoPath(fromAsset.symbol)
if (fromAsset.token) {
const parentAsset = app().assets[fromAsset.token.parentID]
icon.src = Doc.logoPath(parentAsset.symbol)
} else {
icon.src = Doc.logoPath(fromAsset.symbol)
Copy link
Member

@chappjc chappjc Jan 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new setIcon assumes the icon will only be used to represent the fee asset, not the traded asset. If the order verification form wants to put the icons for the traded assets, this helper won't be of help. Seems like we need [data-icon] for the traded asset and [data-fee-icon] for the fee asset icon. Fine in this PR though.

@buck54321 buck54321 merged commit ef7f8f7 into decred:master Jan 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

erc20: token fee estimates on ui are wild
4 participants