ERC to NEP Migration Pitfalls
Common ERC-20 → NEP-17 Mistakes
Keeping 2-parameter transfer:
solidity// ❌ ERC-20 style — won't be detected as NEP-17 function transfer(address to, uint256 amount) public returns (bool) { ... } // ✅ NEP-17 style — 4 parameters function transfer(address from, address to, uint256 amount, Any calldata data) public returns (bool) { ... }Using msg.sender for authorization:
solidity// ❌ EVM pattern require(msg.sender == from, "unauthorized"); // ✅ Neo pattern — cryptographic witness verification require(Runtime.checkWitness(from), "unauthorized");Keeping approve/allowance:
solidity// ❌ Not part of NEP-17 spec — compiler warns W103 function approve(address spender, uint256 amount) public { ... } // ✅ Remove — witness model replaces approvals entirelyMissing onNEP17Payment callback:
solidity// ❌ EVM pattern receive() external payable { ... } // ✅ NEP-17 callback — required for contracts receiving tokens function onNEP17Payment(address from, uint256 amount, Any calldata data) external { ... }
Common ERC-721 → NEP-11 Mistakes
- Using uint256 token IDs instead of bytes32
- Keeping transferFrom instead of 3-param transfer
- Missing required
tokensOf()andproperties()methods - Missing
decimals()returning 0 for indivisible NFTs
