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

Add Tether token support via ERC20 and Omni #4434

Closed
wants to merge 1 commit into from

Conversation

pingiun
Copy link
Contributor

@pingiun pingiun commented Aug 25, 2020

Related: bisq-network/proposals#170, #2369

From the proposal and the discussion in Keybase it is clear that the USDT token is wanted on Bisq. This PR adds basic support for the ERC20 based token and the Omni based token.

I think a discussion should be had about the best way to make this implementation better. As of now, it adds two altcoins and thus two new markets are possible. I think it can be improved by joining these accounts or these markets in some way, for when users want to be able to trade both versions of USDT. On centralised markets there is only one USDT/XBT market, and the two tokens are considered equal. I think this behaviour is desirable.

@boring-cyborg boring-cyborg bot added in:altcoins is:no-priority PR or issue marked with this label is not up for compensation right now labels Aug 25, 2020
@boring-cyborg
Copy link

boring-cyborg bot commented Aug 25, 2020

Thanks for opening this pull request!

Please check out our contributor checklist and check if Travis or Codacy found any issues with your PR. Also make sure your commits are signed, and that you applied Bisq's code style and formatting.

A maintainer will add an is:priority label to your PR if it is up for compensation. Please see our Bisq Q1 2020 Update post for more details.

Copy link
Contributor

@chimp1984 chimp1984 left a comment

Choose a reason for hiding this comment

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

I guess the price feed will not work with the postfixes. We need some extra handling there...

@chimp1984
Copy link
Contributor

You need to add the assets to bisq.asset.Asset file.
USDT seems to be not included in the price feed which is weird as it is a major coin.

@chimp1984
Copy link
Contributor

I looked into ways how to support the 2 flavors. I think easiest is to add special hanlding to PriceProvider.getAll method. Check for "USDT" result and add then 2 entries one with USDT-O and one with USDT-E, both same price. So there is a adjusted ticker entry for the price. Atm there are no prices but should be available.
@wiz Any idea why USDT is not included?

@chimp1984
Copy link
Contributor

chimp1984 commented Aug 26, 2020

Tests are also required.

@pingiun
Copy link
Contributor Author

pingiun commented Aug 26, 2020

Tests are also required.

What should be tested? There is no real new functionality. Or do you mean the tooltip string?

@pingiun
Copy link
Contributor Author

pingiun commented Aug 26, 2020

I looked into ways how to support the 2 flavors. I think easiest is to add special hanlding to PriceProvider.getAll method. Check for "USDT" result and add then 2 entries one with USDT-O and one with USDT-E, both same price. So there is a adjusted ticker entry for the price. Atm there are no prices but should be available.
@wiz Any idea why USDT is not included?

I implemented this and amended my commit

@flix1
Copy link
Member

flix1 commented Aug 26, 2020

I suppose that just as in the USD/BTC market you see all offers, including multiple payment methods (Bank wire, Zelle, US Postal Money Order, etc)... you could have a single market for USDT and incluye variants as payment methods (L-USDT, USDT-O, USDT-E). That would be the ideal.

However I would be happy to see a gradual approach in which we follow the path of least resistance and just add 1 as a regular altcoin (I would suggest USDT-Omni). IF there is demand/activity/volume we can improve on it in later releases.

The advantages of a gradual approach with the minimum amount of work are several:

-We increase the chances of having this for the next release.
-We don't waste time and effort before seeing if there is any actual demand for thiss market from Bisq users or new users.
-Devs don't become frustrated if this attempt fails.
-We allow moderators, etc to have a learning curve for USDT.

@pingiun
Copy link
Contributor Author

pingiun commented Aug 26, 2020

@flix1 do you suggest removing USDT-E from this PR and renaming USDT-O to USDT?

@flix1
Copy link
Member

flix1 commented Aug 26, 2020

@pingiun I don't really know how much work each of the options requires. It's your call.

But if it's simpler, faster to just add one option as a regular altcoin... I would suggest USDT-O. That leaves the option open to add USDT-E in the future and creates the least amount of confusion.

@pingiun
Copy link
Contributor Author

pingiun commented Aug 26, 2020

With the code in this PR I believe we can just enable USDT-O in the shipping client, leaving the code for the USDT-E token. I'm not sure how the tokens are filtered in the shipped client, does that work via the DAO asset listing?

@chimp1984
Copy link
Contributor

@flix1 That is not possible. The payment method for all altcoins is the same. That would be a major refactoring. If there is more need to group assets with diff. sub-flavors we could extend the Assets framework to support that. But I guess it first need to be proven that there is real demand.

@chimp1984
Copy link
Contributor

Tests are also required.

What should be tested? There is no real new functionality. Or do you mean the tooltip string?

The addresses. See other assets.

chimp1984
chimp1984 previously approved these changes Aug 26, 2020
Copy link
Contributor

@chimp1984 chimp1984 left a comment

Choose a reason for hiding this comment

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

utACK
Besider missing tests (address validation) it looks good to me. Price providers do not provide yet USDT so price handling cannot be tested yet. @wiz Can we add USDT already to providers?

@pingiun
Copy link
Contributor Author

pingiun commented Aug 26, 2020

Tests are also required.

What should be tested? There is no real new functionality. Or do you mean the tooltip string?

The addresses. See other assets.

The addresses are already tested, as they are ethereum and bitcoin addresses

@wiz
Copy link
Member

wiz commented Aug 27, 2020

For starters, the name of the coin isn't "Tether" but "Tether USD" which should be reflected in the class names, filenames, etc. in case we want to add Tether EUR or something in the future. Also, can you please add the Liquid Tether USD token under L-USDT ticker?

As for the price feed, any new assets need to implement their own price feeds (if they want it) since we maintain our own price feeds now.

@pingiun
Copy link
Contributor Author

pingiun commented Aug 27, 2020

For starters, the name of the coin isn't "Tether" but "Tether USD" which should be reflected in the class names, filenames, etc. in case we want to add Tether EUR or something in the future. Also, can you please add the Liquid Tether USD token under L-USDT ticker?

Done, I guessed that L-USDT uses the same addresses as Liquid Bitcoin.

As for the price feed, any new assets need to implement their own price feeds (if they want it) since we maintain our own price feeds now.

I will look at this in a new PR

addPrice(marketPriceMap, "USDT-E", price, timestampSec);
addPrice(marketPriceMap, "L-USDT", price, timestampSec);
}
addPrice(marketPriceMap, currencyCode, price, timestampSec);
Copy link
Contributor

Choose a reason for hiding this comment

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

We are adding USDT additionally as well. So we will end up with 4 price entries for USDT. I am not sure if L-USDT is treated as a seperate altcoin and if preice might differ slightly. I assume so. We should consider to either filter out the USDT-O and USDT-E in the price display code or to not add USDT (so users need to look up USDT-O or USDT-E). As both are the same price I guess its better to filter then out and use USDT.

Copy link
Contributor

Choose a reason for hiding this comment

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

As this is getting more messy with sepcial cases I would suggest to add generic support. Add a new field in the asset to indicate the ticker currency for price feed (USDT). That will be used then for picking up price and price display in case the tickersymbol is not available in the price feed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On first glance this seems kind of hard because a lot of times currency codes are just passed around as strings instead of objects. But I'll investigate how I can make a nice solution

Copy link
Contributor

Choose a reason for hiding this comment

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

I will have a look into it.

@chimp1984
Copy link
Contributor

I looked into it and it is quite a larger effort not worth it as long we dont know if it will be really used anyway.
I think we should accept the compromise that we will have 3 same prices for the 3 coins. They might disappear anyway if not traded.

@chimp1984
Copy link
Contributor

Sorry could not make a PR to your branch somehow ;-(
Here my PR with small changes: #4457
Can you close that one then?

@pingiun
Copy link
Contributor Author

pingiun commented Sep 1, 2020

Closed in favour of #4457

@pingiun pingiun closed this Sep 1, 2020
@jmacxx jmacxx mentioned this pull request Sep 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in:altcoins is:no-priority PR or issue marked with this label is not up for compensation right now
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants