AthanorLabs / atomic-swap

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

USDT compatibility #484

Closed dimalinux closed 1 year ago

dimalinux commented 1 year ago

Mainnet testing with USDT found some issues:

  1. The signatures of transfer and transferFrom in older token contracts do not return bool. While we were not checking the return value, as these functions should either return true or revert, we were still having compatibility issues for reasons described here due to USDT's use of onlyPayloadSize.
  2. USDT's approve call will fail if you don't first set the approved allowance to zero before changing the allowance to a new value.

Note: Openzepplin code is minimized to just the contract files that we use, but they are now in an @openzepplin folder which will make it easier to see if the contracts we use have changed when openzepplin makes new releases.

For stagenet testing, someone has created a replica of Tether on sepolia with an additional _mint capability added here. You can connect metamask directly to etherscan to mint yourself some TestTether. https://sepolia.etherscan.io/address/0x7169d38820dfd117c3fa1f22a697dba58d90ba06

Additional changes needed before merge:

  1. Deploy mainnet contract
  2. Prevent swapd nodes from interacting with other swapd nodes that are using an incompatible version of the contract.
codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 68.73% and project coverage change: +2.18 :tada:

Comparison is base (0f1865c) 58.68% compared to head (d7d29c8) 60.87%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #484 +/- ## ========================================== + Coverage 58.68% 60.87% +2.18% ========================================== Files 128 129 +1 Lines 12608 12843 +235 ========================================== + Hits 7399 7818 +419 + Misses 4452 4203 -249 - Partials 757 822 +65 ``` | [Impacted Files](https://app.codecov.io/gh/AthanorLabs/atomic-swap/pull/484?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | Coverage Δ | | |---|---|---| | [ethereum/check\_swap\_creator\_contract.go](https://app.codecov.io/gh/AthanorLabs/atomic-swap/pull/484?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-ZXRoZXJldW0vY2hlY2tfc3dhcF9jcmVhdG9yX2NvbnRyYWN0Lmdv) | `57.14% <ø> (ø)` | | | [ethereum/erc20\_token.go](https://app.codecov.io/gh/AthanorLabs/atomic-swap/pull/484?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-ZXRoZXJldW0vZXJjMjBfdG9rZW4uZ28=) | `10.90% <0.00%> (-0.18%)` | :arrow_down: | | [protocol/txsender/external\_sender.go](https://app.codecov.io/gh/AthanorLabs/atomic-swap/pull/484?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%> (ø)` | | | [rpc/server.go](https://app.codecov.io/gh/AthanorLabs/atomic-swap/pull/484?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-cnBjL3NlcnZlci5nbw==) | `75.39% <ø> (ø)` | | | [rpcclient/ws\_methods.go](https://app.codecov.io/gh/AthanorLabs/atomic-swap/pull/484?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-cnBjY2xpZW50L3dzX21ldGhvZHMuZ28=) | `54.16% <0.00%> (ø)` | | | [tests/ganache.go](https://app.codecov.io/gh/AthanorLabs/atomic-swap/pull/484?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-dGVzdHMvZ2FuYWNoZS5nbw==) | `80.00% <ø> (ø)` | | | [ethereum/swap\_creator.go](https://app.codecov.io/gh/AthanorLabs/atomic-swap/pull/484?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-ZXRoZXJldW0vc3dhcF9jcmVhdG9yLmdv) | `8.02% <33.33%> (ø)` | | | [cmd/swapcli/util.go](https://app.codecov.io/gh/AthanorLabs/atomic-swap/pull/484?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-Y21kL3N3YXBjbGkvdXRpbC5nbw==) | `56.43% <40.00%> (-4.06%)` | :arrow_down: | | [cliutil/utils.go](https://app.codecov.io/gh/AthanorLabs/atomic-swap/pull/484?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-Y2xpdXRpbC91dGlscy5nbw==) | `58.59% <42.85%> (+1.45%)` | :arrow_up: | | [rpc/personal.go](https://app.codecov.io/gh/AthanorLabs/atomic-swap/pull/484?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-cnBjL3BlcnNvbmFsLmdv) | `64.55% <66.66%> (+20.11%)` | :arrow_up: | | ... and [16 more](https://app.codecov.io/gh/AthanorLabs/atomic-swap/pull/484?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | | ... and [8 files with indirect coverage changes](https://app.codecov.io/gh/AthanorLabs/atomic-swap/pull/484/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.