Skip to content

test(eth): add SafeERC20 V1 USDT support and docker tests#2711

Merged
shamardy merged 4 commits intodevfrom
feat/safeerc20-v1-tests
Mar 4, 2026
Merged

test(eth): add SafeERC20 V1 USDT support and docker tests#2711
shamardy merged 4 commits intodevfrom
feat/safeerc20-v1-tests

Conversation

@shamardy
Copy link
Collaborator

@shamardy shamardy commented Feb 3, 2026

Summary

  • Update V1 swap contract bytecode and ABI with SafeERC20 support
  • Add docker tests for USDT V1 swaps

Fixes #408

Changes

Contract Updates

  • Update swap_contract_bytes with SafeERC20 V1 contract (OpenZeppelin 5.4.0)
  • Update swap_contract_abi.json to match simplified V1 contract (ETH/ERC20 only, NFT functions removed)

Test Infrastructure

  • Add usdt_contract_bytes and usdt_abi.json for USDT testing
  • Add USDT deployment and funding helpers in eth.rs

New Docker Tests (V1 swaps)

  • send_and_spend_usdt_maker_payment_legacy_gas_policy
  • send_and_spend_usdt_maker_payment_priority_fee
  • send_and_refund_usdt_maker_payment_legacy_gas_policy
  • send_and_refund_usdt_maker_payment_priority_fee
  • test_usdt_get_token_info

Why SafeERC20?

USDT's transfer/transferFrom don't return a boolean. The old code used require(token.transferFrom(...)) which fails because Solidity tries to decode a non-existent return value. SafeERC20 handles this correctly.

Related

- Update swap_contract_bytes and ABI for SafeERC20 V1 contract
  (compiled with OpenZeppelin 5.4.0)
- Add USDT contract bytecode and ABI for testing
- Add docker tests for USDT swaps (taker spend, maker refund)
- Add docker tests for ERC20 decimal handling (6, 8, 18 decimals)
- Update test helpers for USDT deployment and funding

The SafeERC20 changes enable USDT and other non-standard ERC20 tokens
that don't return bool from transfer/transferFrom.

Related: GLEECBTC/etomic-swap#11

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Fixes clippy::test_attr_in_doctest warning introduced in newer Rust.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@shamardy shamardy changed the title feat(eth): add SafeERC20 V1 USDT support and docker tests test(eth): add SafeERC20 V1 USDT support and docker tests Feb 3, 2026
Copy link
Collaborator

@mariocynicys mariocynicys left a comment

Choose a reason for hiding this comment

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

We will want to update the coins file and add the number of decimals to USDT-ERC20?

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@shamardy shamardy force-pushed the feat/safeerc20-v1-tests branch from d9bbafc to c5235f9 Compare February 5, 2026 06:29
@github-actions github-actions bot added the [] label Feb 7, 2026
CI confirmed these sleeps are not needed. Remove them per PR review.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@shamardy shamardy removed the [] label Mar 4, 2026
@shamardy shamardy merged commit 5d9f151 into dev Mar 4, 2026
40 of 51 checks passed
@shamardy shamardy deleted the feat/safeerc20-v1-tests branch March 4, 2026 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants