ERC-2612: Gasless Token Approval
ERC-2612 patches a structural problem with ERC-20: every approval costs a separate transaction, which means users must spend gas before they can use a DeFi protocol. Permit lets users sign an EIP-712 typed message off-chain; the protocol submits it on-chain alongside the actual swap.
Required Interface
function permit(address owner, address spender, uint256 value,
uint256 deadline, uint8 v, bytes32 r, bytes32 s) external;
function nonces(address owner) external view returns (uint256);
function DOMAIN_SEPARATOR() external view returns (bytes32);Known Footguns
Phishing replay (sign infinite permit), signature malleability (pre-EIP-2098), nonce griefing (front-runner submits before you), domain separator collisions across forks.
Neo Equivalent: Witness Scopes
Neo solves the same problem at the protocol level. Every Neo transaction includes Signers with witness scopes that limit which contracts may rely on the authorisation. The dApp builds a transaction with WitnessScope.CustomContracts authorising the swap router and the token contract — the user signs the whole tx, and Runtime.CheckWitness(from) succeeds inside the token's Transfer. No Ethereum-style permit signature parsing is needed. The mirror keeps a small permit/nonce method only to demonstrate the replay-protection shape side-by-side.
Live on Neo TestNet
Both implementations are deployed on Neo N3 TestNet (network magic 894710606).
| Implementation | Contract Hash | Deploy Tx |
|---|---|---|
Solidity (neo-solc) | 0xedd521fdaa7422b7465673fa5df6551590c16aa0 | (reused — see 0xedd521fdaa7422b7465673fa5df6551590c16aa0) |
Neo C# (nccs) | 0xb451279fd8ab0e735e50edd6c6ca7e60eb90b70c | (reused — see 0xb451279fd8ab0e735e50edd6c6ca7e60eb90b70c) |
Checked-in snapshot matches on initial nonceOf; the manifest now also exercises the witness-scoped permit nonce bump. Source pairs under docs/standards-mirror/deployments/erc-2612/.
