Skip to content

Rebalancing will fail if the token being rebalanced is deflationary #16

@mgcolburn

Description

@mgcolburn

Severity: Informational

Description

Deflationary tokens don't send the full expected amount to the destination on calls to transfer/transferFrom, which can result in incorrect bookkeeping. The DToken contract may be affected if this type of token were used due to the following sanity check:

 require( 
     IHandler(_withdraw[i]).withdraw(_token, _withdrawAmount[i]) == 
         _realWithdrawAmount[i], 
     "rebalance: actual withdrown amount does not match the wanted" 
 ); 

It's not a severe issue right now, but it could result in the system not holding enough tokens for users' positions and they may not receive the expected amount of tokens out.

Note that some high-profile tokens are (or can become) deflationary. For example, USDT could take a fee on transfers, though it is not currently enabled.

This behavior may be intentional, or this check might just be a sanity check slapped on there without really thinking about the implications. Given the recent fiasco revolving around deflationary tokens though, might as well mention it. Tether is technically deflationary, after all (although currently the fee is set to zero)

Recommendation

Check for this type of behavior when considering supporting new assets and avoid the use of deflationary tokens.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions