token-compatibility

Solid

Detect ERC-20 token compatibility issues — fee-on-transfer, rebasing, non-standard return values, missing decimals(), low-decimal tokens, blacklistable tokens (USDC), pausable tokens. Activate on any ERC-20 integration, `transfer`/`transferFrom` use, balance-based accounting, decimal scaling.

AI & Automation 38 stars 5 forks Updated 2 days ago MIT

Install

View on GitHub

Quality Score: 82/100

Stars 20%
53
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Token compatibility detection ## When this applies - Any ERC-20 integration: lending, AMM, vault, staking, bridge - Balance-based accounting (`balanceOf(this) - prevBalance`) - Decimal scaling between tokens - Cross-chain bridges with various token implementations - Aggregators / routers handling user-supplied tokens ## Detection patterns ### Fee-on-transfer assumed away (HIGH) ```solidity uint256 before = token.balanceOf(address(this)); token.transferFrom(user, address(this), amount); shares = amount * X / Y; // ← uses `amount`, not actual received ``` Tokens like USDT (when fee enabled), SafeMoon, etc. take a fee. Use `balanceOf(this) - before` as the effective amount. ### Rebasing token accounting (HIGH) stETH, aUSDC, AMPL — balances change without `transfer`. Vaults assuming `balanceOf` ≡ deposit will mis-account. Either don't accept rebasing tokens, or use share-based accounting (wstETH-style wrappers). ### Non-standard return values — USDT (HIGH) USDT's `transfer` does NOT return bool (pre-`SafeERC20` use breaks): ```solidity bool ok = IERC20(usdt).transfer(to, amt); // ← reverts: ABI mismatch ``` Use OZ `SafeERC20` which uses low-level call + return-data inspection. ### Blacklistable tokens (HIGH) USDC, USDT can blacklist addresses. If a user gets blacklisted after deposit, the protocol may be unable to return funds → other users' funds stuck if pooled. ### Pausable tokens (HIGH) USDC, USDT can pause transfers. Protocol functions that must succeed (l...

Details

Author
iktok90-design
Repository
iktok90-design/ai-smart-contract-auditor
Created
1 weeks ago
Last Updated
2 days ago
Language
JavaScript
License
MIT

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category