AthanorLabs / atomic-swap

💫 ETH-XMR atomic swap implementation
GNU Lesser General Public License v3.0
341 stars 44 forks source link

add relayer fee to `swapcli past` #474

Closed stubbrn closed 1 year ago

stubbrn commented 1 year ago

closes #419

swapcli past looks like this:

ID: 0xfcef3b9908284a607b9fef10c86aa82aa0f0e86cb100b9a0c665a01088a321bd
Start time: 2023-05-21-01:00:57
End time: 2023-05-21-01:01:14
Provided: 0.1 XMR
Received: 0.1 ETH (minus 0.01 ETH relayer fee)
Exchange Rate: 1 ETH/XMR
Status: Success
codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 45.11% and project coverage change: +0.09 :tada:

Comparison is base (c5bd052) 58.78% compared to head (e8b3b86) 58.88%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #474 +/- ## ========================================== + Coverage 58.78% 58.88% +0.09% ========================================== Files 128 128 Lines 12185 12437 +252 ========================================== + Hits 7163 7323 +160 - Misses 4278 4347 +69 - Partials 744 767 +23 ``` | [Impacted Files](https://app.codecov.io/gh/AthanorLabs/atomic-swap/pull/474?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | Coverage Δ | | |---|---|---| | [cmd/swapcli/main.go](https://app.codecov.io/gh/AthanorLabs/atomic-swap/pull/474?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-Y21kL3N3YXBjbGkvbWFpbi5nbw==) | `43.82% <0.00%> (-0.60%)` | :arrow_down: | | [ethereum/extethclient/eth\_wallet\_client.go](https://app.codecov.io/gh/AthanorLabs/atomic-swap/pull/474?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-ZXRoZXJldW0vZXh0ZXRoY2xpZW50L2V0aF93YWxsZXRfY2xpZW50Lmdv) | `53.57% <0.00%> (-4.77%)` | :arrow_down: | | [ethereum/utils.go](https://app.codecov.io/gh/AthanorLabs/atomic-swap/pull/474?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-ZXRoZXJldW0vdXRpbHMuZ28=) | `74.51% <ø> (ø)` | | | [protocol/backend/backend.go](https://app.codecov.io/gh/AthanorLabs/atomic-swap/pull/474?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-cHJvdG9jb2wvYmFja2VuZC9iYWNrZW5kLmdv) | `56.88% <ø> (ø)` | | | [protocol/txsender/external\_sender.go](https://app.codecov.io/gh/AthanorLabs/atomic-swap/pull/474?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-cHJvdG9jb2wvdHhzZW5kZXIvZXh0ZXJuYWxfc2VuZGVyLmdv) | `0.00% <0.00%> (ø)` | | | [protocol/xmrmaker/swap\_state.go](https://app.codecov.io/gh/AthanorLabs/atomic-swap/pull/474?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-cHJvdG9jb2wveG1ybWFrZXIvc3dhcF9zdGF0ZS5nbw==) | `68.38% <ø> (ø)` | | | [protocol/txsender/sender.go](https://app.codecov.io/gh/AthanorLabs/atomic-swap/pull/474?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-cHJvdG9jb2wvdHhzZW5kZXIvc2VuZGVyLmdv) | `60.57% <37.50%> (+1.48%)` | :arrow_up: | | [protocol/xmrtaker/instance.go](https://app.codecov.io/gh/AthanorLabs/atomic-swap/pull/474?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-cHJvdG9jb2wveG1ydGFrZXIvaW5zdGFuY2UuZ28=) | `43.16% <42.77%> (+1.60%)` | :arrow_up: | | [protocol/backend/mock\_recovery\_db.go](https://app.codecov.io/gh/AthanorLabs/atomic-swap/pull/474?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-cHJvdG9jb2wvYmFja2VuZC9tb2NrX3JlY292ZXJ5X2RiLmdv) | `88.03% <47.05%> (-6.97%)` | :arrow_down: | | [db/recovery\_db.go](https://app.codecov.io/gh/AthanorLabs/atomic-swap/pull/474?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-ZGIvcmVjb3ZlcnlfZGIuZ28=) | `66.87% <66.66%> (-0.03%)` | :arrow_down: | | ... and [5 more](https://app.codecov.io/gh/AthanorLabs/atomic-swap/pull/474?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | | ... and [9 files with indirect coverage changes](https://app.codecov.io/gh/AthanorLabs/atomic-swap/pull/474/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

dimalinux commented 1 year ago

Received: 0.1 ETH (minus 0.01 ETH relayer fee)

Question: Do we want to write it like this, or do we want to write the actual amount received, then in parenthesis write the amount paid in relayer fees? I don't think it is critical, but I'd lean towards the exact amount received being a more helpful value. Do we want the fees in parentheses or as a separate line item?

Additional questions: For the taker, do we want to summarize what they paid in ETH fees across the newSwap/setReady transactions? Do we want to track the relatively low XMR fees? The XMR fees may be low enough that we don't care, not sure.

Whatever the answers, I'm not suggesting that they all make it into this PR. But I think we should answer all the questions to know what smaller steps take us in the right direction.

stubbrn commented 1 year ago

Question: Do we want to write it like this, or do we want to write the actual amount received, then in parenthesis write the amount paid in relayer fees? I don't think it is critical, but I'd lean towards the exact amount received being a more helpful value. Do we want the fees in parentheses or as a separate line item?

I agree, the exact amount received seems more intuitive. @noot ?

noot commented 1 year ago

@stubbrn yeah, I think putting the exact amount received makes sense, but it would be good to mention received amount = (before fee swap amount - relayer fee) somewhere so people aren't asking where the extra 0.01 ETH went lol.

stubbrn commented 1 year ago

Looks like this now:

Received: 0.09 ETH (0.1 ETH - 0.01 ETH relayer fee)