Closed stubbrn closed 1 year ago
Patch coverage: 18.97%
and project coverage change: -0.61%
:warning:
Comparison is base (
f7c6a1d
) 61.02% compared to head (8f93cb6
) 60.42%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Since this PR is not linked to a well documented issue, can you provide more documentation in the PR description.
Describe:
There are lots of images that are imported. Can you mention where they came from and what their copyright is?
Providing a RPC endpoint, a swapcli command, and a UI to see Pairs. It wouldn't be a good UX on the UI to mashup all offers from all assets into the same table (If you have a decent amount of offers); This is a first version to segment offers from all peers by asset.
A pair is simply an abstraction over offers (a summary), it doesn't contains any offers, just metadata about them, grouped by assets. For now, it isn't stored/cached anywhere, just generated on the fly when the Pair RPC endpoint is called.
Example output of swap-cli pairs:
Pair 1:
Name: ETH
Token: 0x0000000000000000000000000000000000000000
Verified: Yes
Offers: 2
Liquidity XMR: 220
Liquidity ETH: 5.50
Name: Name of the asset Token: Address of the asset Verified: Whether the token is in the verified-list or not (Not implemented yet, that will be for another PR, always set to false, unless its ETH that's always set to true) Offers: The amount of offers with that token Liquidity XMR: The sum of Max Amounts of offers (of that particular asset) [How much you can get at most from all offers from a particular asset in XMR] Liquidity ETH: Same thing but converted in ETH/Token [How much you can get at most from all offers from a particular asset in ETH/Token]
None
It doesn't depend on it, it's just that for now it's always set to false unless it's ETH.
There should be a verified-list somewhere, that is parsed by swapd. The goal is to warn the user to double-check addresses. Ability to change this list from the UI directly could be considered from the very first implementation.
https://github.com/spothq/cryptocurrency-icons/blob/master/LICENSE.md
Let's say someone makes the following absurd offer with a 2 million USDT to XMR exchange rate and half of a monero being offered up.
$ ./bin/swapcli make --token 0xdAC17F958D2ee523a2206206994597C13D831ec7 \
--min 0.12 --max 0.5 --exchange-rate 2000000
Published:
Offer ID: 0x20739776aae60ad00d7591165ef8efbbbec34b07d137f3a48169a1a234621194
Peer ID: 12D3KooWQQRJuKTZ35eiHGNPGDpQqjpJSdaxEMJRxi6NWFrrvQVi
Taker Min: 240000 "USDT"
Taker Max: 1000000 "USDT"
Would this PR then report that there is a million dollars of USDT liquidity in the network?
Would this PR then report that there is a million dollars of USDT liquidity in the network?
Yes, and if you put something absurd for XMR you get something similar as there's no proof of funds for creating an offer.
If you don't like it we could:
Let's see what @noot or someone else thinks. Are there any exchanges that print numbers like this or that have similar concept of what "liquidity" is? At least if end users are using our software, they can't offer up more XMR than they have. Offering up exchange rates that are extremely far from what anyone would take at the moment is 100% guaranteed to happen. I've never seen it not happen on any platform. I don't think having a single offer that is legit but absurd affect a network wide statistic is desirable behavior.
@stubbrn sorry for the late response. overall, I like the idea and I think it helps give a nice snapshot view of the network. but yeah, false liquidity reporting would be an issue. we could change the definition for now to say "reported liquidity" or something like that? I've thought a bit about how to add proof of XMR liquidity (#75) but there are still issues, as the maker can just transfer their funds to another account or something after sending the proof. I think for now, potentially changing the definition/adding a specific definition would be good.
Ok, so I'm probably going to:
If we're able to solve the problems with XMR proof-of-reserves, they could also maybe serve as part of heuristics for attempting to prevent false offers spam (you won't be able to just buy/borrow IP addresses for $10 or maybe less with tor exit nodes + generate PeerIds and cancel everything after step 1 of the protocol, as a taker could potentially see that N different makers have the same proof, so it would be more difficult to spam, although if you need to take the offer to be able to see it it wouldn't work), but that's outside of the scope of this discussion
Ability to select Pairs
Just a mockup for now, as the logic of the future "getPairs" RPC endpoint requires to know whether there's a "hard" whitelist or not (as discussed in #491 and #178).