Page cover

Handling non-standard and unusual tokens

3.3 Handling non-standard and unusual tokens

The ERC-20 and BEP-20 standard requires that transfer() and transferFrom() return a boolean indicating the success or failure of the call.

The implementations of one or both of these functions on some tokens—including popular ones like Tether (USDT), Binance Coin (BNB) and Ethereum (ETH) —instead have no return value. DEX Raiden v1 interprets the missing return value of these improperly defined functions as false—that is, as an indication that the transfer was not successful—and reverts the transaction, causing the attempted transfer to fail.

DEX Raiden v1.1 handles non-standard implementations differently.

Specifically, if a transfer() call has no return value, DEX Raiden v1.1 interprets it as a success rather than as a failure. This change should not affect any ERC-20 or BEP-20 tokens that conform to the standard (because in those tokens, transfer() always has a return value). DEX Raiden v1 also makes the assumption that calls to transfer() and transferFrom() cannot trigger a reentrant call to the RaidenSwap pair contract. This assumption is violated by certain ERC-20 / BEP-20 tokens, including ones that support hooks”. To fully support such tokens, DEX Raiden v1.1 includes a “lock” that directly prevents reentrancy to all public statechanging functions. This also protects against reentrancy from the user-specified callback in a flash swap.

Last updated