token-compatibility
Skill36 starsChanged 5 months agoMITView on GitHub
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.
In this repository44 other files it gives its agents.
- access-controlSkill
- approval-issuesSkill
- caching-and-incrementalSkill
- centralization-riskSkill
- confidence-scoringSkill
- cosmwasmSkill
- cross-chain-messagingSkill
- cross-contract-stateSkill
- delegatecall-risksSkill
- diamond-eip2535Skill
- dos-vectorsSkill
- erc1271-contract-signaturesSkill
- erc4337-account-abstractionSkill
- erc4626-inflationSkill
- false-positive-feedback-loopSkill
- fee-on-transferSkill
- flash-loan-attacksSkill
- initializationSkill
- inline-assemblySkill
- integer-issuesSkill
- intents-erc7683Skill
- known-good-comparisonSkill
- liquidation-cascadeSkill
- mev-frontrunningSkill
- mev-pbsSkill
- multi-pass-self-critiqueSkill
- oracle-manipulationSkill
- oracle-redundancySkill
- permit2-patternsSkill
- pragma-and-addressesSkill
- progress-and-streamingSkill
- reentrancySkill
- restaking-eigenlayerSkill
- selfdestruct-eip6780Skill
- signature-malleabilitySkill
- signature-replaySkill
- solana-anchorSkill
- storage-layoutSkill
- stylus-rustSkill
- tx-context-misuseSkill
- unchecked-callsSkill
- ve-lock-governanceSkill
- vyper-specificSkill
- zk-verifier-bugsSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 34
Use OZ SafeERC20 which uses low-level call + return-data inspection.
- Distinctive: line 89
Test/mock tokens in test/ → ignore.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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)
uint256 before = token.balanceOf(address(this));
token.transferFrom(user, address(this), amount);
shares = amount * X / Y; // ← uses `amount`, not actual receivedTokens 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):
bool ok = IERC20(usdt).transfer(to, amt); // ← reverts: ABI mismatchUse 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 (liquidations) may revert.
Low-decimal tokens (MEDIUM-HIGH)
GUSD has 2 decimals. Math assuming 18 decimals causes huge rounding errors.
shares = assets * 1e18 / something; // ← shares now astronomical or zeroTokens with hooks (ERC-777) (HIGH)
Reentrancy surface (see [[reentrancy]]). Many protocols implicitly assume vanilla ERC-20.
Tokens with double-entry (HIGH)
TUSD historically had two valid addresses. transferFrom could be invoked from either. Approval to one didn't bind the other.
Missing return on approve / non-zero approve revert (HIGH)
Some tokens (early USDT) require approve(spender, 0) before approve(spender, X). Use safeApprove or forceApprove. See [[approval-issues]].
Missing decimals() (LOW)
Non-standard tokens may lack decimals(). Guard with try/catch and default to 18.
Tokens that revert on zero-amount transfer (LOW-MEDIUM)
LEND, others. Cap-by-zero guards needed.
Severity rubric
| Pattern | Severity |
| Vault accepts fee-on-transfer with no balance-delta accounting | High |
| Protocol accepts rebasing token without share-wrapper | High |
| Naive ERC-20 transfer (no SafeERC20) | High |
| Pooled funds with blacklistable token + no escape hatch | High |
| Low-decimal token with 18-decimal-assumed math | High |
| Pausable token in liquidation path | High |
| Approve-non-zero revert ignored | High |
| Zero-amount-revert in batch flow | Medium |
Missing decimals() graceful handling | Low |
Remediation patterns
- Allowlist tokens — easier than supporting every token.
- Use SafeERC20 — covers most return-value quirks.
- Balance-delta accounting — measure
balanceOf(this) - prevafter transferFrom. - Disallow rebasing tokens — or only accept their share-wrapped form (wstETH not stETH).
- Reset approval before set —
forceApprovefrom OZ ≥4.9, orsafeApprove(0)thensafeApprove(amount). - Escape hatches — admin can swap a single user's blacklisted balance out of pooled state into a side mapping.
False-positive notes
- Protocol explicitly lists supported tokens and tests against them → not a finding for unsupported.
- Test/mock tokens in test/ → ignore.
Related
- [[unchecked-calls]]
- [[approval-issues]]
- [[reentrancy]] — ERC-777 hooks
- [[integer-issues]] — decimals math
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

