Benchmarks for implementations of the ERC20 standard.
Note: When comparing, keep in mind that Solmate and Maple implements ERC-2612 permit so it's more fairt to compare them against OpenZeppelin Permit and not the raw OpenZeppelin implementation.
- deploy: How much gas to deploy the contract as is?
- transfer (toOwner): How much gas to transfer tokens to an account that already owns more than 0 tokens?
- transfer (toNonOwner): How much gas to transfer tokens to an account that owns 0 tokens?
- transferFrom (toOwner): How much gas for an operator to transfer tokens from one account to another that already owns more than 0 tokens?
- transferFrom (toNonOwner): How much gas for an operator to transfer tokens from one account to another that owns 0 tokens?
- approve: How much gas to approve an account to spend x amount of tokens?
- totalSupply: How much gas to check the total supply of tokens?
- balanceOf: How much gas to check the balance of an account?
- allowance: How much gas to check how many tokens an operator can spend on behalf of another account?
Implementation | allowance | approve | balanceOf | deploy | totalSupply | transferFromToNonOwner | transferFromToOwner | transferToNonOwner | transferToOwner |
---|---|---|---|---|---|---|---|---|---|
8091 | 32530 | 7788 | 677031 | 7487 | 45055 | 27933 | 37864 | 20793 | |
7961 | 32524 | 7725 | 453758 | 7490 | 43266 | 26144 | 37830 | 20759 | |
8049 | 32562 | 7747 | 838842 | 7490 | 43266 | 26144 | 37896 | 20825 | |
8025 | 32485 | 7744 | 641359 | 7487 | 43114 | 25992 | 37764 | 20693 |