README.adoc 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. = Utilities
  2. [.readme-notice]
  3. NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/utils
  4. Miscellaneous contracts and libraries containing utility functions you can use to improve security, work with new data types, or safely use low-level primitives.
  5. * {ReentrancyGuard}: A modifier that can prevent reentrancy during certain functions.
  6. * {Pausable}: A common emergency response mechanism that can pause functionality while a remediation is pending.
  7. * {SafeCast}: Checked downcasting functions to avoid silent truncation.
  8. * {Math}, {SignedMath}: Implementation of various arithmetic functions.
  9. * {Multicall}: Simple way to batch together multiple calls in a single external call.
  10. * {Create2}: Wrapper around the https://blog.openzeppelin.com/getting-the-most-out-of-create2/[`CREATE2` EVM opcode] for safe use without having to deal with low-level assembly.
  11. * {EnumerableMap}: A type like Solidity's https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`], but with key-value _enumeration_: this will let you know how many entries a mapping has, and iterate over them (which is not possible with `mapping`).
  12. * {EnumerableSet}: Like {EnumerableMap}, but for https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets]. Can be used to store privileged accounts, issued IDs, etc.
  13. [NOTE]
  14. ====
  15. Because Solidity does not support generic types, {EnumerableMap} and {EnumerableSet} are specialized to a limited number of key-value types.
  16. ====
  17. == Math
  18. {{Math}}
  19. {{SignedMath}}
  20. {{SafeCast}}
  21. == Cryptography
  22. {{ECDSA}}
  23. {{MessageHashUtils}}
  24. {{SignatureChecker}}
  25. {{MerkleProof}}
  26. {{EIP712}}
  27. == Security
  28. {{ReentrancyGuard}}
  29. {{Pausable}}
  30. == Introspection
  31. This set of interfaces and contracts deal with https://en.wikipedia.org/wiki/Type_introspection[type introspection] of contracts, that is, examining which functions can be called on them. This is usually referred to as a contract's _interface_.
  32. Ethereum contracts have no native concept of an interface, so applications must usually simply trust they are not making an incorrect call. For trusted setups this is a non-issue, but often unknown and untrusted third-party addresses need to be interacted with. There may even not be any direct calls to them! (e.g. `ERC20` tokens may be sent to a contract that lacks a way to transfer them out of it, locking them forever). In these cases, a contract _declaring_ its interface can be very helpful in preventing errors.
  33. {{IERC165}}
  34. {{ERC165}}
  35. {{ERC165Checker}}
  36. == Data Structures
  37. {{BitMaps}}
  38. {{EnumerableMap}}
  39. {{EnumerableSet}}
  40. {{DoubleEndedQueue}}
  41. {{Checkpoints}}
  42. == Libraries
  43. {{Create2}}
  44. {{Address}}
  45. {{Arrays}}
  46. {{Base64}}
  47. {{Strings}}
  48. {{ShortStrings}}
  49. {{StorageSlot}}
  50. {{Multicall}}