test(eth): add SafeERC20 V1 USDT support and docker tests#2711
Open
test(eth): add SafeERC20 V1 USDT support and docker tests#2711
Conversation
- 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 <[email protected]>
2 tasks
Fixes clippy::test_attr_in_doctest warning introduced in newer Rust. Co-Authored-By: Claude Opus 4.5 <[email protected]>
mariocynicys
reviewed
Feb 3, 2026
Collaborator
mariocynicys
left a comment
There was a problem hiding this comment.
We will want to update the coins file and add the number of decimals to USDT-ERC20?
| time_lock, | ||
| other_pubkey: &taker_pubkey, | ||
| secret_hash, | ||
| amount: BigDecimal::from_str("10").unwrap(), // 10 USDT |
Collaborator
There was a problem hiding this comment.
this doesn't go along with the comment above (1 = 0.000001 USDT)
amount of 10 should mean 0.00001 USDT in this case.
| } | ||
|
|
||
| fn send_and_refund_usdt_maker_payment_impl(swap_txfee_policy: SwapGasFeePolicy) { | ||
| thread::sleep(Duration::from_secs(10)); |
Collaborator
There was a problem hiding this comment.
why is there a 10-second sleep before any logic is even executed?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #408
Changes
Contract Updates
swap_contract_byteswith SafeERC20 V1 contract (OpenZeppelin 5.4.0)swap_contract_abi.jsonto match simplified V1 contract (ETH/ERC20 only, NFT functions removed)Test Infrastructure
usdt_contract_bytesandusdt_abi.jsonfor USDT testingeth.rsNew Docker Tests (V1 swaps)
send_and_spend_usdt_maker_payment_legacy_gas_policysend_and_spend_usdt_maker_payment_priority_feesend_and_refund_usdt_maker_payment_legacy_gas_policysend_and_refund_usdt_maker_payment_priority_feetest_usdt_get_token_infoWhy SafeERC20?
USDT's
transfer/transferFromdon't return a boolean. The old code usedrequire(token.transferFrom(...))which fails because Solidity tries to decode a non-existent return value. SafeERC20 handles this correctly.Related